Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Category Series
posted

Hi Team,

Is it possible to create a category series with dynamic series elements.

Below mentioned is the way my requirement of xam data chart  should looks like.

In the below mentioned sample the series are predefined as 5 but as per my requirement the number of series are dynamic that are categorized by a fixed category.

Can you please provide a sample if you have any.Thanks in advance for all you do.

The below mentioned part needs to be dynamic where the value member path should be dynamic.

Sample code :




Title="{Binding StringEnergyCoal, Source={StaticResource DataViewModel}}"
XAxis="{Binding ElementName=BarXAxis}"
YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">

Title="{Binding StringEnergyHydro, Source={StaticResource DataViewModel}}"
XAxis="{Binding ElementName=BarXAxis}"
YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">

Title="{Binding StringEnergyNuclear, Source={StaticResource DataViewModel}}"
XAxis="{Binding ElementName=BarXAxis}"
YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">

Title="{Binding StringEnergyGas, Source={StaticResource DataViewModel}}"
XAxis="{Binding ElementName=BarXAxis}"
YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">

Title="{Binding StringEnergyOil, Source={StaticResource DataViewModel}}"
XAxis="{Binding ElementName=BarXAxis}"
YAxis="{Binding ElementName=BarYAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">

Regards,

Sridhar.

Parents
  • 4618
    posted

    Hi Sridhar,

     

    If I understand the behavior that you are interested in achieving with the DataChart, it sounds like you want to dynamically modify the number of series during runtime and not necessarily change the ValueMemberPath for a given series?

     

    Both behaviors are certainly possible as long as you are defining each of your series at some point and adding them to the chart’s Series collection or for the latter behavior, (if you really do want to modify the ValueMemberPath for your series during runtime) as long as an appropriate public property off of the underlying object is exposed, you can certainly change the path to some other value as well.

     

    I’ve attached a basic sample for swapping out series, (as this scenario sounds closest to your goal) where categories are defined for energy sources and the series associated with specific country energy production are dynamically added and removed from the chart.

     

    Please find the sample attached and if you have any further questions, or if I’ve misunderstood your intention, please let me know.

     

    Chris K.

    CategorySeries_DynamicElements_180282.zip
Reply Children