Dynamic BarSeries

3 posts, 0 answers
  1. Tracy
    Tracy avatar
    29 posts
    Member since:
    Sep 2010

    Posted 19 Jan 2012 Link to this post

    I need to be able to specify a dynamic set of BarSeries for a RadCartesianChart through XAML which is bound to a property in my viewmodel.

    I tried creating a property which is of type List<CartesianSeries> and binding to that but it is not working.
    public List<CartesianSeries> BarSeriesList
    {
        get
        {
            List<CartesianSeries> barSeriesList = new List<CartesianSeries>();
     
            foreach (ChartDataPointModel dataPoint in DataPoints)
            {
                BarSeries barSeries = new BarSeries();
                barSeries.DataPoints.Add(new CategoricalDataPoint() { Value = dataPoint.Value, Label = dataPoint.Name, Category = dataPoint.Name });
                barSeriesList.Add(barSeries);
            }
     
            return barSeriesList;
        }
        set
        {
            // do nothing
        }
    }

    The XAML I tried to use to bind to it is:

    <chart:RadCartesianChart Palette="{Binding Palette}" Height="300" Width="500">
     
         <chart:RadCartesianChart.Series>                       
             <chartView:BarSeries ValueBinding="Value" CategoryBinding="Name" ItemsSource="{Binding BarSeriesList}" />
         </chart:RadCartesianChart.Series>
     
         <chart:RadCartesianChart.HorizontalAxis>
             <chartView:CategoricalAxis/>
         </chart:RadCartesianChart.HorizontalAxis>
          
         <chart:RadCartesianChart.VerticalAxis>
             <chartView:LinearAxis LabelFormat="0" />
         </chart:RadCartesianChart.VerticalAxis>
     
         <chart:RadCartesianChart.Grid>
             <chartView:CartesianChartGrid MajorLinesVisibility="Y" />
         </chart:RadCartesianChart.Grid>
     
     </chart:RadCartesianChart>

    How is the BarSeries supposed to be bound to make it dynamic?

    Thanks,

    Tracy
  2. Tracy
    Tracy avatar
    29 posts
    Member since:
    Sep 2010

    Posted 20 Jan 2012 Link to this post

    Not an issue anymore - I am using a different approach to displaying the data.

    Tracy
  3. UI for WPF is Visual Studio 2017 Ready
  4. Greg
    Greg avatar
    29 posts
    Member since:
    Oct 2007

    Posted 08 Feb 2013 Link to this post

    Hi Tracy.

    Can you share your solution? I am trying to accomplish the same thing.

    Thanks,

    Greg
Back to Top