Profile Picture

Stacked Bar

Posted By John Burcher 15 Years Ago
Author
Message
John Burcher
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 15, Visits: 1
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!

Attachments
2.png (37 views, 103.00 KB)
Milen Metodiev
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

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

 



John Burcher
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 15, Visits: 1
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!

Milen Metodiev
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

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



John Burcher
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 15, Visits: 1
Hi Milen,

That is perfect, works a treat thank you!

John Burcher
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 15, Visits: 1
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!

Milen Metodiev
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

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





Similar Topics


Reading This Topic