Pre loader

Custom Axis LabelProvider question

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 would like to implement a custom DateTime axis LabelProvider with the following behavior:

  • Show full date and time at the start of the visible region
  • Show only time on all other ticks unless the date changes from the previous tick.

So, an axis might look like:

10/01/2016 23:00 23:30 10/02 00:00 00:30 01:00

It seems this is doable as long as 00:00:00 appears as one of the label values, but I’m not sure l can be guaranteed. It is likely that none of the entries in the series would contain that exact value. One entry might be 23:59:17 and the next 00:01:13.

Is there any way for a LabelProvider to determine what the preceding label value was?

Bill

Version
4.1
  • You must to post comments
0
0

That worked! Thanks.

  • You must to post comments
0
0

Yuriy,
This worked great. Thank you.
One more question. Is there a recommended way to force a regeneration of axis labels, other than changing its visible range?. The scaling on my axis depends on an external value . When that value changes, I would like to regenerate the axis labels. I’ve tried nudging the visible range min value up and down, but it seems the labels are not regenerated unless I move the range far enough to be noticeable on screen.
Bill

  • Andrew Burnett-Thompson
    Hi Bill, you can try sciChartSurface.InvalidateElement() to force a redraw. Best regards, Andrew
  • You must to post comments
1
0

Hi Bill,

Thanks for your inquiry. The FormatLabel() method is called for every axis label which is going to appear on an axis. So yes, it is possible to implement your desired behavior. Just store a previous date and compare it with current one.

The documentation article on LabelProviders can be found here.

Hope this helps!

Best regards,
Yuriy

  • You must to post comments
Showing 3 results
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