08-29-2017 03:03 AM
Hello.
I am using NI Graphs in my WPF application. The graphs are binded to ChartCollection <TimeSpan, double>. Here is my graph XAML code and the picture:
<ni:Graph x:Name="graph_temperatures" PreferIndexData="False" RenderMode="Raster">
<ni:Graph.Axes>
<ni:AxisDateTime Orientation="Horizontal"/>
<ni:AxisDouble Label="Temperature [°C]" Orientation="Vertical" Range="0, 100, System.Double"/>
</ni:Graph.Axes>
</ni:Graph>
And I would like to change default format of datetime axis to be like this: "hh:mm:ss". How can I easily do it please?
Thank you for support.
Jakub
Solved! Go to Solution.
08-29-2017 10:48 AM
You can control the format of the division labels through the LabelPresenter property on the MajorDivisions of the axis. In XAML:
<ni:Graph x:Name="graph_temperatures" PreferIndexData="False" RenderMode="Raster">
<ni:Graph.Axes>
<ni:AxisDateTime Orientation="Horizontal">
<ni:AxisDateTime.MajorDivisions>
<ni:RangeLabeledDivisions LabelPresenter="hh:mm:ss" />
</ni:AxisDateTime.MajorDivisions>
</ni:AxisDateTime>
<ni:AxisDouble Label="Temperature [°C]" Orientation="Vertical" Range="0, 100, System.Double"/>
</ni:Graph.Axes>
</ni:Graph>
08-30-2017 03:01 AM - edited 08-30-2017 03:02 AM
It works. Thank you very much for quick help.