Use Silverlight Toolkit to draw a chart (bottom)-Pie, line chart, scatter chart

Source: Internet
Author: User
Tags silverlight

In the previous article, we described how to use the chart control provided by Silverlight Toolkit to draw a columnar chart (Column,bar), which will continue today

With the code created above, we can make the histogram appear to be pie, line, or scatter with little modification.

Well, start today's text.

First, we're going to create a new "Silverlight control" of a pie chart and name it: Piesample.xaml

 

Then we copy the corresponding code from the corresponding Columnsample.xaml,columnsample.xaml.cs to: Piesample.xaml and pie-.

Sample.xaml.cs file. Then we modify the dataserviceclient_getemployeelistcompleted in the PieSample.xaml.cs file.

method, the revised results are as follows:

void Dataserviceclient_getemployeelistcompleted (object sender, Getemployeelistcompletedeventargs e)
{
observablecollection<employeeinfo> employeelist = E.result;
Action<chart> chartmodifier = (Chart) =>
{
Axis Dateaxis = new Axis {orientation = axisorientation.horizontal, title = "Employee Name", FontStyle = Fontstyles.normal, FontS ize = 12f, Showgridlines = true};
EMPLOYEECHART.AXES.ADD (Dateaxis);
Axis Valueaxis = new Axis {orientation = axisorientation.vertical, Title = "Salary", Minimum = -1000, Maximum = 3000, SHOWGR Idlines = true};
EMPLOYEECHART.AXES.ADD (Valueaxis);
};
Chartmodifier (Employeechart);
Pieseries series = new Pieseries ();
Series. ItemsSource = EmployeeList;
Series. independentvaluebinding = new System.Windows.Data.Binding ("EmployeeName");
Series. dependentvaluebinding = new System.Windows.Data.Binding ("Salary");
Series. Animationsequence = Animationsequence.lasttofirst;
EMPLOYEECHART.SERIES.ADD (Series);
}

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.