RadChartLabels

7 posts, 0 answers
  1. Phani Kumar
    Phani Kumar avatar
    23 posts
    Member since:
    Jul 2012

    Posted 10 Jul 2013 Link to this post

    Hi,

     A RadChart is used in one of the projects, the Labels in the chart are always shown in different positions. Though the values for various (2)categories are same the positions of the labels are different.(Attached picture Sample3)

    Is there a way to control the position of the Label. Please let me know for any workarounds.

    Thank you,
    Phani.
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 15 Jul 2013 Link to this post

    Hi Phani,

    What you are observing is most probably caused by the SmartLabels feature. When two or more labels are very close to each other or are overlapping RadChart tries to rearrange them so they will not overlap. You can turn this feature off like this: 
    radChart1.DefaultView.ChartArea.SmartLabelsEnabled = false;

    I hope this helps.

    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Phani Kumar
    Phani Kumar avatar
    23 posts
    Member since:
    Jul 2012

    Posted 15 Jul 2013 Link to this post

    Hi Petar,

    Thank you for your response.
    Followed the below suggestion and testing the changes, in one scenario a chart label is not appearing. Please find the screen print of the scenario attached.

    Please let me know if there any way to handle this.

    Best Regards,
    Phani.
  5. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 18 Jul 2013 Link to this post

    Hi Phani,

    Another thing that you can try besides turning off the SmartLabels feature, is to set LabelDisplayMode of the series to inside, like this:
    <telerik:BarSeriesDefinition>
        <telerik:BarSeriesDefinition.LabelSettings>
            <telerik:BarLabelSettings LabelDisplayMode="Inside"/>
        </telerik:BarSeriesDefinition.LabelSettings>
    </telerik:BarSeriesDefinition>

     Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Phani Kumar
    Phani Kumar avatar
    23 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2013 Link to this post

    Hi Petar,

    Thank you for the below suggestion. Tried the below LabelDisplayMode="Inside" option and the label still disappears when the value is low or zero. Please find the sample printout attached.

    Please let me know for any other settings that could be used to handle this scenario.

    Thank you,
    Phani.
  7. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 23 Jul 2013 Link to this post

    Hi Phani,

    After reviewing our conversation again, I came to the conclusion that actually the SmartLabels feature should work best for you. Most likely you have set somewhere in your code a Margin to the SeriesItemLabels and that is why the labels in Sample3.png re-arranged earlier, than it is needed.

    If you want to have more control when using the SmartLabels feature, you can change the label template.
    In the following example you can adjust the threshold before adjacent labels are rearranged by adjusting the value of the highlighted properties:
    <Style x:Key="SeriesItemLabelStyle" TargetType="telerik:SeriesItemLabel">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="telerik:SeriesItemLabel">
            <Canvas x:Name="PART_MainContainer" Width="0" Height="0">
              <Path x:Name="PART_ConnectorPath"
                    Visibility="{Binding ConnectorVisibility,
                  RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                    Style="{TemplateBinding ConnectorStyle}"
                    Stroke="{TemplateBinding Stroke}"
                    StrokeThickness="{TemplateBinding StrokeThickness}">
                  <Path.Data>
                      <PathGeometry >
                          <PathGeometry.Figures>
                              <PathFigure x:Name="PART_Connector">
                                  <PathFigure.Segments>
                                      <PolyLineSegment />
                                  </PathFigure.Segments>
                              </PathFigure>
                          </PathGeometry.Figures>
                      </PathGeometry>
                  </Path.Data>
              </Path>
              <Border x:Name="PART_TextContainer" Width="15" Height="7" />
              <TextBlock Width="200" Height="16" Margin="-100 -8 0 0"
                 TextAlignment="Center" Text="{TemplateBinding Content}" />
            </Canvas>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    (You can apply this style by setting it to the SeriesItemLabelStyle property of the SeriesDefinition.)

    I hope this helps.
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Phani Kumar
    Phani Kumar avatar
    23 posts
    Member since:
    Jul 2012

    Posted 23 Jul 2013 Link to this post

        
        Hi Petar,
        
        Applied the below provided style with the Smart Labels feature enabled and seem to have resolved the issue.

        Thank you & Regards,
        Phani.
Back to Top
UI for WPF is Visual Studio 2017 Ready