基本信息
源码名称:C#使用oxyplot绘制曲线图
源码大小:0.63M
文件格式:.rar
开发语言:C#
更新时间:2022-10-05
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

C#使用oxyplot绘制曲线图

public class DataInfo
    {
        public double Time { get; set; }
        public double Value { get; set; }
        public DataInfo(double time, double value)
        {
            Time = time;
            Value = value;
        }
    }


    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public List<DataInfo> mListDataInfo1 { get; private set; } = new List<DataInfo>();
        public List<DataInfo> mListDataInfo2 { get; private set; } = new List<DataInfo>();
        Timer timer5 = new Timer();
        public MainWindow()
        {
            InitializeComponent();
            timer5.Interval = 200;
            timer5.Elapsed = Timer5_Elapsed;
            timer5.Start();
           
        }

        int timerCnt = 0;
        DateTime dateTime = DateTime.Today.Add(TimeSpan.FromHours(9));
        private void Timer5_Elapsed(object sender, ElapsedEventArgs e)
        {

            timerCnt ;
            Dispatcher.Invoke(new Action(() =>
            {
                DateTime dateTime = DateTime.Now;
                mListDataInfo1.Add(new DataInfo(timerCnt, 45*Math.Sin(Math.PI*(timerCnt/10f))));
                mListDataInfo2.Add(new DataInfo(timerCnt, 10));
                //dateTime = dateTime.AddMinutes(1);
                myLineSeries.DataContext = this;
                //myLineSeries2.DataContext =this;
                if (mListDataInfo1.Count > 200)
                {

                    mListDataInfo1.RemoveRange(0,150);
                }
                myPlot.InvalidatePlot(true);
                

            }), null);
        }
    }