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

Binding the number of chart series

1 Answer 44 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ray White
Top achievements
Rank 1
Ray White asked on 08 May 2012, 04:07 PM
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:RadChart.SeriesMappings>

    <telerik:SeriesMapping>

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

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

    </telerik:SeriesMapping>

    <telerik:SeriesMapping>

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

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

    </telerik:SeriesMapping>

</telerik:RadChart.SeriesMappings>


1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 11 May 2012, 09:08 AM
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 >>

Tags
Chart
Asked by
Ray White
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or