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

Issue in Line+Bar chart

4 Answers 132 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kiran Ghanwat
Top achievements
Rank 1
Kiran Ghanwat asked on 07 Apr 2010, 12:09 PM
Hello Community,
    I am trying to plot Line and Bar chart.
    Line serires gets plotted. bt, for Bar series it doesn't shows Bars. 
    Please, help.
    My code snippet is :

List<List<ChartData>> chartData = new List<List<ChartData>>();  
 
                ValChart.DefaultView.ChartTitle.Content = "Income Statement";  
 
                ValChart.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;  
                ValChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMM yyyy";  
                ValChart.DefaultView.ChartArea.AxisX.LabelStep = 2;  
 
                ValChart.DefaultView.ChartArea.AxisY.AutoRange = true;  
 
                SeriesMapping Mapping = new SeriesMapping();  
                BarSeriesDefinition bar = new BarSeriesDefinition();  
                 
                bar.ShowItemLabels = true;  
                bar.ShowItemToolTips = true;  
 
                Mapping.SeriesDefinition = bar;  
                Mapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));  
                Mapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));  
 
                Mapping.LegendLabel = lstChart[0][0].description;  
                Mapping.CollectionIndex = 0;  
 
                ValChart.SeriesMappings.Add(Mapping);   
 
                SeriesMapping ValMapping = new SeriesMapping();  
                LineSeriesDefinition lineDefinition = new LineSeriesDefinition();  
                lineDefinition.ShowPointMarks = true;  
                lineDefinition.ShowItemLabels = false;  
                lineDefinition.ShowItemToolTips = true;  
 
                ValMapping.SeriesDefinition = lineDefinition;  
                ValMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));  
                ValMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));  
 
                ValMapping.LegendLabel = lstChart[1][0].description;  
                ValMapping.CollectionIndex = 1;  
 
                ValChart.SeriesMappings.Add(ValMapping);  
 
                for (int rowcnt = 0; rowcnt < lstChart.Count; rowcnt++)  
                {  
                    if (lstChart[rowcnt].ToList().Count > 1)  
                    {                         
 
                        List<ChartData> lstData = new List<ChartData>();  
 
                        for (int i = 0; i < lstChart[rowcnt].Count; i++)  
                        {  
                            lstData.Add(new ChartData((DateTime)lstChart[rowcnt][i].ValDate, (double)lstChart[rowcnt][i].RatioVal));  
                        }  
                        chartData.Add(lstData);  
 
                        ValChart.ItemsSource = chartData;  
                    }  
                } 

4 Answers, 1 is accepted

Sort by
0
Grtjn
Top achievements
Rank 1
answered on 07 Apr 2010, 02:39 PM
Tried to change the itemwidtpercent ?

RadChart.DefaultView.ChartArea.ItemWidthPercent = 40;

Maybe could help...

Gertjan

0
Kiran Ghanwat
Top achievements
Rank 1
answered on 08 Apr 2010, 06:36 AM
Hey Grtjn ,

    Thanks for your valuable reply.
    It doesn't worked for me. If I plot Line series or Bar series as a single, it gets plotted without any issue. 
    But, when I plots those together it creates the same problem.
    
    Please help.
    
    Thanks,
    Kiran

0
Grtjn
Top achievements
Rank 1
answered on 08 Apr 2010, 07:27 AM
Hi,

For that I do not know the answer, sorry. Have you tried the documentation of Telerik on their website ?
http://www.telerik.com/help/silverlight/radchart-features-multi-series-charts.html

Kind regards,

Gertjan
0
Kiran Ghanwat
Top achievements
Rank 1
answered on 06 Aug 2010, 11:53 AM
Hello,

Gertjan

It worked for me.
Thanks a lot.
Tags
Chart
Asked by
Kiran Ghanwat
Top achievements
Rank 1
Answers by
Grtjn
Top achievements
Rank 1
Kiran Ghanwat
Top achievements
Rank 1
Share this question
or