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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

Hi all,

I’m developing an app which receives and displays 100’s of samples per second similar to what you would see with the FIFO tutorial. Instead of the sample number, 1000, 1001, etc., I’d like to show seconds so far instead of the sample number.

For example, at sample 1000 display 10, from 1001 to 1099 display nothing, at 1100 display 11, etc. Something simple like sampleNum/100. Can you give me a hint where to start looking to change the behavior of the (major?) tick markings? Do I do something with the NumericAxis class?

Thank you for pointers.

Ed

Version
Unsure, but recent. Do not believe the question is release specific
  • You must to post comments
0
0

Hi Ed,

Thanks for your inquiry.

First of all to achieve desired output you’ll need to customize tick generation to produce ticks after every 100 samples. To do this you can use MajorDelta property provided by axis ( set it to 100 so major ticks will be generated every 100 points ). If you need more information then we have a tutorial which shows how to adjust axis scale.

After altering tick generation you’ll need to create a custom LabelProvider which will divide each data value (major tick) by 100 and then will convert it to a string which will be displayed as axis tick label:

  class CustomNumericLabelFormatter extends SimpleNumericLabelFormatter<NumericAxis>{
        @Override
        public CharSequence formatLabel(Comparable dataValue) {
            dataValue = ComparableUtil.toDouble(dataValue) / 100;
            return super.formatLabel(dataValue);
        }

        @Override
        public CharSequence formatCursorLabel(Comparable dataValue) {
            dataValue = ComparableUtil.toDouble(dataValue) / 100;
            return super.formatCursorLabel(dataValue);
        }
    } 

  xAxis.setLabelProvider(new NumericLabelProvider(new CustomNumericLabelFormatter()));

Another solution which came into my mind – just try to divide xValues by 100 before adding them into data series. I believe in this case you won’t need to customize xAxis because values which are stored in data series will be already in seconds.

Hope this will help you!

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.