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

Chart Not Showing Bars When using Custom Theme

2 Answers 100 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Chris Hack
Top achievements
Rank 1
Chris Hack asked on 18 Jan 2010, 03:49 PM
This is very easy to duplicate.  Open the Themes folder under the RadControls_for_Silverlight_2009_3_1314_TRIAL install folder and compile all the themes.  Next, create a silverlight project, add the Chart control to the MainPage.xaml.  Reference the dll from any of the compiled themes and set the Theme on the Chart control to use the compiled dll and it will not show the bars on the chart for the data that is bound to it.  Remove the theme or set the control's theme to one of the built in themes and suddenly it starts to show data.  Am I doing anything wrong or is this a bug?  If it is a bug, is there a workaround?

Here is more detail:

<UserControl x:Class="HelloWorld.MyChart" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"   
    xmlns:telerikTheme="clr-namespace:Telerik.Windows.Themes.Windows7;assembly=Telerik.Windows.Themes.Windows7" 
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
> 
    <UserControl.Resources>      
        <telerikTheme:MyTheme x:Key="ChartTheme" Source="/Telerik.Windows.Themes.Windows7;Component/Themes/Telerik.Windows.Controls.Charting.xaml"/>  
    </UserControl.Resources> 
    <Grid x:Name="LayoutRoot">  
        <Grid.RowDefinitions> 
            <RowDefinition /> 
            <RowDefinition /> 
        </Grid.RowDefinitions> 
        <Grid.ColumnDefinitions> 
            <ColumnDefinition/> 
        </Grid.ColumnDefinitions> 
        <telerikCharting:RadChart x:Name="radChartBuiltInTheme" Grid.Row="0" Grid.Column="0" telerik:StyleManager.Theme="Windows7" /> 
        <telerikCharting:RadChart x:Name="radChartCustomTheme" Grid.Row="1" Grid.Column="0" telerik:StyleManager.Theme="{StaticResource ChartTheme}" /> 
    </Grid> 
</UserControl> 

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Net;  
using System.Windows;  
using System.Windows.Controls;  
using System.Windows.Documents;  
using System.Windows.Input;  
using System.Windows.Media;  
using System.Windows.Media.Animation;  
using System.Windows.Shapes;  
using Telerik.Windows.Controls.Charting;  
 
namespace HelloWorld {  
    public partial class MyChart : UserControl {  
        public MyChart() {  
            InitializeComponent();  
 
            Dictionary<DateTime, int> values = new Dictionary<DateTime, int>();  
            values.Add(new DateTime(2006, 12, 31), 425);  
            values.Add(new DateTime(2007, 12, 31), 500);  
            values.Add(new DateTime(2008, 12, 31), 450);  
            values.Add(new DateTime(2009, 12, 31), 400);  
 
            DataSeries series = new DataSeries();  
 
            foreach (var date in values.Keys) {  
                DataPoint point = new DataPoint(values[date]);  
                point.XCategory = date.ToString("yyyy-MM");  
                series.Add(point);  
            }  
            radChartBuiltInTheme.DefaultView.ChartArea.DataSeries.Add(series);  
            radChartCustomTheme.DefaultView.ChartArea.DataSeries.Add(series);  
              
        }  
 
    }  
}  
 
 

In the example above, the chart named radChartBuiltInTheme shows the data, but the one named radChartCustomTheme does not.

Thanks,

Chris

2 Answers, 1 is accepted

Sort by
0
Velin
Telerik team
answered on 21 Jan 2010, 02:25 PM
Hello Chris Hack,

Thank you for reporting this issue to us.

I will forward this to our developers who will further investigate it and will provide a fix with a future release of the control. Unfortunately, we can not suggest a work around at this moment.

Please, accept our apologies for this inconvenience.

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.
0
Sail Sain
Top achievements
Rank 1
answered on 19 Apr 2010, 10:40 AM
Hello Chris Hack


You need to either set EnableAnimation=Flase for the RadChart Or if u need Animation then you need to add Animation StoryBoard in Chart.xaml . If your assembly name ="CustomChartTheme" then key sholud be
<Storyboard BeginTime="00:00:00.5" x:Key="CustomChartAreaSeriesStoryboard" >
Or You can just replace Windows7 Storyboard like  x:Key="Windows7 AreaSeriesStoryboard"  to  with your assembly name but need to subString Theme part like above.

Happy Coding
Sail

Tags
Chart
Asked by
Chris Hack
Top achievements
Rank 1
Answers by
Velin
Telerik team
Sail Sain
Top achievements
Rank 1
Share this question
or