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

How to I format Globalized Date Time label on a DateTimeContinuousAxis?

1 Answer 271 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mahender
Top achievements
Rank 1
Mahender asked on 13 Dec 2012, 10:14 PM
Hi, 
I am using below xaml definition to draw the chart with DateTime on x-axis. Below I specified my datetime format as (H:mm \n dd-MMM). How do i make it true globalized datetime format depending on my OS locale (eg: da-DK, es-ES, ja-JP)?

My current xaml displays: 

15:30
12-JAN

Is there any way to specify datetime format where I can simply get the system locale style datetime values? Please note, I would need newline between time and date to not clutter my axis labels.

Is there any example to localize the charts? I see if there is no data to plot the chart, default text is in english.

Is it possible to use any format specifiers specified here in XAML?


<telerikChart:RadCartesianChart  x:Name="radChart" Margin="0,0,19,51">
                <telerikChart:RadCartesianChart.Grid>
                    <telerikChart:CartesianChartGrid MajorLinesVisibility="Y" TextOptions.TextHintingMode="Animated"/>
                </telerikChart:RadCartesianChart.Grid>
                <telerikChart:RadCartesianChart.Behaviors>
                    <telerikChart:ChartPanAndZoomBehavior ZoomMode="Horizontal" PanMode="Horizontal"/>
                    <telerikChart:ChartTrackBallBehavior ShowTrackInfo="True" ShowIntersectionPoints="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated_1"/>
                </telerikChart:RadCartesianChart.Behaviors>
                <telerikChart:RadCartesianChart.HorizontalAxis >
                    <telerikChart:DateTimeContinuousAxis 
                        LabelFormat="H:mm&#x000A;dd-MMM" 
                        LabelInterval="6" 
                        LabelFitMode="MultiLine" 
                        ZIndex="1">
                        <telerikChart:DateTimeContinuousAxis.MajorTickStyle>
                            <Style TargetType="Rectangle">
                                <Setter Property="Fill" Value="#666666"/>
                                <Setter Property="Margin" Value="0, -3, 0, 0"/>
                            </Style>
                        </telerikChart:DateTimeContinuousAxis.MajorTickStyle>
                    </telerikChart:DateTimeContinuousAxis>
                </telerikChart:RadCartesianChart.HorizontalAxis>
                <telerikChart:RadCartesianChart.VerticalAxis>
                    <telerikChart:LinearAxis
                    LineStroke="Transparent"
                    Maximum="100"  >
 
                    </telerikChart:LinearAxis>
                </telerikChart:RadCartesianChart.VerticalAxis>
                <telerikChart:AreaSeries CombineMode="Stack" Fill="{StaticResource PhoneAccentBrush}">
                    <telerikChart:AreaSeries.TrackBallTemplate>
                        <DataTemplate>
                            <Ellipse Width="12" Height="12" Fill="{StaticResource Series1Brush}"/>
                        </DataTemplate>
                    </telerikChart:AreaSeries.TrackBallTemplate>
                </telerikChart:AreaSeries>
            </telerikChart:RadCartesianChart>

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 19 Dec 2012, 09:59 AM
Hi Mahender,

Thanks for writing.
You can use the standard format specifiers in XAML, there should be no problem. Without any format specifiers, the dates and times will be displayed according to the system settings.

In order to split the dates and times on separate lines, please use the LabelTemplate property. Inside the label template you can specify a text block and bind its Text property to the data context of the template. This binding can use a value converter in which you can split the string in two lines.

Please read this help article in order to understand how to localize our controls including the chart.

Please write again if you have other questions.

All the best,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart
Asked by
Mahender
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or