DataTable +chart Control

Source: Internet
Author: User

It's a DataTable of your own.

-----start---------

DataTable dataTable1 = new System.Data.DataTable ();

DATATABLE1.COLUMNS.ADD ("Net", typeof (String));

DATATABLE1.COLUMNS.ADD ("Date", typeof (DateTime));

DATATABLE1.COLUMNS.ADD ("Day Development", typeof (Double));

DataTable dataTable2 = Datatable1.clone ();

DataTable dataTable3 = Datatable1.clone ();

DATATABLE1.ROWS.ADD ("Net 1", New DateTime (2014, 1, 1), 12.0);

DATATABLE1.ROWS.ADD ("Net One", New DateTime (2014, 2, 1), 14.0);

DATATABLE2.ROWS.ADD ("Net 2", New DateTime (2014, 1, 1), 5.0);

DATATABLE2.ROWS.ADD ("Net 2", New DateTime (2014, 2, 1), 10.0);

DATATABLE3.ROWS.ADD ("NET 3", New DateTime (2014, 1, 1), 7.0);

DATATABLE3.ROWS.ADD ("Net", New DateTime (2014, 2, 1), 18.0);

---------End-------------

Chart1. Series.clear ();//Clears data from the table

Data in the first table

Series Datatable1series = new series ("DataTable1");

DataTable1Series.Points.DataBind (Datatable1.asenumerable (), "date", "Day development", "" ");

Datatable1series.xvaluetype = Chartvaluetype.datetime; Set X axis type to TIME

Datatable1series.charttype = Seriescharttype.line; Set the y-axis to be a polyline

Chart1. Series.add (datatable1series);

Data in the second table

Series Datatable2series = new series ("DataTable2");

DataTable2Series.Points.DataBind (Datatable2.asenumerable (), "date", "Day development", "" ");

Datatable2series.xvaluetype = chartvaluetype.datetime;//Set X-axis type to TIME

Datatable2series.charttype = Seriescharttype.line; Set the y-axis to be a polyline

Chart1. Series.add (datatable2series);

Data in the third table

Series Datatable3series = new series ("DataTable3");

DataTable3Series.Points.DataBind (Datatable3.asenumerable (), "date", "Day development", "" ");

Datatable3series.xvaluetype = chartvaluetype.datetime;//Set X-axis type to TIME

Datatable3series.charttype = Seriescharttype.line; Set the y-axis to be a polyline

Chart1. Series.add (datatable3series);

DataTable +chart Control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.