This is a migrated thread and some comments may be shown as answers.

Point Series Palette Broken

1 Answer 17 Views
Chart
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 19 Nov 2015, 04:26 PM

Hi,

I think there is a bug when defining a ChartPalette with a series family for points.  It is not coloring the points according to the series palette.  Say I have a chart with a mixed set of line and point series.  I add two PaletteEntryCollections for each series family:

ChartPalette palette = LinePalette;
 palette.GlobalEntries.Clear();
 palette.SeriesEntries.Clear();
 palette.SeriesEntries.Add(new PaletteEntryCollection());
 palette.SeriesEntries.Add(new PaletteEntryCollection());
 
 palette.SeriesEntries[0].SeriesFamily = "Line";
 foreach (ChartTimeSeries serie in model.ChartData.Where(s => s.Type == typeof(LineSeries)))
 {
     SolidColorBrush brush = new SolidColorBrush(serie.Color);
     PaletteEntry pe = new PaletteEntry(brush, brush);
     palette.SeriesEntries[0].Add(pe);
 }
 
 palette.SeriesEntries[1].SeriesFamily = "Point";
 palette.SeriesEntries[1].Add(new PaletteEntry(new SolidColorBrush(Colors.Yellow)));
 palette.SeriesEntries[1].Add(new PaletteEntry(new SolidColorBrush(Colors.Purple)));
I assign this palette to the chart.  Both the lines and point series do not correspond to the correct colors.  They points should alternate yellow/purple, but they are all purple.  I've played around with this a lot to try and discover a pattern.  I used this with Bar series and it seems to work just fine.  It's only a problem with point/line series.  My workaround is that I have to create a global palette for both the line and point series with the correct ordering of colors to get it to render properly.  All the examples I've seen from Telerik use Area/Bar charts with this feature.  I am using the most recent Telerik.  Anyone else see this problem?

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 20 Nov 2015, 08:18 AM
Hello David,

I am attaching a small project that demonstrates how the palette works.

The chart palette is not very intuitive, and you simply expect it to do something that it is not designed to do. See in the attached project that there are four series in total, two line series, two point series. The palette defines two PaletteEntryCollections, one for the line series with a red and green brush, and one collection for the point series with yellow and purple brush.

In the attached image you can see that indeed the line series got their colors based on their corresponding palette entry collection - one line is red, one is green. The same goes for the point series, both the point series got their colors from their corresponding collection, one point series is yellow, one point series is purple.

It is not expected for the points within a single series to get two different colors. Did I understand correctly, that this is what you need to do? Do you have a single point series and need to get alternating point colors?

If this is the case, I suggest you do not use a palette, you can get this via the DefaultVisualStyleSelector capabilities of the series. In the style selector you can check the Index of the data point and return one of two predefined styles. Let us know if this works for you.

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
David
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or