Overlapping labels and go off the screen

6 posts, 0 answers
  1. Nikolay Velizhanin
    Nikolay Velizhanin avatar
    13 posts
    Member since:
    Feb 2010

    Posted 05 Dec 2010 Link to this post

    Overlapping labels and go off the screen. How to fix this ?


    ChrtbottomHole.DefaultView.ChartArea.EnableAnimations = false;
    chrtbottomHole.DefaultView.ChartArea.EnableTransitionAnimations = true;
    chrtbottomHole.DefaultView.ChartArea.SmartLabelsEnabled = true;

    chrtbottomHole.DefaultView.ChartArea.AxisX.AutoRange = true;
    chrtbottomHole.DefaultView.ChartArea.AxisX.Title = "Сутки";
    chrtbottomHole.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
    chrtbottomHole.DefaultView.ChartArea.AxisX.LayoutMode =AxisLayoutMode.Between;
    chrtbottomHole.DefaultView.ChartArea.AxisY.AutoRange = true;
    chrtbottomHole.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
    chrtbottomHole.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;
    chrtbottomHole.DefaultView.ChartArea.AxisY.Title = "Глубина скважины, м";
    chrtbottomHole.DefaultView.ChartArea.AxisY.IsZeroBased = true;

    // три строчки, чтобы значения шли вниз
    chrtbottomHole.ItemDataBound += chrtbottomHole_ItemDataBound;

    chrtbottomHole.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "#VAL{##;##;0}";
    chrtbottomHole.DefaultSeriesDefinition.ItemLabelFormat = "#Y{##;##;0}";



    LineSeriesDefinition lineDefinition = new LineSeriesDefinition
    {

    ShowItemLabels = true,
    ShowPointMarks = false,
    LabelSettings = {ShowConnectors = true},
    ShowItemToolTips = true,
    ItemToolTipFormat = "Сутки-#X Глубина#Y"
    };


    SeriesMapping temperatureMapping = new SeriesMapping {SeriesDefinition = lineDefinition};
    temperatureMapping.SeriesDefinition.SeriesItemLabelStyle = Resources["BarLabelStyle"] as Style;
    temperatureMapping.SeriesDefinition.Appearance.Foreground = new SolidColorBrush(Colors.Black);

    temperatureMapping.ItemMappings.Add(new ItemMapping("Argument", DataPointMember.Xvalue));


    ItemMapping yItemMapping = new ItemMapping("Value", DataPointMember.Yvalue);

    temperatureMapping.ItemMappings.Add(yItemMapping);
    temperatureMapping.LegendLabel = "Фактический график строительства";
    chrtbottomHole.SeriesMappings.Add(temperatureMapping);
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 09 Dec 2010 Link to this post

    Hello Nikolay,

    As I saw from your XAML snippet you are setting:
    temperatureMapping.SeriesDefinition.SeriesItemLabelStyle = Resources["BarLabelStyle"] as Style;
    Could you send us the Style (x:Key = "BarLabelStyle") that you are setting?

    Also try what will happen if you change the Distance property of the Labelsettings as shown in our help topic - http://www.telerik.com/help/silverlight/radchart-features-smart-labels.html#Configure_the_Smart_Labels_feature.

    Regards,
    Evgenia
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. Nikolay Velizhanin
    Nikolay Velizhanin avatar
    13 posts
    Member since:
    Feb 2010

    Posted 10 Dec 2010 Link to this post

    <Style x:Key="BarLabelStyle" TargetType="telerik:SeriesItemLabel" >
    <Setter Property="Template" >
    <Setter.Value>
    <ControlTemplate TargetType="telerik:SeriesItemLabel" >
    <Canvas>
    <Polyline x:Name="PART_Connector"
    Points="{TemplateBinding ConnectorPoints}"
    Visibility="{Binding Converter={StaticResource LabelVisibilityConverter1}}"
    Style="{TemplateBinding ConnectorStyle}"
    Stroke="{TemplateBinding Stroke}"
    StrokeThickness="{TemplateBinding StrokeThickness}" />
    <Border x:Name="PART_TextContainer"

    Background="{TemplateBinding Background}"
    BorderThickness="1"
    BorderBrush="Black"
    Visibility="{Binding Converter={StaticResource LabelVisibilityConverter1}}" >
    <TextBlock
    TextAlignment="{TemplateBinding HorizontalContentAlignment}"
    Margin="{TemplateBinding Padding}"
    Text="{Binding DataItem.WorkType}"
    TextWrapping="Wrap" />
    </Border>
    </Canvas>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
  4. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 14 Dec 2010 Link to this post

    Hi Nikolay,

    Should I assume that the issue you were facing is now resolved as you have marked as answer my post?

    Greetings,
    Evgenia
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  5. Nikolay Velizhanin
    Nikolay Velizhanin avatar
    13 posts
    Member since:
    Feb 2010

    Posted 14 Dec 2010 Link to this post

    No. Issue is not resolved.
  6. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 16 Dec 2010 Link to this post

    Hello Nikolay ,

    To be able to have clearer visualization of Smart Labels (without overlapping) try to position the Line Series as far as possible from the left-most and right-most sides of the ChartArea. You can achieve this by setting different range for the XAxis (different MinValue and MaxValue) and more specially set bigger Step for it . To do it turn off AutoRange property of the Axis.
    Setting a bigger step for the XAxis will be very helpful as I saw that you have points that are with very close values. That causes their Labels to overlap. If you don't want to change the axis range then remove one of the labels for those points that are very close to one another.
    I hope this suggestion helps.

    Greetings,
    Evgenia
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top