SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0
0

I want to modify the format of XAxis Label of example “MultiPaneStockCharts”, so I do this:

<s:SciStockChart.XAxisStyle>
                            <Style TargetType="s:CategoryDateTimeAxis">

                                <!--added the format here, but does not work-->
                                <Setter Property="TextFormatting" Value="yyyy-MM-dd"/>

                                <Setter Property="DrawMajorBands" Value="True" />
                                <Setter Property="DrawMinorGridLines" Value="False" />
                                <Setter Property="VisibleRange" Value="{Binding ParentViewModel.XVisibleRange, Mode=TwoWay}" />
                                <Setter Property="GrowBy" Value="0, 0.05" />
                            </Style>
                        </s:SciStockChart.XAxisStyle>

But the format of the XAxis labels are not modified as I want it. It seems that something inside the example is preventing format setting, since in different zoom rate the label format is changing.

How can I modify the format?

Thank you.

Version
v5
  • You must to post comments
0
0

There is a property on CategoryDateTimeAxis called SubDayTextFormatting. You need to set this as well, as it will choose SubDayTextFormatting when the chart is zoomed in to less than one day.

For advanced text formatting and full customisation, please also see the LabelProvider feature. You will need to use a CategoryLabelProvider to format labels for the CategoryDateTimeAxis.

Let me know if this helps,

Best regards,
Andrew

  • You must to post comments
0
0

I’ve tried SubDayTextFormatting, still not working.

Either the LabelProvider way. It seems that it is a CategoryDateTimeAxis, not a DateTimeAxis, and will not accept a DateTimeLabelProvider, saying :

“System.InvalidOperationException
HResult=0x80131509
Message=The DateTimeLabelFormatter is only valid on instances of DateTimeAxis
…”

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.