I have a dataset, How can I use the below code to bind the radchart by using the below Original code?
Partial Public Class Chart_Examples_Skinning_Bars_DefaultCS
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
Dim series As New ChartSeries()
series.Type = ChartSeriesType.Bar
series.DataXColumn = "XValue"
series.DataYColumn = "YValue"
CapacityRadChart.Series.Add(series)
CapacityRadChart.DataSource = Me.GetDataSource()
CapacityRadChart.DataBind()
End If
End Sub
Private Function GetDataSource() As List(Of Class1)
Dim r As New Random()
Dim source As List(Of Class1) = New List(Of Class1)
For i As Integer = 0 To 399
Dim item As New Class1()
item.XValue = i
item.YValue = r.[Next](0, 100)
source.Add(item)
Next
Return source
End Function
End Class
I’m doing it in this way, But it is throwing the following error:
the type of column with “COUNT” is not numeric”.
Please could you suggest appropriate code?
Dim dt As DataTable = ds.Tables.Item(0)
Dim dr As DataRow
Dim listdata As new List(Of Double)
Dim list As New List(Of DataRow)(dt.[select]())
For Each dr In dt.Rows
list.Add(dr.ToLis)
Next
Dim series As New ChartSeries()
series.Type = ChartSeriesType.Bar
series.DataXColumn = "CapacityDelay"
series.DataYColumn = "COUNT"
BaselineRadChart.Clear()
BaselineRadChart.Series.Add(series)
BaselineRadChart.DataSource = list
BaselineRadChart.DataBind()
How do you create a columns in ds.Tables.Item(0)? Do you bind the DataTable directly from database or create the DataTable manually?
If you create it manually, then you may need to declare the DataType for the DataColumn