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.