Usage of ultrachart (1): extract data from the database

Source: Internet
Author: User

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.

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.