• LiveCharts文档-4基本绘图-1基本线条图


    4基本绘图-1基本线条图

    using System;
    using System.Windows.Forms;
    using System.Windows.Media;
    using LiveCharts;
    using LiveCharts.Wpf;
    namespace Winforms.Cartesian.BasicLine
    {
        public partial class BasicLineExample : Form
        {
            public BasicLineExample()
            {
                InitializeComponent();
                cartesianChart1.Series = new SeriesCollection
                {
                    new LineSeries
                    {
                        Title = "Series 1",
                        Values = new ChartValues<double> {4, 6, 5, 2, 7}
                    },
                    new LineSeries
                    {
                        Title = "Series 2",
                        Values = new ChartValues<double> {6, 7, 3, 4, 6},
                        PointGeometry = null
                    },
                    new LineSeries
                    {
                        Title = "Series 2",
                        Values = new ChartValues<double> {5, 2, 8, 3},
                        PointGeometry = DefaultGeometries.Square,
                        PointGeometrySize = 15
                    }
                };
                cartesianChart1.AxisX.Add(new Axis
                {
                    Title = "Month",
                    Labels = new[] {"Jan", "Feb", "Mar", "Apr", "May"}
                });
                cartesianChart1.AxisY.Add(new Axis
                {
                    Title = "Sales",
                    LabelFormatter = value => value.ToString("C")
                });
                cartesianChart1.LegendLocation = LegendLocation.Right;
                //更改数据集合会触发动画并更新图表
                cartesianChart1.Series.Add(new LineSeries
                {
                    Values = new ChartValues<double> { 5, 3, 2, 4, 5 },
                    LineSmoothness = 0, //直线, 1 表示平滑曲线
                    PointGeometry = Geometry.Parse("m 25 70.36218 20 -28 -20 22 -8 -6 z"),
                    PointGeometrySize = 50,
                    PointForeground = Brushes.Gray
                });
               //更改任何series都会触发动画并更新图表
                cartesianChart1.Series[2].Values.Add(5d);
                cartesianChart1.DataClick += CartesianChart1OnDataClick;
            }
            private void CartesianChart1OnDataClick(object sender, ChartPoint chartPoint)
            {
                MessageBox.Show("You clicked (" + chartPoint.X + "," + chartPoint.Y + ")");
            }
        }
    }
    
  • 相关阅读:
    条形码识别
    使用边缘检测,将图像旋转到水平位置
    pyzbar 安装
    关于跑别人代码中遇到的问题
    %matplotlib inline
    git 相关流程和报错解决
    原码、反码和补码
    opencv 图像resize
    前端跨域解决方案汇总
    vuecli3 引入构建版本的2种方式
  • 原文地址:https://www.cnblogs.com/newlifechou/p/8889105.html
Copyright © 2020-2023  润新知