Copy/Replicate Series Style

6 posts, 0 answers
  1. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 16 Apr 2012 Link to this post

    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!
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 19 Apr 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 19 Apr 2012 Link to this post

    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!
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 24 Apr 2012 Link to this post

    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 >>

  6. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 24 Apr 2012 Link to this post

    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.
  7. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 27 Apr 2012 Link to this post

    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 >>

Back to Top
DevCraft banner