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

[Solved] SeriesMappings Help

1 Answer 101 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Francesco Vivaldi
Top achievements
Rank 1
Francesco Vivaldi asked on 14 Feb 2011, 07:09 PM
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?

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 17 Feb 2011, 12:34 PM
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
Tags
Chart
Asked by
Francesco Vivaldi
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or