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

RadCartesianChart: Labeltemplate on a DateTimeContinuousAxis: location is wrong

1 Answer 119 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jan asked on 29 Nov 2016, 07:18 AM

I am trying to use a Labeltemplate on a DateTimeContinuousAxis but the texts are not located correctly on the axis. I am using the following WPF:

    <telerik:DateTimeContinuousAxis MajorStep="{Binding CategoryAxisMajorStep}"
                                    MajorStepUnit="{Binding CategoryAxisMajorStepUnit}"
                        <MultiBinding Converter="{StaticResource DateTimeToStringTelerikChartMultiConverter}">
                            <Binding Path="DataContext.DateTimeFormat"
                                RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}"/>

The chart looks as the attached file.

Can you help me to correctly display the labels.



1 Answer, 1 is accepted

Sort by
Martin Ivanov
Telerik team
answered on 01 Dec 2016, 05:23 PM
Hi Jan,

This behavior appears because the chart caches the size of the axis labels in order to optimize the performance. Basically, the labels are measured on load of the chart and their sizes are stored in memory. The multibinding kicks in after this measuring and the labels are already measured with size 0,0. As the chart arranges it elements in a canvas and the size is empty, the labels are not positioned where expected.

In order to resolve this you can try ElementName bindin instead of RelativeSource binding in the multibinding. Or you can set MinHeight of the TextBlock in the LabelTemplate so that the size of the labels is ensured.

Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Asked by
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question