Issue with multiple barseries in a chart

2 posts, 0 answers
  1. Piali
    Piali avatar
    5 posts
    Member since:
    Jan 2008

    Posted 07 May 2013 Link to this post

    Hi,

    I am using the RadCartesian chart and have four BarSeries. I am binding the data as per one of the samples but only one of the barseries shows up. The value is always 10.0. The category binding uses the time field. Attached is how the chart shows up. What am I doing wrong here?


    Here is the code for the data binding:

    BarSeries barSeries1 = this.radChart.Series[0] as BarSeries;

    barSeries1.ValueBinding = new GenericDataPointBinding<LocationLiveFeedObject, double>() { ValueSelector = obj => obj.Value };

    barSeries1.CategoryBinding = new GenericDataPointBinding<LocationLiveFeedObject, DateTime>() { ValueSelector = obj => obj.Time };

    barSeries1.DataContext = this.indexItemGenerator1.DataSource;




    Here is the XAML:

    <chart:RadCartesianChart Name="radChart" Zoom="2,1" MaxZoom="20,1">

    <chart:RadCartesianChart.Grid>

    <chart:CartesianChartGrid MajorLinesVisibility="X" Style="{StaticResource gridStyleDashed}"/>

    </chart:RadCartesianChart.Grid>

    <chart:RadCartesianChart.Behaviors>

    <chart:ChartPanAndZoomBehavior ZoomMode="Horizontal" PanMode="Horizontal"/>

    </chart:RadCartesianChart.Behaviors>

    <chart:RadCartesianChart.HorizontalAxis>

    <chart:DateTimeContinuousAxis MajorStep="3"

    MajorStepUnit="Hour"

    LabelFormat="HH:mm"

    PlotMode="OnTicks"

    Style="{StaticResource timeLineAxisStyleWithTicks}">

    <chart:DateTimeContinuousAxis.LabelStyle>

    <Style TargetType="TextBlock" BasedOn="{StaticResource textBlockStyle}">

    <Setter Property="Width" Value="50"/>

    </Style>

    </chart:DateTimeContinuousAxis.LabelStyle>

    </chart:DateTimeContinuousAxis>

    </chart:RadCartesianChart.HorizontalAxis>

    <chart:RadCartesianChart.VerticalAxis>

    <chart:LinearAxis Minimum="0"

    Maximum="10"

    LineStroke="Transparent"

    ShowLabels="False"

    Style="{StaticResource linearAxisStyle}"/>

    </chart:RadCartesianChart.VerticalAxis>

    <chart:BarSeries CombineMode="Stack" ItemsSource="{Binding}">

    <chart:BarSeries.PointTemplates>

    <DataTemplate>

    <Border Background="{StaticResource Series5Brush}"

    BorderBrush="{StaticResource Series5BorderBrush}"

    BorderThickness="2, 2, 2, 2"/>

    </DataTemplate>

    </chart:BarSeries.PointTemplates>

    </chart:BarSeries>

    <chart:BarSeries CombineMode="Stack" ItemsSource="{Binding}">

    <chart:BarSeries.PointTemplates>

    <DataTemplate>

    <Border Background="{StaticResource Series1Brush}"

    BorderBrush="{StaticResource Series1BorderBrush}"

    BorderThickness="2, 2, 2, 2"/>

    </DataTemplate>

    </chart:BarSeries.PointTemplates>

    </chart:BarSeries>

    <chart:BarSeries CombineMode="Stack" ItemsSource="{Binding}">

    <chart:BarSeries.PointTemplates>

    <DataTemplate>

    <Border Background="{StaticResource Series3Brush}"

    BorderBrush="{StaticResource Series3BorderBrush}"

    BorderThickness="2, 2, 2, 2"/>

    </DataTemplate>

    </chart:BarSeries.PointTemplates>

    </chart:BarSeries>

    <chart:BarSeries CombineMode="Stack" ItemsSource="{Binding}">

    <chart:BarSeries.PointTemplates>

    <DataTemplate>

    <Border Background="{StaticResource Series4Brush}"

    BorderBrush="{StaticResource Series4BorderBrush}"

    BorderThickness="2, 2, 2, 2"/>

    </DataTemplate>

    </chart:BarSeries.PointTemplates>

    </chart:BarSeries>

    </chart:RadCartesianChart>

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 09 May 2013 Link to this post

    Hi Piali,

    Thanks for writing.
    Are you binding all the series or just the first? You should be binding all bar series in the same way. Also you can set the bindings through XAML. By installing RadControls you also install the source code of our Examples app. It contains many chart examples including stacked bars. Feel free to browse those for working examples.

    Please write again if you need further assistance.

    Kind regards,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top