Binding the number of chart series

2 posts, 0 answers
  1. Ray White
    Ray White avatar
    5 posts
    Member since:
    Feb 2007

    Posted 08 May 2012 Link to this post

    Is it possible to configure xaml RadChart binding to choose the number of series?  (xaml only, no code behind, no C#, no VB)

    For instance, can you choose between two bar series or three bar series based on a xaml binding? (Without using code behind)  Or must you have a fixed number of series in xaml?

    Here is an example of two fixed series.  Can I configure this differently so I can programatically choose the number of series with xaml.




            <telerik:ItemMapping DataPointMember="YValue" FieldName="Upload" />

            <telerik:ItemMapping DataPointMember="XCategory" FieldName="Name" />



            <telerik:ItemMapping DataPointMember="YValue" FieldName="Download" />

            <telerik:ItemMapping DataPointMember="XCategory" FieldName="Name" />



  2. Petar Marchev
    Petar Marchev avatar
    968 posts

    Posted 11 May 2012 Link to this post

    Hello Ray,

    If I understand correctly you want to declare all possible series inside the series mappings and later show only one of these series without removing/adding or creating a SeriesMapping.

    If this is the case I can suggest that you use the Visibility property of the series definition. Set all other series definitions' Visibility to Collapsed and only the to the one you need to show set Visible. This can either be done in code behind by only accessing the SeriesMappings through an index or you can do it with a converter (custom IndexToVisibilityConverter with a ConverterParameter=index of the series mapping in the SerriesMappings collection).
    <telerik:RangeBarSeriesDefinition Visibility="{Binding MySeriesIndex, Converter={StaticResource MyIndexToVisibilityConverter}, ConverterParameter=0}" />

    All the best,
    Petar Marchev
    the Telerik team

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

  3. DevCraft banner
Back to Top