Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am trying to plot a graph with a LineSeries having x-axis as DateTimeAxis and y-axis as LinearAxis.


I have to display my x-axis (DateTimeAxis) in the format of mm:ss (i.e, in the minutes and seconds only). Here i dont want to display the hours part of the DateTime object bbut i want to add the hours part to the minutes part and display on the graph.
i.e,
i am creating the x-axis datapoints from the list of points (read from csv file)
Then i am constructing the DataTime object and converting the point reads from csv file to the DateTime format.

t = TimeSpan.FromSeconds(Convert.ToDouble(Points[index]));
date = new DateTime(2010, 8, 18, t.Hours, t.Minutes, t.Seconds);

(date i am assuming some dummy date and Points[index] gives me the point read from the csv file at that particular index)

Now, i want to add the hours part to the minutes part and show only Minutes and seconds.i.e, if the time is 3hours 2minutes and 8 sec i want to represent as 182:08 on the x-axis

I am trying with following xaml code but couldnot succeed

<chartingToolkit:DateTimeAxis Name="xAxis_chtVelocity" Orientation="X" ShowGridLines="False">
<chartingToolkit:DateTimeAxis.AxisLabelStyle>
<Style TargetType="{x:Type chartingToolkit:AxisLabel}">
<Setter Property="StringFormat" Value="{}{0:mm:ss}"/>
<!--<Setter Property="RenderTransformOrigin" Value="1,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="-45" />
</Setter.Value>
</Setter>-->
</Style>
</chartingToolkit:DateTimeAxis.AxisLabelStyle>
Please help me out.
Thanks in Advance.
Posted
Updated 9-Feb-15 0:06am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900