using mseedChart.Main.Models;
using Prism.Regions;
using ScottPlot;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Input;
using System.Windows.Shapes;

namespace mseedChart.Main.ViewModels
{
    public class ChartPlotViewModel
    {
        public Action<List<LineDatas>> InializeChartPlotChange;
        public Action<List<double[]>> PlotLineDataChanged;
        public ChartPlotViewModel()         
        {
        }

        public void PlotDataDemo()
        {
            // 生成 10天数据
            int pointCount = 10000;
            double[] days = new double[pointCount];
            DateTime day1 = new DateTime(1890, 09, 24);
            for (int i = 0; i < days.Length; i++)
                days[i] = day1.AddDays(i).ToOADate();
            List<LineDatas> lines = new List<LineDatas>();
            Random random = new Random(10);
            for (int i = 0; i < 3; i++)
            {
                lines.Add(new LineDatas
                {
                    Lable = "line" + i,
                    SmoothTension = 1.0f,
                    YData = DataGen.RandomWalk(random, pointCount, 100),
                    XData = days
                }); ;
            }
            InializeChartPlotChange?.Invoke(lines);
        }

    }
}
