Partial Class VB_LineCharts Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then 'set the type of the chart - uncomment the lines below for different chart types ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.Line ' use ChartType.Line if you have only one Data Series ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.MultiLine ' use ChartType.MultiLine if you have multiple Data Series ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.Surface ' use ChartType.Surface if you have only one Data Series ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.MultiSurface ' use ChartType.MultiSurface if you have multiple Data Series ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.Surface3D ' use ChartType.Surface3D if you have only one Data Series ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.MultiSurface3D ' use ChartType.MultiSurface3D if you have multiple Data Series ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.MultiCurve ' use ChartType.MultiCurve if you have one or multiple Data Series ' ChartCustomControl1.Type = ChartControl.ChartCustomControl.ChartType.Multi3DLine ' use ChartType.Multi3DLine if you have one or multiple Data Series 'set the data series (values that will appear on the Y axis) ChartCustomControl1.DataSeries.Clear() ChartCustomControl1.DataSeries.Add(New ChartControl.DataItem("Seller1")) ChartCustomControl1.DataSeries.Add(New ChartControl.DataItem("Seller2")) ChartCustomControl1.DataSeries.Add(New ChartControl.DataItem("Seller3")) 'there is another alternative to set the data series 'ChartCustomControl1.setDataSeries("Seller1,Seller2,Seller3") 'set the values that will appear on the X axis ChartCustomControl1.Labels = "Date" 'format the values that will appear on the X axis (if needed) ChartCustomControl1.LabelsFormatString = "{0:dd-MMM-yyyy}" 'set a data source 'to set a data source you can either use DataSource property or DataSourceID ChartCustomControl1.DataSource = GetTestData() ChartCustomControl1.DataBind() 'set chart title ChartCustomControl1.GraphTitle = "Title of the chart" 'set the label that will appear under the chart ChartCustomControl1.XAxisLabel = "X Asis Label" 'set the label that will appear on the left of the chart ChartCustomControl1.YAxisLabel = "Y Asis Label" 'Shadows - by default, data elements have shadows, but this can be disabled ChartCustomControl1.DrawShadow = False 'Legend - the legend only appears if you have multiple data series ChartCustomControl1.setLegend("Seller 1,Seller 2,Seller 3") 'data point labels - these are the values that appear on top of each bar ChartCustomControl1.ValueLabelsFormatString = "{0}" ' display the chart as Flash (with animation) instead of image 'ChartCustomControl1.UseFlash = True End If End Sub ' <summary> ' This method returns a sample DataTable with test data ' The tables has the following structure: ' - Date (DateTime) ' - Seller1 (number) ' - Seller2 (number) ' - Seller3 (number) ' </summary> Private Function GetTestData() As DataTable Dim dt As DataTable = New DataTable dt.Columns.Add("Date", GetType(DateTime)) dt.Columns.Add("Seller1", GetType(Int32)) dt.Columns.Add("Seller2", GetType(Int32)) dt.Columns.Add("Seller3", GetType(Int32)) Dim row As DataRow = dt.NewRow() row("Date") = New DateTime(2006, 1, 1) row("Seller1") = 150 row("Seller2") = 100 row("Seller3") = 200 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 2, 1) row("Seller1") = 120 row("Seller2") = 110 row("Seller3") = 170 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 3, 1) row("Seller1") = 220 row("Seller2") = 140 row("Seller3") = 290 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 4, 1) row("Seller1") = 180 row("Seller2") = 60 row("Seller3") = 100 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 5, 1) row("Seller1") = 110 row("Seller2") = 160 row("Seller3") = 120 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 6, 1) row("Seller1") = 160 row("Seller2") = 120 row("Seller3") = 190 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 7, 1) row("Seller1") = 200 row("Seller2") = 160 row("Seller3") = 220 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 8, 1) row("Seller1") = 220 row("Seller2") = 80 row("Seller3") = 120 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 9, 1) row("Seller1") = 270 row("Seller2") = 200 row("Seller3") = 100 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 10, 1) row("Seller1") = 300 row("Seller2") = 230 row("Seller3") = 190 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 11, 1) row("Seller1") = 260 row("Seller2") = 100 row("Seller3") = 200 dt.Rows.Add(row) row = dt.NewRow() row("Date") = New DateTime(2006, 12, 1) row("Seller1") = 320 row("Seller2") = 190 row("Seller3") = 270 dt.Rows.Add(row) Return dt End Function Protected Sub DdlChartType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlChartType.SelectedIndexChanged ChartCustomControl1.Type = CType(System.Enum.Parse(GetType(ChartControl.ChartCustomControl.ChartType), DdlChartType.SelectedValue), ChartControl.ChartCustomControl.ChartType) End Sub Protected Sub ChkFlash_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ChkFlash.CheckedChanged ChartCustomControl1.UseFlash = ChkFlash.Checked End Sub End Class