当前位置:   article > 正文

c# wpf LiveCharts 简单试验

c# wpf LiveCharts 简单试验

1.概要

1.1 说明

1.2 环境准备

NuGet 添加插件安装

 

2.代码

  1. <Window x:Class="WpfApp3.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
  7. xmlns:local="clr-namespace:WpfApp3"
  8. mc:Ignorable="d"
  9. Title="MainWindow" Height="450" Width="800">
  10. <Grid>
  11. <lvc:CartesianChart LegendLocation="Bottom" >
  12. <lvc:CartesianChart.Series>
  13. <lvc:LineSeries Fill="LightGreen" Stroke="Green"
  14. Values="12,34,55,40,30,54,26" Title="消费" DataLabels="True"/>
  15. </lvc:CartesianChart.Series>
  16. </lvc:CartesianChart>
  17. </Grid>
  18. </Window>

 

  1. using System.Text;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Data;
  5. using System.Windows.Documents;
  6. using System.Windows.Input;
  7. using System.Windows.Media;
  8. using System.Windows.Media.Imaging;
  9. using System.Windows.Navigation;
  10. using System.Windows.Shapes;
  11. using LiveCharts;
  12. using LiveCharts.Wpf;
  13. namespace WpfApp3
  14. {
  15. /// <summary>
  16. /// Interaction logic for MainWindow.xaml
  17. /// </summary>
  18. public partial class MainWindow : Window
  19. {
  20. public MainWindow()
  21. {
  22. InitializeComponent();
  23. }
  24. }
  25. }

3.运行效果

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/382486
推荐阅读
相关标签
  

闽ICP备14008679号