SeriesMappings Help

2 posts, 0 answers
  1. Francesco Vivaldi
    Francesco Vivaldi avatar
    13 posts
    Member since:
    Nov 2009

    Posted 14 Feb 2011 Link to this post

    hi, i am try to show a chart with two SeriesMappings, but only one is showed.

    this is is xaml
    <telerik:RadChart x:Name="RadChart">           
               <telerik:RadChart.SeriesMappings>
                   <telerik:SeriesMapping LegendLabel="Domain Number">
                        
                       <telerik:SeriesMapping.GroupingSettings>
                           <telerik:GroupingSettings />
                       </telerik:SeriesMapping.GroupingSettings>
                       <telerik:SeriesMapping.SeriesDefinition>
                           <telerik:StackedBarSeriesDefinition  />
                       </telerik:SeriesMapping.SeriesDefinition>  
                       <telerik:ItemMapping DataPointMember="XCategory" FieldName="ItemName" />
                       <telerik:ItemMapping DataPointMember="YValue" FieldName="ItemsCount" />
                        
               </telerik:SeriesMapping>
                   <telerik:SeriesMapping LegendLabel="Total Domain Available">
                       <telerik:SeriesMapping.GroupingSettings>
                           <telerik:GroupingSettings />
                       </telerik:SeriesMapping.GroupingSettings>
                   <telerik:SeriesMapping.SeriesDefinition>
                       <telerik:StackedBarSeriesDefinition  />
                   </telerik:SeriesMapping.SeriesDefinition>
                   <telerik:ItemMapping DataPointMember="XCategory" FieldName="ItemName" />
                   <telerik:ItemMapping DataPointMember="YValue" FieldName="ItemsCount2" />
                   </telerik:SeriesMapping>
               </telerik:RadChart.SeriesMappings>
            
       </telerik:RadChart>

    and this is the c# code

    public void InitializeMailServiceRadChart(List<ChartItem2Val> values)
            {
               
                this.RadChart.DefaultSeriesDefinition.ShowItemToolTips = true; 
                 
                this.RadChart.ItemsSource = values;
    }

    ChartItem2Val structure:

    public class ChartItem2Val
       {
           public int ItemsCount { get; set; }
           public string ItemName { get; set; }
           public int ItemsCount2 { get; set; }
           public string ItemName2 { get; set; }
     
           public ChartItem2Val()
           {
           }
     
           public ChartItem2Val(string itmName,int itmCount,string itmName2,int itmCount2)
           {
               ItemName = itmName;
               ItemsCount = itmCount;
     
               ItemName2 = itmName2;
               ItemsCount2 = itmCount2;
           }
       }

    where am I doing wrong?
  2. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 17 Feb 2011 Link to this post

    Hello Francesco,

    I am afraid I do not see anything wrong with the code provided. I created a small test with dummy data as shown below and it seems to work fine for me.

    this.RadChart1.ItemsSource = new List<ChartItem2Val>
                    {
                        new ChartItem2Val("Name1", 5, "Name2_1", 15),
                        new ChartItem2Val("Name2", 5, "Name2_2", 15),
                        new ChartItem2Val("Name3", 5, "Name2_3", 15),
                        new ChartItem2Val("Name4", 5, "Name2_4", 15),
                    };


    You can find the example attached along with the resulting chart. Let me know if I have missed anything or if I need to change anything in order to reproduce the problem.

    Best regards,
    Ves
    the Telerik team
Back to Top