I am using Dundas Charts in Visual Studio using C#.
I have a chart with one series - the chart is displaying the series on columns. I am currently using the following code to add the series:
public void AddSeries(string name, SeriesChartType type, IEnumerable xValues, IEnumerable yValues, bool showLabels = true)
{
Series s = new Series();
s.Points.DataBindXY(xValues, yValues);
s.LegendText = name;
s.Type = type;
if (type == SeriesChartType.Line) s.Color = Color.FromArgb(139,0,0);
else s.Color = _palette[_chart.Series.Count < _palette.Length ? _chart.Series.Count : 0];
s.ShowLabelAsValue = showLabels;
s.FontAngle = -90;
s.LabelFormat = string.IsNullOrWhiteSpace(_chart.ChartAreas["Default"].AxisY.LabelStyle.Format) ? "P0" : _chart.ChartAreas["Default"].AxisY.LabelStyle.Format;
s.Font = new Font("Arial", 5);
_chart.Series.Add(s);
}
I would like to change the colour of each column depending on the value for that column - this will be based on a int target value. For example, if the column is less than our target value, it should display red, else it should display green.
How would you recommend doing this?