Chart usage of ASP. NET Data Control

Source: Internet
Author: User

Add one more mouth:
If you want to remove the button from the website, you can use HiddenField to store the Uri, which can be encrypted, or you can obtain the URL through this. Request. UrlReferrer. Note that the returned value of this. Request. UrlReferrer is URI type.
 
 
Directly run the Code:
Front-end page writing
1 <asp: Chart ID = "ChartPie" runat = "server" Width = "950px" BackColor = "# FFFFCC" Palette = "BrightPastel"
2 BorderWidth = "0" BorderColor = "# cc9900">
3 <Annotations> </Annotations>
4 <Legends>
5 <asp: Legend IsTextAutoFit = "False" Name = "Default" BackColor = "Transparent" Font = "Trebuchet MS, 8.25pt, style = Bold">
6 </asp: Legend>
7 </Legends>
8 <ChartAreas>
9 <asp: ChartArea Name = "ChartArea1">
10 </asp: ChartArea>
11 </ChartAreas>
12 </asp: Chart>

Background: The table structure is as follows:
Table structure required by the background
1 table = new DataTable ();
2 table. Columns. AddRange (new DataColumn [] {
3 new DataColumn ("url", typeof (String )),
4 new DataColumn ("liulan", typeof (Int32 )),
5 new DataColumn ("duli", typeof (Int32 )),
6 new DataColumn ("dacpno", typeof (Int32 ))
7 });

The Bind method is as follows:
Bind the background
1 Series seriesPies = new Series ("Domain Name Statistics ");
2 this. ChartPie. Series. Add (seriesPies );
3 this. ChartPie. ChartAreas [0]. Area3DStyle. Enable3D = true;
4 seriesPies. ChartType = SeriesChartType. Pie;
5 seriesPies. BorderWidth = 3;
6 seriesPies. ShadowOffset = 2;
7 Title tPie = new Title ("Statistical pie chart of interviewed domain names", Docking. Top, new Font (FontFamily. GenericSerif, 16, FontStyle. Bold), Color. Brown );
8 tPie. ShadowColor = Color. Gray;
9 tPie. ShadowOffset = 2;
10 this. ChartPie. Titles. Add (tPie );
11
12 for (int I = 0; I <this. table. Rows. Count; I ++)
13 {
14 object count = this. table. Rows [I] ["liulan"];
15 seriesPies. CustomProperties = "PieLabelStyle = Outside"; // connect the graphic area of the pie chart with the graphic text.
16 seriesPies. Points. AddXY (string. Concat (this. table. Rows [I] ["url"], "(", count, ")"), count );
17

 

From the world

Related Article

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.