Hi Miranda,
The shared sample works fine at our end and we are not facing any build errors. However, we have modified the ClientReportsController class file to achieve your requirement and the file can be downloaded from the following link.
In that file, we have added the FillSeriesColor method and invoked it at the end of chart creation to set the chart series color based on values.
Code Snippet:
private void FillSeriesColor(IChart chart)
{
foreach (IChartSerie serie in chart.Series)
{
int dataPointCount = (serie.EnteredDirectlyValues == null) ? serie.Values.Rows.Length : serie.EnteredDirectlyValues.Length;
for (int dataPointPos = 0; dataPointPos < dataPointCount; dataPointPos++)
{
IChartDataPoint dataPoints = serie.DataPoints[dataPointPos];
double value;
if (serie.EnteredDirectlyValues == null)
value = serie.Values.Rows[dataPointPos].Number;
else
value = (double)serie.EnteredDirectlyValues.GetValue(dataPointPos);
if (value < 1)
dataPoints.DataFormat.Fill.ForeColor = Color.Red;
else if (value >= 1 && value < 2)
dataPoints.DataFormat.Fill.ForeColor = Color.Orange;
else if (value >= 2 && value < 3)
dataPoints.DataFormat.Fill.ForeColor = Color.Yellow;
else if (value >= 3 && value < 4)
dataPoints.DataFormat.Fill.ForeColor = Color.FromArgb(153, 255, 204);
else if (value >= 4 && value <= 5)
dataPoints.DataFormat.Fill.ForeColor = Color.Green;
}
}
}
Kindly refer this and let us know if this helps.
Regards,
Mohan Chandran.