1. Because the project (sliverlight project) uses graphics to display real-time or historical data
Therefore, I have obtained some information from the Internet, and two controls are suitable
1. sliverlight Tool Kit
2. visifire
I prefer the visifire style, so I chose this one.
2. Test Results
Figure 1
Figure 2
Figure 3
3 code
1. XAML code
Code
<UserControl xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" x:Class="YYKJ.ZHGIS.WEB.UserControls.TestChart"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="500" Height="400">
<Grid x:Name="LayoutRoot">
<Canvas x:Name="mainCV" Canvas.Top="100" Margin="0,50,0,0"></Canvas>
<StackPanel x:Name="spCover" Width="100" Height="25" HorizontalAlignment="Right" Margin="0,50,0,0" VerticalAlignment="Top" Background="Black" Visibility="Collapsed"/>
</Grid>
</UserControl>
Maincv is used to place images.
Spcover is used to block the visifire watermark (not uploaded)
2. C # code
Code
Public void createchart (observablecollection <etpivalue> OC)
{
Chart chart = new chart ();
// Set theme1 theme2 theme3 for the topic.
Chart. theme = "theme3 ";
// 3D display or not
Chart. view3d = true;
// Width
Charts. width = 500;
// High
Chart. Height = 300;
// Graphic title
Title = new title ();
Title. Text = "test image ";
Chart. Titles. Add (title );
// The image type renderas is an enumeration type. There are many types of images, such as a bar chart or pie chart.
Dataseries = new dataseries ();
Dataseries. renderas = renderas. stackedarea;
Datapoint;
For (INT I = 0; I <OC. Count; I ++)
{
Datapoint = new datapoint ();
// Y-axis data
Datapoint. yvalue = convert. todouble (oc [I]. tagvalue );
// X axis name
Datapoint. axisxlabel = OC [I]. subname;
// Solidcolorbrush SC = new solidcolorbrush ();
// SC. Color = new color {B = 0, G = 0, r = 255, A = 255 };
// Datapoint. Color = SC;
// Datapoint. tooltiptext = "1111 ";
Dataseries. datapoints. Add (datapoint );
}
Chart. Series. Add (dataseries );
Maincv. Children. Add (Chart );
// The mask layer is used to retrieve the watermark.
Spcover. Visibility = visibility. visible;
}
The basic usage has been written in the comments and will not be explained.
Correction: The mask layer is used to block the watermark, and the error code is entered...
4. Reference The visifire DLL before using it, and then reference two namespaces in the code.
5. Let's share some graphical controls.