Pre loader

X-Axis resizing w/o ResumeUpdates

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I’m working on a Fifo series chart that fills up to its capacity, then calls xaxis.SuspendUpdates() to freeze the labels, then the line scrolls by – the view is of the last x seconds of data.

When SuspendUpdates has been called, then I maximize the app, the x-axis doesn’t resize properly, which is not really surprising. If I do a quick ResumeUpdates, then SuspendUpdates again, the label numbers have changed to the most recent values – also expected. So, how can I tell a suspended x-axis to refresh/redraw/resize the axis to properly fill, but not ResumeUpdates?

Images
  • You must to post comments
0
0

Oh I see, so you want to display the X-Axis with T-0, T-1, T-2, T-4 at all times, regardless of the values of the series, is that right?

There isn’t a way to achieve this easily, however there may be some workarounds.

One option is to research the LabelFormatter class, which is demonstrated in this tutorial: Screenshots XPS Printing and XAxis Text Labels. The LabelFormatter method requires that you write a class that derives from ILabelFormatter and apply to XAxis.LabelFormatter. This class is called to generate text labels.

For instance, if the ILabelFormatter derived type knew the latest time in the Time-Series, it could output text labels which are relative to it, e.g. instead of 10:02:00, 10:02:01, 10:02:02 etc… it could output -0.0s, -1.0s, -2.0s, -3.0s. The only problem is the grid lines would continue to scroll, they would not remain fixed so the axis labels, while showing relative times, would not show exactly 0, -1, -2, -3.

Another workaround idea is to hide your XAxis and place another chart immediately below the top one with an X and Y Axis, hide the YAxis and show the XAxis. Add to that a visible range of -4, 0 and set AutoTicks=false, MajorDelta=1, MinorDelta = 0.5.

Here is some pseudo-code to get you started:

<Grid>
   <!-- This is your main chart, with a hidden XAxis -->
   <s:SciChartSurface x:Name="mainChart" Background="Transparent">
       <s:SciChartSurface.XAxis>
             <!-- on the main chart, hide the XAxis -->
            <s:DateTimeAxis DrawLabels="False" DrawMajorGridLines="False" 
                                       DrawMinorGridLines="False" DrawMajorTicks="False" 
                                       DrawMinorTicks="False"/>
       </s:SciChartSUrface.XAxis>
   </s:SciChartSurface>

    <!-- This is your secondary chart, which is underneath the main chart -->
    <s:SciChartSurface x:Name="dummyChart">
       <s:SciChartSurface.YAxis>
            <!-- YAxis is required so the chart draws -->
            <s:NumericAxis VisibleRange="0, 1" Visibility="Collapsed"/>
       </s:SciChartSUrface.YAxis>
       <s:SciChartSurface.XAxis>
             <!-- on the dummy chart, show your axis labels-->
            <s:NumericAxis VisibleRange="-4.0, 0"/>
       </s:SciChartSUrface.XAxis>
   </s:SciChartSurface>
</Grid>


It’s not a perfect example but should demonstrate what I mean – if you overlay one chart with another, and use the second to display your XAxis gridlines, it could work!

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies