using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Charting;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.ChartView;

namespace UIDesign.Controls.Charts
{
    public class ChartsViewModel : ViewModelBase
    {
        private ChartsView View;
        public ChartsViewModel(ChartsView view)
        {
            this.View = view;
            LoadItemsSource1();
            
        }

        #region Properties
        private ObservableCollection<Item1> _ItemsSource1 = new ObservableCollection<Item1>();
        public ObservableCollection<Item1> ItemsSource1
        {
            get => _ItemsSource1;
            set
            {
                _ItemsSource1 = value;
                OnPropertyChanged(() => ItemsSource1);
            }
        }
        #endregion

        #region 加载图表
        private void LoadItemsSource1()
        {
            var lst = new List<Item1>()
            {
                new Item1 { XCat = "CatA", YVal1 = 7, YVal2 = 4, YVal3 = 0.25, },
                new Item1 { XCat = "CatB", YVal1 = 6, YVal2 = 2, YVal3 = 0.43, },
                new Item1 { XCat = "CatC", YVal1 = 7, YVal2 = 5, YVal3 = 0.35, },
                new Item1 { XCat = "CatD", YVal1 = 6, YVal2 = 3, YVal3 = 0.65, },
                new Item1 { XCat = "CatE", YVal1 = 4, YVal2 = 3, YVal3 = 0.35, },
            };
            var item1s = new ObservableCollection<Item1>(lst);
            ItemsSource1 = item1s;
        }
        #endregion

        #region Classes
        public class Item1
        {
            public string XCat { get; set; }
            public double YVal1 { get; set; }
            public double YVal2 { get; set; }
            public double YVal3 { get; set; }
        }
        #endregion

        
    }
}
