关于MSChart图像无易做图确显示的问题
我这里有一段用MSChart绘图的代码,用VS.NET2003在XP系统下写的,但是很奇怪,放到2000的系统上就显示不出图像(没有报错,就是不出图像),找了很久也没发现是哪里的问题.请有经验的朋友帮忙解答,谢谢!
下面是部分相关代码:
Private Sub PlotMschart(ByVal asSeriesNames() As Object, ByVal TimeX(,) As Object, ByVal ValueYs(,) As Object)
MSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType2dXY ' set to X Y Scatter chart
MSChart.ChartData = MergeChartArray(TimeX, ValueYs)
MSChart.Plot.UniformAxis = False
MSChart.AllowSeriesSelection = False
MSChart.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).ValueScale.Auto = True
MSChart.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Time(sec)"
'Legend
MSChart.Legend.Location.Visible = True
.
.
.
.
end sub --------------------编程问答-------------------- 贴出所有代码来! --------------------编程问答-------------------- Private Sub PlotMschart(ByVal asSeriesNames() As Object, ByVal TimeX(,) As Object, ByVal ValueYs(,) As Object)
MSChart.chartType = MSChart20Lib.VtChChartType.VtChChartType2dXY ' set to X Y Scatter chart
MSChart.ChartData = MergeChartArray(TimeX, ValueYs)
MSChart.Plot.UniformAxis = False
MSChart.AllowSeriesSelection = False
MSChart.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).ValueScale.Auto = True
MSChart.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Time(sec)"
'Legend
MSChart.Legend.Location.Visible = True
For index As Integer = 0 To asSeriesNames.GetUpperBound(0)
'Setting the SeriesName as Legend, Series Index begin from 0
MSChart.Plot.SeriesCollection(index * 2 + 1).LegendText = asSeriesNames(index)
'Setting Series point marker
MSChart.Plot.SeriesCollection(index * 2 + 1).SeriesMarker.Show = True
Next
Dim yAxis As MSChart20Lib.Axis = MSChart.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY)
yAxis.ValueScale.Auto = False
'Setting the Y axis' scale
yAxis.ValueScale.Minimum = Math.Round(GetMinofArray(ValueYs) - (GetMaxofArray(ValueYs) - GetMinofArray(ValueYs)) / 4 - 0.5)
yAxis.ValueScale.Maximum = Math.Round(GetMaxofArray(ValueYs) + (GetMaxofArray(ValueYs) - GetMinofArray(ValueYs)) / 4 + 0.5)
If yAxis.ValueScale.Minimum = yAxis.ValueScale.Maximum Then
yAxis.ValueScale.Minimum = yAxis.ValueScale.Minimum - 1
yAxis.ValueScale.Maximum = yAxis.ValueScale.Maximum + 1
End If
yAxis.ValueScale.MajorDivision = 4
yAxis.ValueScale.MinorDivision = 1
yAxis.CategoryScale.Auto = False ' Sets manual scaling.
yAxis.CategoryScale.DivisionsPerLabel = 1 ' Label appears every two divisions.
yAxis.CategoryScale.DivisionsPerTick = 1 ' Ticks appear every two divisions.
yAxis.CategoryScale.LabelTick = True ' Labels displayed on top of
yAxis.AxisGrid.MajorPen.Style = MSChart20Lib.VtPenStyle.VtPenStyleDashed
'Setting the X axis' scale
Dim xAxis As MSChart20Lib.Axis = MSChart.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX)
xAxis.ValueScale.Auto = True
End Sub
上面就是这个过程的代码了,数组已经用MergeChartArray分配好了,不知道有没有帮助,请帮忙看下。。 --------------------编程问答-------------------- 看下操作系统的不同了
.net框架是否同一版本? --------------------编程问答-------------------- 是同一版本,都是.NET 2003,就是在不同操作系统上显示的问题,奇怪了
补充:.NET技术 , VB.NET