using MECF.Framework.UI.Client.CenterViews.Core.Charting;
using SciChart.Charting.Visuals.RenderableSeries;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Media;
using SciChart.Data.Numerics;

namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
{
    public class RenderableSeriesProvide : ObservableCollection<IRenderableSeries>
    {
       
        public RenderableSeriesProvide() { }

        /// <summary>
        /// 返回Chatring曲线对象
        /// </summary>
        /// <returns></returns>
        public IRenderableSeries GetLineSeries(string lineName)
        {
            Clear();
            SicFastLineSeries sicFastLineSeries = new SicFastLineSeries(lineName)
            {
                Stroke = Colors.Red,
                AntiAliasing = true,
                ResamplingMode = ResamplingMode.MinMax,
            };

            Add(sicFastLineSeries);

            this.ToList().ForEach(x =>
            {
                x.DataSeries.Clear();
                ((SicFastLineSeries)x)?.BackendParameterNode?.ClearStatistic();
            });

            return sicFastLineSeries;
        }
    }
}
