Here is my code:
- Code: Select all
for (int r = 0; r < rowCount; r++)
{
// Set color
ChartDataPoint cdp = new ChartDataPoint(chart.Series[0]);
cdp.Index = r;
cdp.Fill.FillType = FillFormatType.Solid;
cdp.InvertIfNegative = false;
if ((double)chartDataTable.Rows[r]["Change"] > 0)
{
cdp.Fill.SolidColor.R = 141;
cdp.Fill.SolidColor.G = 198;
cdp.Fill.SolidColor.B = 63;
}
else
{
cdp.Fill.SolidColor.R = 215;
cdp.Fill.SolidColor.G = 0;
cdp.Fill.SolidColor.B = 54;
}
}
However, the InvertIfNegative on the ChartDataPoint is not working. It does not appear to be written to the XML behind the chart.
I have also tried to use a template where the Invert color is specified, but that is getting overwritten and I cannot find where in the Series object to specify it.
Thanks in advance.