Dim dataSource As New BindingList(Of SalesData)()
dataSource.Add(New SalesData("2000", 3))
Dim dataSeriesModel As New CategoryAxisDataBindModel(dataSource)
dataSeriesModel.CategoryName = "Mes"
dataSeriesModel.YNames = New String() { "Total" }
Dim chartSeries As New ChartSeries("Total")
chartSeries.CategoryModel = dataSeriesModel
Me.chart1.PrimaryXAxis.ValueType = ChartValueType.Category
Me.chart1.Series.Add(chartSeries)
Me.Controls.Add(chart1) |
Private buttonOk As New Button()
Private chart1 As ChartControl = New Syncfusion.Windows.Forms.Chart.ChartControl()
Public Sub New()
Me.buttonOk.Text = "Click to Change data"
AddHandler Me.buttonOk.Click, AddressOf ButtonOk_Click
Me.buttonOk.Width = 200
Me.Size = New Size(1200, 500)
Me.chart1.Location = New Point(10, 40)
Me.chart1.Size = New Size(1100, 400)
Dim dataSource As New BindingList(Of SalesData)()
dataSource.Add(New SalesData("2000", 3))
Dim dataSeriesModel As New CategoryAxisDataBindModel(dataSource)
dataSeriesModel.CategoryName = "Mes"
dataSeriesModel.YNames = New String() { "Total" }
Dim chartSeries As New ChartSeries("Total")
chartSeries.CategoryModel = dataSeriesModel
Me.chart1.PrimaryXAxis.ValueType = ChartValueType.Category
Me.chart1.Series.Add(chartSeries)
Me.Controls.Add(buttonOk)
Me.Controls.Add(chart1)
End Sub
Private Sub ButtonOk_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim dataSource As New BindingList(Of SalesData)()
dataSource.Add(New SalesData("2000", 13))
Dim dataSeriesModel As New CategoryAxisDataBindModel(dataSource)
dataSeriesModel.CategoryName = "Mes"
dataSeriesModel.YNames = New String() { "Total" }
Me.chart1.Series(0).CategoryModel = dataSeriesModel
Me.chart1.Redraw(True)
End Sub |