C # Draw pie chart with a chart control from. Net

Source: Internet
Author: User

The goals to be achieved are:

1. Bind data to PIE's background data to automatically generate pie charts.

2. The resulting pie chart has a detailed description of the text.

The specific implementation steps:

>> Front-desk interface settings:

1. Set the Chart1 property legends the default Legend1 in the Enable to false;

2. Set the ChartType of the series to Pie

3. Set the text content of the series display (key here)

At this point, the setup of the foreground is complete.

>> below to fill in the background code:

list<String> XData =New list<String> () {"A","B","C","D"}; list<Int> Ydata =New list<Int> () {10,20,30, 40};chart1. Series[0][ Pielabelstyle "] = "  Outside0][ Pielinecolor "] = "  Black draw black lines. Chart1. Series[0]. POINTS.DATABINDXY (XData, ydata);             

Background code primarily implements data binding and moves the indicated text to the outside of the pie chart.

The final is as follows.

Resources can be seen here: Http://stackoverflow.com/questions/8403866/values-in-a-pie-chart

C # Draw pie chart with a chart control from. Net

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.