Create a array of Colors and use that to get unique color for the series fillStyle.
Follow this approach, it is in C# but help you.
// color array example
Color[] PreDefinedSeriesColors = {
Color.Red, Color.Green, Color.Blue, Color.Brown, Color.BlueViolet,
Color.Crimson, Color.Cyan, Color.DarkRed
};
//Create Series and set fillStyle
int indexOfSeries;
NBarSeries bar = new NBarSeries();
chart.Series.Add(bar);
indexOfSeries = chart.Series.IndexOf(bar);
chartSeries.FillStyle = GetUniqueSeriesColor(indexOfSeries);
///
/// Get the unique color for the series
/// ///
Added Series index in chart.Series[index]
///
Unique Series Colorprivate Color CheckAndGetUniqueSeriesColor(int currentChartSeriesIndex)
{
NCartesianChart chart = chartControl.Charts[0] as NCartesianChart;
Color seriesColor = PreDefinedSeriesColors[currentChartSeriesIndex];
List
usedColors = new List();
if (currentChartSeriesIndex > 0)
{
for (int i = 0; i <= currentChartSeriesIndex - 1; i++)
{
usedColors.Add((chart.Series[i] as NSeries).FillStyle.GetPrimaryColor().ToColor().Name);
}
for (int i = 0; i <= currentChartSeriesIndex - 1; i++)
{
Color x = (chart.Series[i] as NSeries).FillStyle.GetPrimaryColor().ToColor();
Color y = NColor.FromString(PreDefinedSeriesColors[i].Name).ToColor();
if ( x != y && !usedColors.Exists( color => color.Equals(y.Name)))
{
seriesColor = PreDefinedSeriesColors[i];
break;
}
}
}
return seriesColor;
}