Hello, We are looking in to replacing existing chartcontrol we have with Aspose Chart.
We need to create the chart from a datatable. Please see code below. Please let us know how below can be done using aspose components, thsi chartcontrol will be on the asp.net web page with an export to excel button on it.
We will also need output this chart to excel using aspose components. Basically output chart to excel with data populating from dataset. Please advise.
Thx
Dim ds As DataSet = CreateDataSet()
If ds.Tables(0).Rows.Count > 0 Then
Dim chart As LineChart = New LineChart
chart.Line.Color = Color.Empty
chart.Fill.Color = Color.Green
chart.LineMarker = New DiamondLineMarker(8, Color.Green, Color.Green)
chart.Legend = "Test A"
Dim chart1 As ColumnChart = New ColumnChart
chart1.MaxColumnWidth = 10
chart1.Fill.Color = Color.FromArgb(50, Color.Navy)
chart1.Shadow.Visible = True
chart1.Legend = "Test B"
For Each row As DataRow In ds.Tables(0).Rows
If Not row("Test A") Is System.DBNull.Value Then
chart.Data.Add(New ChartPoint(row("dt").ToString, CDec(row("TestA"))))
End If
If Not row("Test B") Is System.DBNull.Value Then
chart1.Data.Add(New ChartPoint(row("dt").ToString, CDec(row("Test B"))))
End If
Next
'chartControl1.Width = ((ds.Tables(0).Rows.Count) * 35)
chartControl1.Charts.Add(chart)
chartControl1.Charts.Add(chart1)
ChartControl1.RedrawChart()
End If