Hi Xiaolong,
The problem is that you need to store the composed data point - for example:
NChart chart = nChartControl1.Charts[0];
NPointSeries point = new NPointSeries();
point.Values.Add(10);
point.Values.Add(20);
point.Values.Add(30);
chart.Series.Add(point);
// using compose
for (int i = 0; i < point.Values.Count; i++)
{
NDataPoint dataPoint = point.ComposeDataPoint(i);
if (i % 2 == 0)
{
dataPoint[DataPointValue.FillStyle] = new NColorFillStyle(Color.Red);
}
else
{
dataPoint[DataPointValue.FillStyle] = new NColorFillStyle(Color.Green);
}
// store the data point after you modify it
point.StoreDataPoint(i, dataPoint);
}
nChartControl1.Refresh();
alternatively you can simply use the FillStyles/StrokeStyles collections:
NChart chart = nChartControl1.Charts[0];
NPointSeries point = new NPointSeries();
point.Values.Add(10);
point.Values.Add(20);
point.Values.Add(30);
chart.Series.Add(point);
// using collections
for (int i = 0; i < point.Values.Count; i++)
{
if (i % 2 == 0)
{
point.FillStyles[i] = new NColorFillStyle(Color.Red);
}
else
{
point.FillStyles[i] = new NColorFillStyle(Color.Green);
}
}
nChartControl1.Refresh();
Hope this helps - let us know if you meet any problems...
Best Regards,
Nevron Support Team