Pre loader

[iOS] Y-Axis scaling for very small values

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

Answered
0
0

Hi,

I’ve been looking through ways to have to y-Axis scale for really small changes/values.

For example, I’m attempting to plot 10 values between 0.99300 to 0.99400, and the changes between points can vary between 0.001 to 0.0001 or so (basically, really small changes)

However, my y-Axis seems to always start at 0 and the y-Axis major ticks are always at most a 0.1 difference, making the graph look flat.

I’d like to achieve the following:
– Scale to the smallest value i can scale to.
– Have my y-Axis to not necessarily start at 0.

I’ve tried the following:

Setting up y-Axis:

    self.yAxis = [SCINumericAxis new];
    [self.yAxis setStyle:axisStyle];
    self.yAxis.axisId = @"yAxis";
    [self.yAxis setGrowBy:[[SCIDoubleRange alloc]initWithMin:SCIGeneric(0) Max:SCIGeneric(0.1)]];
    [self.yAxis setAutoRange:SCIAutoRange_Always];
    [self.chartSurface attachAxis:self.yAxis IsXAxis:NO];

Regards.

Version
1.2.3.928
  • You must to post comments
Best Answer
1
1

Good day

If I get it right you need not axis scale but Y auto range for mountains the same as for line series. We changed mountain series so it is default behaviour now.
Please try downloading our latest build at the link
http://scichart.com/Downloads/iOS/v1.2/SciChart_iOS_v1.2.4.1045_SDK.zip

Best regards
Andrii
SciChart iOS Developer

  • Develle Yong
    Hi Andrii, Apologies for not getting back to you for about 2 months, something urgent came up and I could only get around to this now. The new build works and the graph now draws as expected! Thank you so much! Regards
  • You must to post comments
0
0

Hi Develle,

It’s probably text formatting making the individual Gridlines/Labels appear as 0, 0, 0, 0, 0.

Take a look at the following: iOS Chart Axis Labels: Text Formatting

I believe text formatting obeys standard NSString Format Specifiers. If you try changing it to a value to display several decimal places you should see the labels subdivided as 0.00, 0.02, 0.04, 0.06, 0.08, 0.10 etc…

Let me know if this helps,

Best regards,
Andrew

  • You must to post comments
0
0

Hi Andrew,

The points do show more decimal points using text formatting but it still remains the same interval (0.000, 0.100, 0.200, 0.300, 0.400, 0.500). It doesn’t drill down to smaller intervals.

I am using a SCIFastMountainRenderableSeries for the drawing of the chart. I was wondering if this affects anything? When drawing the mountain chart, is it always a must to display point 0?

Regards.

  • You must to post comments
0
0

Hi Andrew,

I’ve attached two images for the comparison.

The scaling am trying to achieve is represented by the one with the line graph while the one which am having is the one with the mountain graph. I think it might be caused by the mountain graph always extending to 0? (I am not too sure about this)
If so, is there a way to have the line graph sort of y-axis scaling on the mountain graph?

Regards.

Images
  • Andrew Burnett-Thompson
    Aha thank you! That makes it clear. In that case can you try setCursorTextFormatting() on the Axis please?
  • You must to post comments
0
0

Hi Andrew,

I tried using cursorTextFormatting and it does not achieve what am trying to achieve. It formats the annotation that I have but what I am trying to achieve is to have the mountain chart tick labels scaled as how the line chart tick labels are scaled.

I think the images were a little misleading in expressing what I am trying to get, and I apologise for that.

Regards.

  • You must to post comments
0
0

Good day

Try setting

axis.textFormatting = "%.2f"

This is C format string.
Or if you are using SCINumericAxis you can set property numberFormatter which is NSNumberFormatter

Best regards
Andrii
SciChart iOS Developer

  • You must to post comments
0
0

Hi,

I tried using number formatter and text formatting, and I have attached the image with this answer.

I used the following code to add the formatter and formatting:

 NSNumberFormatter *numberFormatter = [NSNumberFormatter new];
 [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
 [numberFormatter setMinimumFractionDigits:3];
 [numberFormatter setMaximumFractionDigits:5];
 [((SCINumericAxis *)self.yAxis) setNumberFormatter:numberFormatter];
 [((SCINumericAxis *)self.yAxis) setTextFormatting:@"%.5f"];

As you can see, the scaling on the y-axis still does not happen. Is this because the mountain chart must always show the constant zerolineY?

Is there a way for the mountain chart to completely ignore the concept of a zero line Y and draw as how a line chart would?
Or is there a way for me to add a coloured area below a line graph?

Regards.

Images
  • Andrew Burnett-Thompson
    Right … I understand. It seems that Mountain Chart is somehow forcing your axis to display 0.0 -> Max is that correct? And you don’t expect that, you expect Min-> Max. Well I would agree with you. Let me check in the code and see what we’re doing and why. Question: What Axis.AutoRange value do you have?
  • Develle Yong
    Yes, I apologise if my explanation didn’t make the point. As for the autorange, I’m using AutoRange_Always for the axis. [self.yAxis setAutoRange:SCIAutoRange_Always]; Regards.
  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.