Bubble chart - visual glitch

4 posts, 1 answers
  1. Trude
    Trude avatar
    222 posts
    Member since:
    Jun 2009

    Posted 07 Jul 2010 Link to this post

    Please see the attached image. Bubble chart to the left and line to the right. The bubble chart has an offset from the y-axis to the zero value on the x-axis and it looks out of place. Here's the XAML:
    <telerik:RadChart x:Name="Bubble" Width="160" Height="160" VerticalAlignment="Center" Margin="20,0,0,0" Visibility="Collapsed">  
        <telerik:RadChart.SeriesMappings> 
            <telerik:SeriesMapping> 
                <telerik:SeriesMapping.SeriesDefinition> 
                    <telerik:LineSeriesDefinition/> 
                </telerik:SeriesMapping.SeriesDefinition> 
                <telerik:SeriesMapping.ItemMappings> 
                    <telerik:ItemMapping DataPointMember="XValue" FieldName="value_0.value"/>  
                    <telerik:ItemMapping DataPointMember="YValue" FieldName="value_1.value"/>  
                </telerik:SeriesMapping.ItemMappings> 
            </telerik:SeriesMapping> 
        </telerik:RadChart.SeriesMappings> 
    </telerik:RadChart> 

    Code behind:
            Bubble.DefaultView.ChartArea.AxisX.AutoRange = False 
            Bubble.DefaultView.ChartArea.AxisX.MaxValue = 6  
            Bubble.DefaultView.ChartArea.AxisX.MinValue = 0  
            Bubble.DefaultView.ChartArea.AxisX.AddRange(0, 6, 1)  
            Bubble.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible  
            Bubble.DefaultView.ChartArea.AxisY.AutoRange = False 
            Bubble.DefaultView.ChartArea.AxisY.MaxValue = 6  
            Bubble.DefaultView.ChartArea.AxisY.MinValue = 0  
            Bubble.DefaultView.ChartArea.AxisY.AddRange(0, 6, 1)  
            Bubble.DefaultView.ChartArea.AxisY.StripLinesVisibility = Visibility.Collapsed  
            Bubble.DefaultView.ChartArea.AxisY.MinorTicksVisibility = Visibility.Collapsed  
            Bubble.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible  
            Bubble.DefaultView.ChartArea.PlotAreaStyle = LayoutRoot.Resources("ClipPanelStyle")  
            Bubble.DefaultView.ChartArea.Legend.Visibility = Visibility.Collapsed  
            Bubble.DefaultView.ChartArea.EnableAnimations = False 
            Bubble.DefaultView.ChartArea.EnableStripLinesAnimation = False 
            Bubble.Background = Nothing 
            Bubble.ItemsSource = ds_chart 

    Also is there a way to only show axis title and hide all values and ticklines (major and minor)??? I can't figure it out.

  2. Answer
    Sia
    Admin
    Sia avatar
    746 posts

    Posted 13 Jul 2010 Link to this post

    Hello Jorn,

    Have you tried settiing the LayoutMode property for your RadChart? You can find more information about it in our help section.

    Regarding your second question, you need to have the following resources:
    xmlns:charting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting">
    <UserControl.Resources>
        <Style x:Key="CustomAxisX" TargetType="charting:AxisX2D" >
            <Setter Property="AxisLabelsVisibility" Value="Collapsed" />
            <Setter Property="AxisTicksVisibility" Value="Collapsed" />
        </Style>
        <Style x:Key="CustomAxisY" TargetType="charting:AxisY2D" >
            <Setter Property="AxisLabelsVisibility" Value="Collapsed" />
            <Setter Property="AxisTicksVisibility" Value="Collapsed" />
        </Style>
    </UserControl.Resources>

    and set them in your code-behind:
    //Hides the MinorTicks
    RadChart1.DefaultView.ChartArea.AxisY.MinorTicksVisibility = Visibility.Collapsed;
     
    //Hides the GridLines and the StripLines which are visible by default
    RadChart1.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Collapsed;
    RadChart1.DefaultView.ChartArea.AxisY.StripLinesVisibility = Visibility.Collapsed;
     
    //Hides the Labels and the MajorTicks
    RadChart1.DefaultView.ChartArea.AxisXStyle = this.Resources["CustomAxisX"] as Style;
    RadChart1.DefaultView.ChartArea.AxisYStyle = this.Resources["CustomAxisY"] as Style;
     
    //Titles
    RadChart1.DefaultView.ChartArea.AxisX.Title = "AxisX Title";
    RadChart1.DefaultView.ChartArea.AxisY.Title = "AxisY Title";

    where RadChart1 is the name of the RadChart ( in your case it is Bubble).

    Regards,
    Sia
    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
  3. Trude
    Trude avatar
    222 posts
    Member since:
    Jun 2009

    Posted 18 Aug 2010 Link to this post

    Telerik should consider making it easier to hide/show certain basic elements on a chart, like ShowValues, ShowTicks (True/False) etc.

    Anyway, thanks for the workaround regarding my second question. I will also check out the layoutmode documentation.

  4. Sia
    Admin
    Sia avatar
    746 posts

    Posted 18 Aug 2010 Link to this post

    Hi Jorn,

    We have it in mind and such API will be introduced in the near future.

    Best wishes,
    Sia
    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
Back to Top