probleme to combine groupin and stackbar

4 posts, 0 answers
  1. styx
    styx avatar
    2 posts
    Member since:
    Mar 2011

    Posted 13 Oct 2011 Link to this post

    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
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 18 Oct 2011 Link to this post

    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 >>

  3. styx
    styx avatar
    2 posts
    Member since:
    Mar 2011

    Posted 18 Oct 2011 Link to this post

    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>
  4. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 20 Oct 2011 Link to this post

    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 >>

Back to Top