Declarative RadChart Legend issues.

4 posts, 0 answers
  1. Nick
    Nick avatar
    1 posts
    Member since:
    Jun 2009

    Posted 14 Jun 2009 Link to this post

    Hello,
    This is my first time using telerik RadControls and I've tried to create a RadChart using the declarative RadChart example however the custom item and legend title are missing. If I turn off auto generation I lose the legend entirely.

    Initially I thought I must have done something wrong but it is the same on your example here:
    http://demos.telerik.com/silverlight/#Chart/DeclarativeChart

    If you look at the code it should have a custom item called "Custom Legend Item" which it claims should appear first in the list.

    Is this a known issue or have I misunderstood something?

    Regards,
    Nick
  2. Velin
    Admin
    Velin avatar
    391 posts

    Posted 17 Jun 2009 Link to this post

    Hello Nick,

    Indeed, there is a known issue with declaratively created legend items in RadChart for Silverlight and it is clearly visible in our online example. We've planned to fix it in the shortest terms possible and in the meanwhile you can add culstom legend items in code behind. Here is the code:
            void Page_Loaded(object sender, RoutedEventArgs e) 
            { 
                RadChart1.DefaultView.ChartLegend.Items.Insert(0, new Telerik.Windows.Controls.Charting.ChartLegendItem() { Label = "Custom Item" }); 
            } 

    Hope this helps.

    Sincerely,
    Velin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Monalisa
    Monalisa avatar
    35 posts
    Member since:
    May 2009

    Posted 24 Sep 2009 Link to this post

    Hi,

    How do I show the X-axis label fetching data from Database using WCF in case of Stacked Spline Chart.
    Anybody can reply me how to do this. This is very urgent, please reply as soon as possible

    Thanks,
    Monalisa
  4. Velin
    Admin
    Velin avatar
    391 posts

    Posted 29 Sep 2009 Link to this post

    Hi Monalisa,

    Please, find attached a small project demonstrating the desired behavior. Here is the code behind:

    using System; 
    using System.Collections.Generic; 
    using System.Windows.Controls; 
    using Telerik.Windows.Controls.Charting; 
     
    namespace SilverlightApplication1 
        public partial class MainPage : UserControl 
        { 
            public MainPage() 
            { 
                InitializeComponent(); 
     
                RadChart1.DefaultSeriesDefinition = new SplineSeriesDefinition(); 
                RadChart1.DefaultSeriesDefinition.ShowItemToolTips = true
                RadChart1.DefaultSeriesDefinition.ItemToolTipFormat = "Date: #XCAT\r\nResult: #Y"
     
                RadChart1.DefaultView.ChartArea.AxisX.LabelRotationAngle = 90
                //RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "mm/dd/yyyy"
                SeriesMapping s = new SeriesMapping(); 
     
                ItemMapping x = new ItemMapping("DT", DataPointMember.XCategory); 
                ItemMapping y = new ItemMapping("D", DataPointMember.YValue); 
     
                s.ItemMappings.Add(x); 
                s.ItemMappings.Add(y); 
     
                RadChart1.SeriesMappings.Add(s); 
     
                RadChart1.ItemsSource = A.Fill(10); 
            } 
        } 
     
        public class A 
        { 
            public double D { get; set; } 
            public DateTime DT { get; set; } 
     
            public static IEnumerable<A> Fill(int n) 
            { 
                DateTime now = DateTime.Now; 
                for (int i = 0; i < n; i++) 
                { 
                    A a = new A() { D = iDT = now.AddDays(i) }; 
     
                    yield return a; 
                } 
            } 
        } 



    Regards,
    Author nickname
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.


    Sincerely yours,
    Velin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top