Use of ultrachart (II): Off-the-shelf data

Source: Internet
Author: User

PreviousArticle(Use of ultrachart (1): extract data from the database). In fact, using ultrachart involves two points: one is column and the other is row. After providing the data, the chart automatically draws the graph and extracts the data from the database. The rows and columns are all done well, so you only need to modify the data you need. The off-the-shelf data requires you to fill in rows and columns by yourself. Sometimes your data may be extracted from the grid. You only need to modify the data according to the following content.

Private   Void Chart ()
{

Object [] Data1 =   New   Object []
{
New   Object [] { 10 , 15 , 30 , 10 },
New   Object [] { 20 , 50 , 20 , 5 },
New   Object [] { 45 , 25 , 05 , 20 },
New   Object [] { 35 , 10 , 40 , 30 },

};


Datatable table= NewDatatable ();

Table. Columns. Add ( " A " , Typeof ( Double ));
Table. Columns. Add ( " B " , Typeof ( Double ));
Table. Columns. Add ( " C " , Typeof ( Double ));
Table. Columns. Add ( " D " , Typeof ( Double ));

For ( Int I =   0 ; I < Data1.length; I ++ )
{
Datarow row = Table. newrow ();
Row. itemarray = ( Object []) Data1 [I];
Table. Rows. Add (ROW );
}

This . Ultrachart1.data. datasource = Table;
This . Ultrachart1.data. databind ();
This . Ultrachart1.charttype = Infragistics. ultrachart. Shared. Styles. charttype. columnchart;
This . Ultrachart1.titletop. Text =   " Text " ;
}

I will not map any more. This is the combination of four groups of data. If you want to name each group of data, you can modify it in the object.

  New   Object [] { " Data1 " , 10 , 15 , 30 , 10 },

If you only want to display a group of data with a line, it is simpler. You only need to delete all the other rows in the object array. Then you can set charttype to linechart.

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.