Chart Not Showing Bars When using Custom Theme

3 posts, 0 answers
  1. Chris Hack
    Chris Hack avatar
    9 posts
    Member since:
    Aug 2012

    Posted 18 Jan 2010 Link to this post

    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. Velin
    Admin
    Velin avatar
    391 posts

    Posted 21 Jan 2010 Link to this post

    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.
  3. Sail Sain
    Sail Sain avatar
    2 posts
    Member since:
    Apr 2010

    Posted 19 Apr 2010 Link to this post

    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

Back to Top