Issue in Line+Bar chart

5 posts, 0 answers
  1. Kiran Ghanwat
    Kiran Ghanwat avatar
    38 posts
    Member since:
    Nov 2009

    Posted 07 Apr 2010 Link to this post

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

  2. Grtjn
    Grtjn avatar
    129 posts
    Member since:
    Feb 2010

    Posted 07 Apr 2010 Link to this post

    Tried to change the itemwidtpercent ?

    RadChart.DefaultView.ChartArea.ItemWidthPercent = 40;

    Maybe could help...

    Gertjan

  3. Kiran Ghanwat
    Kiran Ghanwat avatar
    38 posts
    Member since:
    Nov 2009

    Posted 08 Apr 2010 Link to this post

    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

  4. Grtjn
    Grtjn avatar
    129 posts
    Member since:
    Feb 2010

    Posted 08 Apr 2010 Link to this post

    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
  5. Kiran Ghanwat
    Kiran Ghanwat avatar
    38 posts
    Member since:
    Nov 2009

    Posted 06 Aug 2010 Link to this post

    Hello,

    Gertjan

    It worked for me.
    Thanks a lot.
Back to Top