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

Declarative RadChart Legend issues.

3 Answers 147 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 14 Jun 2009, 06:47 PM
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

3 Answers, 1 is accepted

Sort by
0
Velin
Telerik team
answered on 17 Jun 2009, 10:43 AM
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.
0
Monalisa
Top achievements
Rank 1
answered on 24 Sep 2009, 07:44 AM
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
0
Velin
Telerik team
answered on 29 Sep 2009, 09:30 AM
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.
Tags
Chart
Asked by
Nick
Top achievements
Rank 1
Answers by
Velin
Telerik team
Monalisa
Top achievements
Rank 1
Share this question
or