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

probleme to combine groupin and stackbar

3 Answers 149 Views
Chart
This is a migrated thread and some comments may be shown as answers.
styx
Top achievements
Rank 1
styx asked on 13 Oct 2011, 12:12 PM
Hello
i have a probleme to combine in the same chart grouping and stackbar

public class data
{    string operation {get;set;}
    int secteurId {get;set;}
    int offres{get;set;}
     int demandes{get;set;}
}
<telerik:RadChart HorizontalAlignment="Left" Margin="5,5,5,5" Name="tdbChart" VerticalAlignment="Top"  >
            <telerik:RadChart.SeriesMappings>
               <telerik:SeriesMapping>
                   <telerik:SeriesMapping.SeriesDefinition>
                       <telerik:StackedBarSeriesDefinition />
                   </telerik:SeriesMapping.SeriesDefinition>
                   <telerik:SeriesMapping.GroupingSettings>
                       <telerik:GroupingSettings >
                           <telerik:GroupingSettings.GroupDescriptors>
                               <telerik:ChartGroupDescriptor Member="codeOperation"/>                                             
                           </telerik:GroupingSettings.GroupDescriptors>
                       </telerik:GroupingSettings>
                   </telerik:SeriesMapping.GroupingSettings>
                   <telerik:SeriesMapping.ItemMappings>
                       <telerik:ItemMapping FieldName="demandes" DataPointMember="YValue" AggregateFunction="Sum"   />
                       <telerik:ItemMapping FieldName="secteurID" DataPointMember="XCategory" />
                   </telerik:SeriesMapping.ItemMappings>
               </telerik:SeriesMapping>
               <telerik:SeriesMapping>
                   <telerik:SeriesMapping.SeriesDefinition>
                       <telerik:StackedBarSeriesDefinition />
                   </telerik:SeriesMapping.SeriesDefinition>
                   <telerik:SeriesMapping.GroupingSettings>
                       <telerik:GroupingSettings >
                           <telerik:GroupingSettings.GroupDescriptors>
                               <telerik:ChartGroupDescriptor Member="codeOperation"/>
                           </telerik:GroupingSettings.GroupDescriptors>
                       </telerik:GroupingSettings>
                   </telerik:SeriesMapping.GroupingSettings>
                   <telerik:SeriesMapping.ItemMappings>
                       <telerik:ItemMapping FieldName="offres" DataPointMember="YValue" AggregateFunction="Sum"   />
                       <telerik:ItemMapping FieldName="secteurID" DataPointMember="XCategory" />
                   </telerik:SeriesMapping.ItemMappings>
               </telerik:SeriesMapping>
           </telerik:RadChart.SeriesMappings>
       </telerik:RadChart>

I want to have serie of sum of offres stacked on serie of sum  of demandes for each operation , grouped by secteurId
sorry for my english
thanks

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 18 Oct 2011, 07:29 AM
Hi Styx,

The grouping feature of the control is elaborated on in the following topic:

http://www.telerik.com/help/silverlight/radchart-features-grouping-and-aggregation.html

Can you please elaborate on how this functionality is falling short on your end. Any additional information will be helpful - are the fields you want to group on in the original datasource, or perhaps you want to add some additional information in the chart?

Greetings,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
styx
Top achievements
Rank 1
answered on 18 Oct 2011, 10:44 AM
Hi , thanks for your response 
the result of the code blow is "bargraphe.png" , the 3 first series represent the aggregate  values for "demande" for each category, and the second three series represent the aggregate  values for "offres" values , I want to make each bar on the three last series above each bar of the three first series, e.g. the first one on the first one, the second one on the second and so on and so forth, for exemple , stockage-demande on stockage-offre , but when I modify the series definition with "stackedbardefinition" i have the result in the "stackedbar.png"


<telerik:RadChart HorizontalAlignment="Left" Margin="5,5,5,5" Name="tdbChart" VerticalAlignment="Top"  >
           <telerik:RadChart.SeriesMappings>
               <telerik:SeriesMapping>
                   <telerik:SeriesMapping.SeriesDefinition>
                       <telerik:BarSeriesDefinition />
                   </telerik:SeriesMapping.SeriesDefinition>
                   <telerik:SeriesMapping.GroupingSettings>
                       <telerik:GroupingSettings >
                           <telerik:GroupingSettings.GroupDescriptors>
                               <telerik:ChartGroupDescriptor Member="codeOperation"/>
                               <telerik:ChartGroupDescriptor Member="secteurID"/>
                           </telerik:GroupingSettings.GroupDescriptors>
                       </telerik:GroupingSettings>
                   </telerik:SeriesMapping.GroupingSettings>
                   <telerik:SeriesMapping.ItemMappings>
                       <telerik:ItemMapping FieldName="demandes" DataPointMember="YValue" AggregateFunction="Sum"   />
                       <telerik:ItemMapping FieldName="Secteur.libelle" DataPointMember="XCategory" />
                   </telerik:SeriesMapping.ItemMappings>
               </telerik:SeriesMapping>
               <telerik:SeriesMapping>
                   <telerik:SeriesMapping.SeriesDefinition>
                       <telerikBarSeriesDefinition />
                   </telerik:SeriesMapping.SeriesDefinition>
                   <telerik:SeriesMapping.GroupingSettings>
                       <telerik:GroupingSettings >
                           <telerik:GroupingSettings.GroupDescriptors>
                               <telerik:ChartGroupDescriptor Member="codeOperation"/>
                               <telerik:ChartGroupDescriptor Member="secteurID"/>
                           </telerik:GroupingSettings.GroupDescriptors>
                       </telerik:GroupingSettings>
                   </telerik:SeriesMapping.GroupingSettings>
                   <telerik:SeriesMapping.ItemMappings>
                       <telerik:ItemMapping FieldName="offres" DataPointMember="YValue" AggregateFunction="Sum"   />
                       <telerik:ItemMapping FieldName="Secteur.libelle" DataPointMember="XCategory" />
                   </telerik:SeriesMapping.ItemMappings>
               </telerik:SeriesMapping>
           </telerik:RadChart.SeriesMappings>
       </telerik:RadChart>
0
Yavor
Telerik team
answered on 20 Oct 2011, 08:34 AM
Hi Styx,

Indeed, this is the expected result. The reason for this is that you are grouping on the categories.
Since they are only two, you get the result shown in the screenshot. One possible option would be to include one additional field in the datasource, and group on it.
Another option is to simply use this additional field as a category (it will determine which item will be in each group), and simply include separate series, which are stacked.
Give these options a try and let me know if I am leaving something out.

Regards,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
styx
Top achievements
Rank 1
Answers by
Yavor
Telerik team
styx
Top achievements
Rank 1
Share this question
or