I'm new to Teechart, and I'm just wondering what is the best method to bind data from a SQL query to Webchart. What I did was to first insert a Dataset and added a connection string to the Dataset. Then to plot the data out, my code for the *.aspx.cs file is as follows:
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
DataSet1TableAdapters.TRADINGPRICETableAdapter adaptor = new DataSet1TableAdapters.TRADINGPRICETableAdapter();
DataSet1.TRADINGPRICEDataTable table = adaptor.GetData();
DataView view = table.DefaultView;
Steema.TeeChart.Chart Chart2 = WebChart1.Chart;
Chart2.Aspect.View3D = false;
Steema.TeeChart.Styles.Line series1 = new Steema.TeeChart.Styles.Line(Chart2);
series1.DataSource = view;
series1.XValues.DataMember = "date";
series1.YValues.DataMember = "price";
}