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

Problem changing legend panel orientation

1 Answer 72 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Nuno Ferreira
Top achievements
Rank 1
Nuno Ferreira asked on 24 Jun 2010, 05:42 PM

I think there's a problem to change legend panel orientation when RadChart control starts with that panel visibility collapsed.

I have a project with two RadChart controls with same data. First control starts with legend panel visible, the second starts with panel collapsed.
I have a button for each control to change orientation. For the first chart, changing orientation works fine, for the other doesn't.

I'm using RadControls for Silverlight v2010.1.422.

sample XAML:

 

<Grid x:Name="LayoutRoot">  
        <StackPanel Orientation="Vertical">  
            <telerik:RadChart x:Name="rChart1" Width="300" Height="200"/>  
            <Button Content="Orientation" Click="Orientation1_Click" Margin="10" Width="80"/>  
            <telerik:RadChart x:Name="rChart2" Width="300" Height="200" Margin="50,0,0,0"/>  
            <Button Content="Orientation" Click="Orientation2_Click" Margin="10" Width="80"/>  
        </StackPanel> 
    </Grid> 

 

 

Code-Behind:

public MainPage()  
        {  
            InitializeComponent();  
 
            List<ChartData> data = new List<ChartData>();  
            data.Add(new ChartData { Name = "A", Value = 1 });  
            data.Add(new ChartData { Name = "B", Value = 2 });  
            data.Add(new ChartData { Name = "C", Value = 3 });  
            data.Add(new ChartData { Name = "D", Value = 4 });  
 
            SeriesMapping sm = new SeriesMapping();  
            sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XCategory));  
            sm.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));  
            sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.LegendLabel));  
 
            rChart1.ItemsSource = data;  
            rChart1.DefaultSeriesDefinition = new PieSeriesDefinition();  
            rChart1.SeriesMappings.Add(sm);  
            rChart1.DefaultView.ChartArea.Legend.ItemsPanelOrientation = Orientation.Vertical;  
 
            rChart2.ItemsSource = data;  
            rChart2.DefaultSeriesDefinition = new PieSeriesDefinition();  
            rChart2.SeriesMappings.Add(sm);  
            rChart2.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;  
        }  
 
        private void Orientation1_Click(object sender, RoutedEventArgs e)  
        {  
            Orientation o = rChart1.DefaultView.ChartArea.Legend.ItemsPanelOrientation;  
            if (o.Equals(Orientation.Horizontal)) rChart1.DefaultView.ChartArea.Legend.ItemsPanelOrientation = Orientation.Vertical;  
            else rChart1.DefaultView.ChartArea.Legend.ItemsPanelOrientation = Orientation.Horizontal;  
        }  
 
        private void Orientation2_Click(object sender, RoutedEventArgs e)  
        {  
            Visibility v = rChart2.DefaultView.ChartLegend.Visibility;  
            if (v.Equals(Visibility.Collapsed)) rChart2.DefaultView.ChartLegend.Visibility = Visibility.Visible;  
 
            Orientation o = rChart2.DefaultView.ChartArea.Legend.ItemsPanelOrientation;  
            if (o.Equals(Orientation.Horizontal)) rChart2.DefaultView.ChartArea.Legend.ItemsPanelOrientation = Orientation.Vertical;  
            else rChart2.DefaultView.ChartArea.Legend.ItemsPanelOrientation = Orientation.Horizontal;  
        } 

 
ChartData is a separate class file with two automatic properties: Name and Value

1 Answer, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 29 Jun 2010, 01:46 PM
Hello Nuno,

Thanks for the details. I was able to reproduce the issue and I have notified our developers of it. The fix will be available in the next version of the control. I have updated your Telerik points.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Nuno Ferreira
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or