strechted axis labels

2 posts, 0 answers
  1. Markus
    Markus avatar
    1 posts
    Member since:
    Oct 2015

    Posted 19 Oct 2015 Link to this post

    Hi,

    is it possible to stretch the labels of an categorical axis? I want to create an axis like shown in the goal.jpg

    I tried the following code to recived the wished layout:

    <telerik:CategoricalAxis TickThickness="0" GapLength="0.1">
      <telerik:CategoricalAxis.LabelTemplate>
        <DataTemplate>
          <StackPanel HorizontalAlignment="Stretch">
            <Border BorderBrush="Black" BorderThickness="1,1,1,0">
              <TextBlock Text="{Binding}"/>
            </Border>
            <Border BorderBrush="Black" BorderThickness="1">
              <TextBlock Text="{Binding Text2}"/>
            </Border>
          </StackPanel>
        </DataTemplate>
      </telerik:CategoricalAxis.LabelTemplate>
    </telerik:CategoricalAxis>

    But the label does not stretched it still fit ti it contents like shown in StretchedLabelResult.jpg

     Does anyone have an idea how to recive the wished layout?

  2. Dinko
    Admin
    Dinko avatar
    201 posts

    Posted 22 Oct 2015 Link to this post

    Hello Markus,

    The RadChartView doesn't support this kind of behavior. However, you can achieve this using custom code. One way to go is to use a Canvas element positioned under the chart's axis and populate it with UI elements which represent the labels. You can position the custom labels with the help of the Conversion API of RadChartView. For your convenience I prepared sample project demonstrating this approach. Note that this is custom solution and I cannot guarantee that it will work in all expected scenarios. This is why I recommend you to test it properly before use it in production code.

    I hope this is a good starting point for your implementation. If you have any further questions don't hesitate to contact us again.

    Regards,
    Dinko
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top