public void Add(DataSeries ds)
 {
     dataSeriesList.Add(ds);
     if (ds.SeriesName == "")
     {
         ds.SeriesName = "DataSeries" + dataSeriesList.Count.ToString();
     }
 }
        private void AddData(Graphics g)
        {
            float x = 0f;
            float y = 0f;

            // Add Sin(x) data to sub-chart 1:
            dc1.DataSeriesList.Clear();
            DataSeries ds = new DataSeries();
            ds.LineStyle.LineColor = Color.Red;
            ds.LineStyle.Thickness = 2f;
            ds.LineStyle.Pattern = DashStyle.Dash;
            for (int i = 0; i < 50; i++)
            {
                x = i / 5.0f;
                y = (float)Math.Sin(x);
                ds.AddPoint(new PointF(x, y));
            }
            dc1.Add(ds);

            // Add Cos(x) data sub-chart 2:
            dc2.DataSeriesList.Clear();
            ds = new DataSeries();
            ds.LineStyle.LineColor = Color.Blue;
            ds.LineStyle.Thickness = 1f;
            ds.SymbolStyle.SymbolType = SymbolStyle.SymbolTypeEnum.OpenDiamond;
            for (int i = 0; i < 50; i++)
            {
                x = i / 5.0f;
                y = (float)Math.Cos(x);
                ds.AddPoint(new PointF(x, y));
            }
            dc2.Add(ds);

            // Add Sin(x)^2 data to sub-chart 3:
            dc3.DataSeriesList.Clear();
            ds = new DataSeries();
            ds.LineStyle.IsVisible = false;
            ds.SymbolStyle.SymbolType = SymbolStyle.SymbolTypeEnum.Dot;
            ds.SymbolStyle.FillColor = Color.Yellow;
            ds.SymbolStyle.BorderColor = Color.DarkCyan;
            for (int i = 0; i < 50; i++)
            {
                x = i / 5.0f;
                y = (float)Math.Sin(x);
                ds.AddPoint(new PointF(x, y * y));
            }
            dc3.Add(ds);

            // Add y1 and y2 data to sub-chart 4:
            dc4.DataSeriesList.Clear();
            // Add y1 data:
            ds = new DataSeries();
            ds.LineStyle.LineColor = Color.Red;
            ds.LineStyle.Thickness = 2f;
            ds.LineStyle.Pattern = DashStyle.Dash;
            ds.SeriesName = "x1*cos(x1)";
            for (int i = 0; i < 20; i++)
            {
                float x1 = 1.0f * i;
                float y1 = x1 * (float)Math.Cos(x1);
                ds.AddPoint(new PointF(x1, y1));
            }
            dc4.Add(ds);
            // Add y2 data:
            ds = new DataSeries();
            ds.LineStyle.LineColor = Color.Blue;
            ds.LineStyle.Thickness = 2f;
            ds.SeriesName = "100 + 20*x2";
            ds.IsY2Data = true;
            for (int i = 5; i < 30; i++)
            {
                float x2 = 1.0f * i;
                float y2 = 100.0f + 20.0f * x2;
                ds.AddPoint(new PointF(x2, y2));
            }
            dc4.Add(ds);
        }
 public void Insert(int dataSeriesIndex, DataSeries ds)
 {
     dataSeriesList.Insert(dataSeriesIndex, ds);
     if (ds.SeriesName == "")
     {
         dataSeriesIndex = dataSeriesIndex + 1;
         ds.SeriesName = "DataSeries" + dataSeriesIndex.ToString();
     }
 }
        private void AddData(Graphics g)
        {
            float x = 0f;
            float y = 0f;

            // Add Sin(x) data to sub-chart 1:
            dc1.DataSeriesList.Clear();
            DataSeries ds = new DataSeries();

            ds.LineStyle.LineColor = Color.Red;
            ds.LineStyle.Thickness = 2f;
            ds.LineStyle.Pattern   = DashStyle.Dash;
            for (int i = 0; i < 50; i++)
            {
                x = i / 5.0f;
                y = (float)Math.Sin(x);
                ds.AddPoint(new PointF(x, y));
            }
            dc1.Add(ds);

            // Add Cos(x) data sub-chart 2:
            dc2.DataSeriesList.Clear();
            ds = new DataSeries();
            ds.LineStyle.LineColor    = Color.Blue;
            ds.LineStyle.Thickness    = 1f;
            ds.SymbolStyle.SymbolType = SymbolStyle.SymbolTypeEnum.OpenDiamond;
            for (int i = 0; i < 50; i++)
            {
                x = i / 5.0f;
                y = (float)Math.Cos(x);
                ds.AddPoint(new PointF(x, y));
            }
            dc2.Add(ds);

            // Add Sin(x)^2 data to sub-chart 3:
            dc3.DataSeriesList.Clear();
            ds = new DataSeries();
            ds.LineStyle.IsVisible     = false;
            ds.SymbolStyle.SymbolType  = SymbolStyle.SymbolTypeEnum.Dot;
            ds.SymbolStyle.FillColor   = Color.Yellow;
            ds.SymbolStyle.BorderColor = Color.DarkCyan;
            for (int i = 0; i < 50; i++)
            {
                x = i / 5.0f;
                y = (float)Math.Sin(x);
                ds.AddPoint(new PointF(x, y * y));
            }
            dc3.Add(ds);

            // Add y1 and y2 data to sub-chart 4:
            dc4.DataSeriesList.Clear();
            // Add y1 data:
            ds = new DataSeries();
            ds.LineStyle.LineColor = Color.Red;
            ds.LineStyle.Thickness = 2f;
            ds.LineStyle.Pattern   = DashStyle.Dash;
            ds.SeriesName          = "x1*cos(x1)";
            for (int i = 0; i < 20; i++)
            {
                float x1 = 1.0f * i;
                float y1 = x1 * (float)Math.Cos(x1);
                ds.AddPoint(new PointF(x1, y1));
            }
            dc4.Add(ds);
            // Add y2 data:
            ds = new DataSeries();
            ds.LineStyle.LineColor = Color.Blue;
            ds.LineStyle.Thickness = 2f;
            ds.SeriesName          = "100 + 20*x2";
            ds.IsY2Data            = true;
            for (int i = 5; i < 30; i++)
            {
                float x2 = 1.0f * i;
                float y2 = 100.0f + 20.0f * x2;
                ds.AddPoint(new PointF(x2, y2));
            }
            dc4.Add(ds);
        }