Proper way to bind multiple series from SAME datasource
Thanks for using Syncfusion products.
The property "YNames" of ChartDataBindModel object is used to bind data in columns of the table to the y values of chart series points. This property is defined as an array because chart types like range area chart and heat map chart requires a minimum of two y values to plot and they need one column data for each y value. Hence, the "YNames" property cannot be used to bind a ChartDataBindModel object with more than one series.
Please refer the following code snippet to bind a table data to more than one series:
[VB]
Function ReturnDataBindModel (ByVal ColumnName As String) As ChartDataBindModel
Dim Model1 As New ChartDataBindModel(Main.Context.NmsSummaries.Local.ToBindingList)
Model1.XName=”TheDate”
Model1.YNames=New String() {ColumnName}
Return Model1
End Sub
Sub Main()
Dim Series1 As New ChartSeries(“Val1”, ChartSeriesType.Line)
Series1.Text=Series1.Name
Series1.SeriesModel=ReturnDataBindModel(“Val1”)
CC1.Series.Add(Series1)
Dim Series2 As New ChartSeries(“Val2”, ChartSeriesType.Line)
Series2.Text=Series2.Name
Series2.SeriesModel=ReturnDataBindModel(“Val2”)
CC2.Series.Add(Series2)
End Sub
The ChartDataBindModel object can be reused as in the above code snippet to bind a table data with multiple series or we have to use one ChartDataBindModel object for each series.
Please let us know if you have any concerns.
Regards,
Anandaraj
- 1 Reply
- 2 Participants
-
DB Dennis Beaugrand
- May 31, 2013 01:07 PM UTC
- Jun 5, 2013 07:14 PM UTC