This is a migrated thread and some comments may be shown as answers.

strechted axis labels

1 Answer 104 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 19 Oct 2015, 02:02 PM

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?

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 22 Oct 2015, 12:59 PM
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
Tags
ChartView
Asked by
Markus
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or