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

Copy/Replicate Series Style

5 Answers 82 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Enal
Top achievements
Rank 1
Enal asked on 16 Apr 2012, 07:04 PM
Hello - 

We are currently using the defaults to render series. A new requirement is to draw some series in the same style as others (which have previously been auto-generated)

I tried getting the Appearance from the SeriesDefinition and applying relevant values (Fill, Stroke, ...) but it turns out they are all null and it has no effect in any case. As a trivial outline this is what we need:

var seriesA = generateSeries(...)
var seriesB = generateSeries(...)
seriesB.Style = seriesA.Style

Any help how this can be accomplished?

Thanks!

5 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 19 Apr 2012, 04:36 PM
Hello Enal, 

I am not sure that I understand you fully. If I am not wrong - you have more than one series, and these series have different colors and you need them to have the same color.

I can suggest that you use the palette of the chart:
this.radChart1.PaletteBrushes.Add(new SolidColorBrush(Colors.Blue));

This will force the chart to use only 1 brush for all series. 

Kind regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Enal
Top achievements
Rank 1
answered on 19 Apr 2012, 04:49 PM
Hi Petar -

Thanks, almost...

What we are trying to do is to apply the same style to SOME of the series (not all). Is this possible?

(To give some context - for example we have 5 series. Now the user picks ONE series to plot a linear fit. We want that new series to match the look of the original one so the user can associate them visually).

Thanks!
0
Petar Marchev
Telerik team
answered on 24 Apr 2012, 12:34 PM
Hello Enal,

If you have not specified a brush, it is defined internally by the current Theme and there is no way to get the brush of a series.

I suggest that you manually set the brushes (Fill, Stroke) for series.
this.radChart1.SeriesMappings[1].SeriesDefinition.Appearance.Stroke = new SolidColorBrush(Colors.Magenta);
this.radChart1.SeriesMappings[1].SeriesDefinition.Appearance.Fill = new SolidColorBrush(Colors.Cyan);
 

Kind regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Enal
Top achievements
Rank 1
answered on 24 Apr 2012, 04:15 PM
Hi Petar - 

The caveats with that solution are 
  • Theme defined brushes are dynamic and look fancier than simple solids
  • You have clever algorithms to determine coloring of multiple series. We plot many series per chart and don't want to reinvent it.
  • We give our users the option of switching themes and the series should adapt

Ultimately managing look and feel would get quite complex in this context and we need to focus on value added logic for the business rather than styling.
.
As a suggestion for enhancements - it would be good to expose such settings.
This would allow us to take and customize look and feel in various contexts.

Thanks.
0
Petar Marchev
Telerik team
answered on 27 Apr 2012, 08:22 AM
Hi Enal,

I would then point you to our RadChartView, which is a new control, with which you can easily achieve this (through the Palette property). Note that these are different controls and there is no equivalent for each feature they have. Here is a link of a comparison of the two. You can explore the chart view and see if it is a feasible and reasonable solution to migrate your project to it.

Regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ChartView
Asked by
Enal
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Enal
Top achievements
Rank 1
Share this question
or