其他分享
首页 > 其他分享> > LiveCharts笔记

LiveCharts笔记

作者:互联网

.NET做数据可视化可以利用LiveCharts。LiveCharts开源、易用,NuGet上安装LiveCharts、LiveCharts.Wpf/WinForms、LiveCharts.Geared(加速包)。工具箱右键选择项,浏览打开LiveCharts.Wpf/WinForms.dll。

 

1 <Wpf:CartesianChart Name="myChart" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="400" Width="700" LegendLocation="Right">
2  <Wpf:CartesianChart.AxisX>
3    <Wpf:Axis Name="myAxisX"></Wpf:Axis>
4  </Wpf:CartesianChart.AxisX>
5  <Wpf:CartesianChart.AxisY>
6    <Wpf:Axis Name="myAxisY"></Wpf:Axis>
7  </Wpf:CartesianChart.AxisY>
8 </Wpf:CartesianChart>

 

 1 myChart.Series = new SeriesCollection
 2             {
 3                 new ColumnSeries
 4                 {
 5                     Values = new ChartValues<double>() { 0.11, 0.62, 0.93, 0.24, 0.7 },
 6                     DataLabels=true,
 7                     Title="Title1"
 8                 },
 9                 new ColumnSeries
10                 {
11                     Values = new ChartValues<double>() { 0, 0, 0.6, 0.85, 0.99 },
12                     DataLabels=true,
13                     Title="Title2"
14                 },
15                 new ColumnSeries
16                 {
17                     Values = new ChartValues<double>() { 0.6, 0.32, 0.93, 0.34, 0.5 },
18                     DataLabels=true,
19                     Title="Title3"
20                 },
21                 new ColumnSeries
22                 {
23                     Values = new ChartValues<double>() { 0.71, 0.23, 0.93, 0.48, 0.35 },
24                     DataLabels=true,
25                     Title="Title4"
26                 }
27             };
28             myAxisX.Labels = new[] {"00:10", "00:20", "00:30", "00:40", "00:50" };
29             myAxisY.MaxValue = 1;
30             myAxisY.LabelFormatter = value => value.ToString("0%");
31             myAxisY.Title = "百分比";

 

标签:ChartValues,00,Title,ColumnSeries,笔记,new,LiveCharts
来源: https://www.cnblogs.com/ljsoftware/p/11948977.html