winforms - C# change color in chart -
I have a chart in C # where I binary values to it. I have two different arrays with the values and do them in a chart. Now I wanted to display a part of the chart in a different color (with values of the first array) How to do this? Two chart drawing causes errors, so I wanted to do it this way, here is a part of the code:
string [] x_axis = _temp_date1.Concat (_date) .oere (); Double [] y_axis = _temp_data.Concat (_value). ToArray (); Chart 1 Series ["chart"]. Points. Databank xw (x_axis, y_axis); Chart 1 Series ["chart"]. Type Chart Type = Series Chart. Spline; Chart 1 Series ["chart"]. Number [0]. Color = system Drawing Collar Red; Chart 1 Series ["chart"]. Issue 1]. Color = system Drawing Colour. Green; The color part does not work.
So I can say that I have two arrays for the x value (date 1 and date 2) and there are two arrays for y. Value (Data 1 and Data2), I now merge date 1 and date 2 array, and I merge the data 1 and data array 2. I bind them on my graph. Now I would like to display part of the graph in a different color, where the date 1 / data 1 array will be my values. The array length can change because the data is read from a CSV file.
Here is an example that shows both: two different codecs In charts and two series in the same charts . Choose what you want:
// Before starting the startup, we chart1.ChartAreas.Clear (); Chart1.Series.Clear (); 1/1 of the two areas below the chart ChartAreas.Add ("area1"); Chart1.ChartAreas.Add ("area2"); // three series chart1.Series.Add ("series1"); Chart1.Series.Add ("SERIES2"); Chart1.Series.Add ("SERIES3"); // We offer two series for lower field chart1.Series ["series1"]. ChartArea = "area1"; Chart 1 Series ["Series 2"] Chart array = "area 2"; Chart 1 Series ["Series 3"] Chart array = "area 2"; // The line chart of all series types is 1. Series ["Series 1"] Chart Type = Series Chart Spline; Chart 1 Series ["Series 2"] Chart Type = Series Chart Spline; Chart 1 Series ["Series 3"] Chart Type = Series Chart Spline; // each bear color chart is 1. Series ["Series 1"] Color = color Chart 1 Series ["Series 2"] Color = color Blue; Chart 1 Series ["Series 3"] Color = color Green; // Now we add a few point charts 1. Series ["Series 1"] Points: ADXI (1, 100); Chart 1 Series ["Series 1"] Points: ADXI (2, 400); Chart 1 Series ["Series 1"] Points: ADXI (3, 200); Chart 1 Series ["Series 1"] Points: ADXI (4, 300); Chart 1 Series ["series 2"] Points: ADXI (1, 120); Chart 1 Series ["series 2"] Points ADXI (2, 420); Chart 1 Series ["series 2"] Points; ADXI (3, 290); Chart 1 Series ["Series 2"] No. ADXI (4, 390); Chart 1 Series ["Series 3"] Points: ADXI (1, 220); Chart 1 Series ["Series 3"] Points: ADXI (2, 320); Chart 1 Series ["Series 3"] Points; ADXI (3, 690); Chart 1 Series ["Series 3"] No. ADXI (4, 190); // We can also paint a part of the spin curve in a different color // Be precise: part of the point: chart 1 Series ["Series 3"] Issue 1]. Color = color HotPink; Chart 1 Series ["Series 3"] Fig. 2]. Color = color Orange; Here is the result:
Now if you want to change the color of the number after a certain digit number, then you can do this:
int start = x_axis length; For (int i = start; i & lt; chart1.Series [0] number digits; i ++) chart 1. Series [0] .points [ii]. Color = color Green; Note that you must set the color of the each dot, which will be a different color than the default chart color!
Comments
Post a Comment