using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using C1.Win.Chart;
using System.Drawing.Drawing2D;

namespace FlexChartExplorer.Samples
{
    public partial class PlotAreas : UserControl
    {
        public PlotAreas()
        {
            InitializeComponent();
            InitializeControls();

            SetupChart();
        }

        void SetupChart()
        {
            flexChart1.BeginUpdate();

            flexChart1.DataSource = DataCreator.CreateForPlotAreas();
            flexChart1.BindingX = "Time";

            flexChart1.PlotAreas.Add(new PlotArea { Name = "plot1", Row = 0 });
            flexChart1.PlotAreas.Add(new PlotArea { Name = "spacing1", Row = 1 });
            flexChart1.PlotAreas.Add(new PlotArea { Name = "plot2", Row = 2 });
            flexChart1.PlotAreas.Add(new PlotArea { Name = "spacing2", Row = 3 });
            flexChart1.PlotAreas.Add(new PlotArea { Name = "plot3", Row = 4 });
            flexChart1.ChartType = C1.Chart.ChartType.Area;

            flexChart1.AxisY.AxisLine = true;
            flexChart1.AxisY.MajorGrid = true;
            flexChart1.AxisY.MajorTickMarks = C1.Chart.TickMark.Outside;

            flexChart1.Series.Add(new Series()
            {
                Name = "Acceleration",
                Binding = "Acceleration",

            });


            flexChart1.Series.Add(new Series()
            {
                Name = "Velocity",
                Binding = "Velocity",
                AxisY = new Axis()
                {
                    Position = C1.Chart.Position.Left,
                    MajorGrid = true,
                    PlotAreaName = "plot2"
                },

            });

            flexChart1.Series.Add(new Series()
            {
                Name = "Distance",
                Binding = "Distance",
                AxisY = new Axis()
                {
                    Position = C1.Chart.Position.Left,
                    MajorGrid = true,
                    PlotAreaName = "plot3"
                }
            });

            flexChart1.EndUpdate();
        }


        private void InitializeControls()
        {
            #region Init controls

            flexChart1 = baseSample1.flexChart1;
            baseSample1.lblTitle.Text = Localizer.GetItem("plotareas", "title");
            baseSample1.tbDescription.Rtf = Localizer.GetItem("plotareas", "description").MakeRtf();
            baseSample1.pDescription.Height = 100;
            baseSample1.pControls.Visible = false;
            #endregion
        }
    }
}
