0

When MS Chart control has multiple series, a different color is assigned each series automatically and by default. If I select the charttype as fastline and add two series, blue and orange plots are seen.

Instead of colors, is it possible that each series is automatically represented by a different line type, like dashed, dot dashed, plus sign, etc.?

Siha
  • 47
  • 1
  • 7

1 Answers1

1

First I'm pretty sure that plus signs are Markers and not ChartTypes.

I know for sure that stars and diamonds are.

You could do a List and save in it all the line ChartType (ex Spline, Line, etc) and looping while binding the data

                SqlDataAdapter adapter = new SqlDataAdapter(query2, connection);
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                int i = 0;

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Series series = new Series();
                    series.Points.AddXY(dr["Date"], dr["Shipments"]);
                    series.ChartType = yourChartTypeList[i];
                    i++;
                    Chart1.Series.Add(series);
                }

(here using a DataSet)

or afterwards

                //already bound

                int i = 0;

                foreach (Series s in Chart1.Series)
                {
                    s.ChartType = yourChartTypeList[i];
                    i++;
                }

that way if you want to add something to the series, like tooltip or whatever you'll have a place to do that.