Crash when putting a chart area in scrollviewer

3 posts, 0 answers
  1. Gilberto
    Gilberto avatar
    6 posts
    Member since:
    Apr 2009

    Posted 10 May 2009 Link to this post

    i have been running into a crash when i attempt to put the chart area into a scrollviewer.  I am trying to get it so that i can display all the information on the x Axis without it ending up all smashed togther.  Here is the code i am using  Also is there any option that allow you to control the spacing of the X axis so that the information is not smashed together if a lot of info is present? Or a scroll bar option already available?

    XAML
    <UserControl x:Class="ChartTheme.Page" 
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 xmlns:control="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting" 
                 xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting" 
                 xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
                 Width="1024" 
                 Height="768">  
     
        <Grid x:Name="LayoutRoot" 
              Background="White">  
            <control:RadChart  x:Name="RadChart1" 
                               VerticalAlignment="Stretch" 
                               HorizontalAlignment="Stretch" 
                               UseDefaultLayout="False" 
                               Background="Transparent">  
                <Grid> 
                    <Grid.RowDefinitions> 
                        <RowDefinition Height="10" /> 
                        <RowDefinition Height="*" /> 
                    </Grid.RowDefinitions> 
                    <Grid.ColumnDefinitions> 
                        <ColumnDefinition Width="*" /> 
                        <ColumnDefinition Width="Auto" 
                                          MinWidth="104" /> 
                    </Grid.ColumnDefinitions> 
     
                    <chart:ChartLegend x:Name="RadChartLegend" 
                                       Header="Temperatures" 
                                       Visibility="Visible" 
                                       Background="Aqua" 
                                       Grid.Column="1" 
                                       Grid.Row="1" 
                                       Padding="-10, 20, 20, 30" 
                                       Margin="0,0,0,0" 
                                       HorizontalAlignment="Stretch" 
                                       VerticalAlignment="Stretch" /> 
                    <ScrollViewer Grid.Row="1">  
     
                        <chart:ChartArea x:Name="RadChart2" 
                                         LegendName="RadChartLegend" 
                                         Background="#FFFFFFFF" 
                                         Height="Auto" 
                                         Width="Auto" 
                                         DimensionMode="Strict2D" 
                                         ItemWidthPercent="90" 
                                         HorizontalContentAlignment="Center" 
                                         UseLayoutRounding="True" 
                                       /> 
     
                    </ScrollViewer> 
     
                </Grid> 
            </control:RadChart> 
        </Grid> 
    </UserControl> 
     

    codebehind
    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 ChartTheme  
    {  
        public partial class Page : UserControl  
        {  
            public Page()  
            {  
                InitializeComponent();  
     
                Loaded += new RoutedEventHandler(Page_Loaded);  
            }  
     
     
            private void Page_Loaded(object sender, RoutedEventArgs e)  
            {  
                DataSeries barSeries = new DataSeries();  
                barSeries.Definition = new BarSeriesDefinition();  
                  
                  
                this.FillWithSampleData(barSeries, 100);  
                RadChart2.DataSeries.Clear();  
                RadChart2.AxisY.AutoRange = true;  
                RadChart2.DataSeries.Add(barSeries);  
            }  
            private void FillWithSampleData(DataSeries series, int numberOfItems)  
            {  
                Random random = new Random((int)(series.GetHashCode() + DateTime.Now.Ticks));  
                for(int i = 0; i < numberOfItems; i++)  
                {  
                    int randomNumber = random.Next(30, 100);  
                    series.Add(new DataPoint  
                    {  
                        XValue = randomNumber,  
                        YValue = randomNumber  
                    });  
                }  
            }  
     
        }  
    }  
     
  2. Velin
    Admin
    Velin avatar
    391 posts

    Posted 13 May 2009 Link to this post

    Hi Gilberto,

    Unfortunately, I was able to reproduce the problem and I must confirm there is an unhandled exception when a chart element is contained within a control other than Panel or RadChart . This issue has been already forwarded to our developers and a fix will be provided with the next version of the control.

    Please, accept our apologies for the inconvenience. Your Telerik points have been updated.

    Regards,
    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. Gilberto
    Gilberto avatar
    6 posts
    Member since:
    Apr 2009

    Posted 13 May 2009 Link to this post

    Thank you very much for the responce. I look forward to the next release.
Back to Top