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

3 bars for each x axis point instead of 1 bar

2 Answers 27 Views
Chart
This is a migrated thread and some comments may be shown as answers.
IT Support
Top achievements
Rank 1
IT Support asked on 21 Mar 2011, 02:53 PM
Hi,

I'm trying to make a graph with 3 bars that each bar is connected to a specific legend.

For some reason, I get 3 bars for each x axis item.

I'm probably doing something wrong.

Avi

<
telerik:RadChart
                         Margin="0,0,-108,-34"
                         ItemsSource="{Binding Data}">
 
           <telerik:RadChart.DefaultView>
 
               <telerik:ChartDefaultView>
 
                   <telerik:ChartDefaultView.ChartLegend>
                       <telerik:ChartLegend x:Name="chartLegend"
                                             
                                            UseAutoGeneratedItems="True" />
                   </telerik:ChartDefaultView.ChartLegend>
 
                   <telerik:ChartDefaultView.ChartArea>
 
                       <telerik:ChartArea
                                          LabelFormatBehavior="None"
                                          LegendName="chartLegend"
                                          Visibility="Visible">
                           <telerik:ChartArea.DataSeries>
                               <telerik:DataSeries>
                                   <telerik:DataSeries.Definition>
                                       <telerik:BarSeriesDefinition LegendDisplayMode="DataPointLabel"
                                                                    ShowItemLabels="True"
                                                                    Visibility="Visible"/>
                                   </telerik:DataSeries.Definition>
                               </telerik:DataSeries>
 
                           </telerik:ChartArea.DataSeries>
 
                           <telerik:ChartArea.AxisX>
                               <telerik:AxisX Title="x name" />
                           </telerik:ChartArea.AxisX>
                           <telerik:ChartArea.AxisY>
                               <telerik:AxisY Title="y name"
                                              AutoRange="False"
                                              MaxValue="30000"
                                              MinorTickPointMultiplier="5"
                                              Step="1000" />
                           </telerik:ChartArea.AxisY>
                       </telerik:ChartArea>
 
                   </telerik:ChartDefaultView.ChartArea>
 
               </telerik:ChartDefaultView>
 
           </telerik:RadChart.DefaultView>
           <telerik:RadChart.SeriesMappings>
               <telerik:SeriesMapping LegendLabel="label_1">
                   <telerik:ItemMapping DataPointMember="YValue" FieldName="Amount" />
                   <telerik:ItemMapping DataPointMember="XCategory" FieldName="TypeAmount" />
               </telerik:SeriesMapping>
 
               <telerik:SeriesMapping LegendLabel="label_2">
                   <telerik:ItemMapping DataPointMember="YValue" FieldName="Amount" />
                   <telerik:ItemMapping DataPointMember="XCategory" FieldName="TypeAmount" />
               </telerik:SeriesMapping>
 
               <telerik:SeriesMapping LegendLabel="label_3">
                   <telerik:ItemMapping DataPointMember="YValue" FieldName="Amount" />
                   <telerik:ItemMapping DataPointMember="XCategory" FieldName="TypeAmount" />
               </telerik:SeriesMapping>
 
           </telerik:RadChart.SeriesMappings>
 
       </telerik:RadChart>

2 Answers, 1 is accepted

Sort by
0
IT Support
Top achievements
Rank 1
answered on 23 Mar 2011, 08:12 AM
Can anybody help me?
0
Accepted
Missing User
answered on 24 Mar 2011, 11:07 AM
Hi,

In this scenario you need to use SeriesMapping.GroupingSettings in order to group the data by one or more parameters. For example:
<telerik:RadChart x:Name="radChart">
    <telerik:RadChart.SeriesMappings>
        <telerik:SeriesMapping >
            <telerik:SeriesMapping.SeriesDefinition>
                <telerik:BarSeriesDefinition />
            </telerik:SeriesMapping.SeriesDefinition>
            <telerik:SeriesMapping.GroupingSettings>
                <telerik:GroupingSettings ShouldCreateSeriesForLastGroup="True">
                    <telerik:GroupingSettings.GroupDescriptors>
                        <telerik:ChartGroupDescriptor Member="TypeAmount"/>
                    </telerik:GroupingSettings.GroupDescriptors>
                </telerik:GroupingSettings>
            </telerik:SeriesMapping.GroupingSettings>
            <telerik:SeriesMapping.ItemMappings>
                <telerik:ItemMapping DataPointMember="YValue" FieldName="Amount" />
                <telerik:ItemMapping DataPointMember="XCategory" FieldName="TypeAmount" />
            </telerik:SeriesMapping.ItemMappings>
        </telerik:SeriesMapping>
    </telerik:RadChart.SeriesMappings>
</telerik:RadChart>

I hope this helps.

Kind regards,
Polina
the Telerik team
Tags
Chart
Asked by
IT Support
Top achievements
Rank 1
Answers by
IT Support
Top achievements
Rank 1
Missing User
Share this question
or