C#-WPF-控件-LiveChart线性图表 LiveChart线性图表目录常用属性和设置实例1.下载插件2.简单实例实例1.下载插件2.简单实例注意 xmlns:lvcclr-namespace:LiveCharts.Wpf;assemblyLiveCharts.WpfMainWindow.axml Window x:ClassWpfControl_LiveCharts.MainWindow xmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:xhttp://schemas.microsoft.com/winfx/2006/xaml xmlns:dhttp://schemas.microsoft.com/expression/blend/2008 xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:localclr-namespace:WpfControl_LiveCharts xmlns:lvcclr-namespace:LiveCharts.Wpf;assemblyLiveCharts.Wpf //*注意 mc:Ignorabled TitleMainWindow Height450 Width800 Grid ShowGridLinesTrue Background#FFF3F3EF Grid.RowDefinitions RowDefinition Height1*/RowDefinition /Grid.RowDefinitions lvc:CartesianChart Grid.Row1 Margin5 Series{Binding seriesCollection} Background#FFF8FCFD //*注意 lvc:CartesianChart.AxisY lvc:Axis Title 电压 ForegroundDarkRed FontSize10/lvc:Axis /lvc:CartesianChart.AxisY lvc:CartesianChart.AxisX lvc:Axis Title时间 ForegroundDarkRed FontSize10/lvc:Axis /lvc:CartesianChart.AxisX /lvc:CartesianChart /Grid /Windownamespace WpfControl_LiveCharts { public partial class MainWindow : Window { public SeriesCollection seriesCollection { get; set; } public MainWindow() { InitializeComponent(); seriesCollection new SeriesCollection { //显示第1条数据 线性 new LineSeries { Values new ChartValuesdouble { 20, 40, 60, 30 }}, //显示第2条数据 线性 new LineSeries { Values new ChartValuesdouble { 30.3, 50.5, 70.7, 40.4 }}, //显示第3条数据 圆柱 new ColumnSeries{ Values new ChartValuesdecimal { 20, 24, 8, 28 }}, //显示第4条数据 圆柱 new ColumnSeries{ Values new ChartValuesdecimal { -50, -10, -30, -28}} }; DataContext this; } // } }效果