VB.net - 显示多个Y轴的图表

时间:2014-09-14 20:54:43

标签: vb.net charts

我对vb.net有点新鲜。我需要在Y轴上显示包含2个不同数据项的Excel图表。我需要从DB获取数据并绑定到图表。有以下代码..

        Dim myCommand As New SqlCommand
        myCommand.Connection = myConnection
        myConnection.Open()

        myCommand.CommandText = MainSQLStr
        Dim myReader As SqlDataReader = myCommand.ExecuteReader()

        Dim newSeries = New DataVisualization.Charting.Series()
        newSeries.ChartType = DataVisualization.Charting.SeriesChartType.Column
        newSeries.YAxisType = AxisType.Secondary

        newSeries.Points.DataBindXY(myReader, "Model", myReader, "count")

        Dim newSeries2 = New DataVisualization.Charting.Series()
        newSeries2.ChartType = DataVisualization.Charting.SeriesChartType.Column
        newSeries2.Points.DataBindXY(myReader, "Model", myReader, "ModelValue")

        Chart1.Series.Add(newSeries)

        Chart1.Series.Add(newSeries2)

问题是我看到只有一个数据系列的图表。第二个系列缺失了。我不确定,我错过了什么。任何帮助表示赞赏。谢谢!

0 个答案:

没有答案