Implement awesome charts in Silverlight 2

Source: Internet
Author: User
Introduction

Silverlight has provided powerful support for image processing since the 1.0 era. Therefore, we can implement various statistical charts in Silverlight, however, there are some open-source projects that make this work easier.

In this article, I will introduce an open-source project visifire, which can be used to implement cool charts in Silverlight 2.

Simple chart

First, we need to download the Visifire project Silverlight Development Kit. After creating the project, add reference to the Visifire. Charts. dll and Visifire. Commons. dll assembly and add the namespace:

Create a chart. Here, LayoutRoot is the control where we place the chart. It can make controls such as Grid, StackPanel, and Canvas.

Add data. Here, we randomly create six groups of data for the sake of simplicity. Note that we need to add the DataPoint data to the Children attribute of the DataSeries object instead of the DataPoints attribute:

Add a chart to the container:

The complete code is as follows:

After running, you can see the effect as shown in:

When you place the cursor over the chart, the specific value is displayed:

Watermark Removal

We noticed that the "Powered by Visifire" watermark effect was added in the upper-right corner of the image. Fortunately, Visifire provided us with an attribute to hide the watermark effect:

After running, you can see that the watermark effect is hidden:

3D Effects

In addition, you can also set 3D charts based on View3D attributes, as shown in the following code:

Shows the effect after running:

Set Theme

In Visifire, we can also set Theme for the chart, which has three built-in Themes. Their default animation types and color sets are shown in the following table:

The following code sets Theme:

Shows the effect after running:

Set the animation type

Visifire can also specify the animation type when the icon is loaded. The five built-in animation types are described as follows:

Set the animation type:

In this way, different animations can be displayed when a chart is loaded. The Visifire project code needs to be further improved. Many Theme and AnimationType items are represented by strings instead of enumeration.

Set color sets

Visifire has many built-in icon color sets. We can set the color for the final generated chart, as shown in the following code:

The final chart effect is shown in:

Set chart type

Visifire has various built-in chart types, including bar charts and pie charts. It provides the ChartTypes enumeration:

However, this enumeration does not seem to be useful. You still need to use the corresponding enumerated string during the configuration, and the Chart type setting is actually a DataSeries object, rather than a Chart object, as shown in the following code:

Shows the effect after running:

 

For more information about Visifire, see related documents.

Related Resources

Download the Visifire Project Development Kit

Source code: http://code.google.com/p/visifire/

SVN address:http://visifire.googlecode.com/svn/trunk

Online Documentation: http://www.visifire.com/visifire_charts_documentation.php

Summary

This article briefly introduces how to use the Visifire project to implement graphical reports in Silverlight 2, hoping to help you.

Download example:

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.