Nevron Forum

Stacked Bar

https://www.nevron.com/Forum/Topic2529.aspx

By John Burcher 1 - Monday, August 3, 2009

Hi,

I have a stacked bar chart with 12 bar series. I have 2 issues at this stage:-
1. When I apply a stylesheet (PredefinedStyleSheet.Bright), it only seems to have 6 colours. How do I get at least 12 predefined colours?
2. The legend looks out of space when I try attaching it.

I have included the actual chart to help.

Your urgent assistance would be most appreciated.

Thank you!
By Milen - Tuesday, August 4, 2009

Hi John,

1. Currently the predefined palettes have only six colors for the data points. We will add palettes with more colors in the future versions, but for now you'll have to the colors for the "higher" series manually.

2. There are several ways to avoid this overlapping. For example you ca set "dock top" for the title, "dock bottom" for the legend and "dock fill" for the chart. An alternative way is to simply decrease the height of the chart panel so that there is enough space for the legend. I can write some code snippets if you are not familiar with the panel layout properties..

Best Regards,
Milen

 

By John Burcher 1 - Thursday, August 6, 2009

Hi Milen,

Thank you for the reply. In regards to point 2, worked a treat thank you!

In regards to point 1, do you have any code that I can use to manually overwrite the colors? I have briefly checked the VB.NET examples but can't find anything.

Thank you Milen!
By Milen - Friday, August 7, 2009

Hi John,

The easiest way is to set individual fill and stroke for each series, for example:

    series1.FillStyle = new NColorFillStyle(Color.Red);
    series1.BorderStyle = new NStrokeStyle(1, Color.Red);

    series2.FillStyle = new NColorFillStyle(Color.Green);
    series2.BorderStyle = new NStrokeStyle(1, Color.Green);

You can also apply a stylesheet with predefined palette first, and then overwrite the colors for some of the series.

Alternatively, you create a custom palette (NChartPalette type) and use the NStyleSheet.CreateFromPalette method to create a stylesheet from it. The NChartPalette type has a list of series colors (see the SeriesColors property).

Best Regards,
Milen

By John Burcher 1 - Sunday, August 9, 2009

Hi Milen,

That is perfect, works a treat thank you!
By John Burcher 1 - Sunday, August 9, 2009

Hi Milen,

I have had a bit of a hitch with this code below:-
Dim NChartPalette As New Nevron.Chart.NChartPalette
Dim List As New List(Of Drawing.Color)

List.Add(Drawing.Color.Black)
List.Add(Drawing.Color.White)

NChartPalette.SeriesColors = List

List = NChartPalette.SeriesColors

Dim NStyleSheet As New Nevron.Chart.NStyleSheet
NStyleSheet.createfrompalette(NChartPalette)

The issue is that createfrompalette is not a member of NStyleSheet. Am I doing something wrong?

Thank you!
By Milen - Tuesday, August 11, 2009

Hi John,

My mistake, I was testing with my build of the next version where this method is present. Unfortunately it is not available in the current version, so for now only the first option remains. Sorry for misleading you.

Milen