Ultrachart is also the latest control I have come into use. It seems quite interesting. It took me a few hours to study it. Now I can draw several diagrams. There are two forms of ultrachart data: one is to extract data from the database, and the other is to have ready-made data in the Code (the use of ultrachart (2): ready-made data ).
Extract data from the database first. Data in the code will be introduced next time.
I think the most important manifestation of ultrachart is columnchart and linechart. It is best to use linechart for a group of data and. columnchart for multiple groups of data (I personally think ). Let's start with a group of data
Private void chart ()
{
String strconn = "Server = (local);" + "Integrated Security = sspi;" + "database = test;"; DS = sqlhelper. executedataset (strconn, commandtype. text, "select count, e, f, g from Table1 where name = 'a1'"); datatable table = Ds. tables [0];
Table. Columns ["count"]. columnname = "1 ";
Table. Columns ["E"]. columnname = "2 ";
Table. Columns ["F"]. columnname = "3 ";
Table. Columns ["G"]. columnname = "4 ";
This. ultrachart1.data. datasource = table;
This. ultrachart1.data. databind (); this. ultrachart1.charttype = infragistics. ultrachart. Shared. Styles. charttype. linechart; this. ultrachart1.titletop. Text = "text ";
}
For multiple groups of data
Private void chart ()
{
String strconn = "Server = (local);" + "Integrated Security = sspi;" + "database = test;"; DS = sqlhelper. executedataset (strconn, commandtype. text, "Select name, Count, e, f, g from Table1 where id = 1"); datatable table = Ds. tables [0];
Table. Columns ["count"]. columnname = "1 ";
Table. Columns ["E"]. columnname = "2 ";
Table. Columns ["F"]. columnname = "3 ";
Table. Columns ["G"]. columnname = "4 ";
This. ultrachart1.data. datasource = table;
This. ultrachart1.data. databind (); this. ultrachart1.charttype = infragistics. ultrachart. Shared. Styles. charttype. columnchart; this. ultrachart1.titletop. Text = "text ";
}
Are there any differences in the code? The most important thing is to extract fields from the database. When the field does not match, a column is missing. Just a few more times.