Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the differences between setAxisMaximum and customAxisMax #239

Closed
kscorpio opened this issue Jul 24, 2015 · 6 comments
Closed

What's the differences between setAxisMaximum and customAxisMax #239

kscorpio opened this issue Jul 24, 2015 · 6 comments

Comments

@kscorpio
Copy link

After init a linecharview like this

          _scaleView.delegate = self;  
           _lineChart.descriptionText = @"";
           _lineChart.noDataTextDescription = @"";
           _lineChart.highlightEnabled = YES;
           _lineChart.dragEnabled = YES;
          [_lineChart setScaleEnabled:YES];
           _lineChart.pinchZoomEnabled = NO;

          _lineChart.drawGridBackgroundEnabled = NO;
          _lineChart.legend.position = ChartLegendPositionBelowChartRight;

I find 4 properies :

          [_lineChart.leftAxis setAxisMaximum:200];
          [_lineChart.leftAxis setAxisMinimum:-200];
          _lineChart.leftAxis.customAxisMax = 200;
          _lineChart.leftAxis.customAxisMin = -200;

the _lineChart yAxis is from -1 to +1 and it just can zoom in can not zoom out
and can not zoom and move in x direction
i have run a demo in android , the chat can zoom and move freely

@liuxuan30
Copy link
Member

Once you set customAxisMax/Max, it just defines the max range of the axis, so you cannot zoom out I guess if you are not zoomed in first. Because if you try to zoom out the max range, what the range would be is unknown. I don't know android, @PhilJay can you confirm?

axisMaximum/Min is something calculated via computeAxisValues or calcMinMax, so normally you don't have to change this (and shouldn't)

Once you set customAxisMax/Max, axisMax/Min is set to it:

        _yAxis.axisMaximum = !isnan(_yAxis.customAxisMax) ? _yAxis.customAxisMax : maxLeft + Double(topSpaceLeft)
        _yAxis.axisMinimum = !isnan(_yAxis.customAxisMin) ? _yAxis.customAxisMin : minLeft - Double(bottomSpaceLeft)

@kscorpio
Copy link
Author

  • How to achieve xyAxis zoom in/out infinitely ?
  • How to adjust unit length x y, like X:Y =1:3

@kscorpio
Copy link
Author

  • can the property customAxisMax/min be changed automaticlly ,when i add point to dataset??

@liuxuan30
Copy link
Member

I don't believe you can zoom out of the max axis range... But zoom in seems possible to a very small scale, but I never tried it infinitely. What are you trying to do here?

You can try to modify the scaleX/Y to let X:Y = 1:3, I am not very clear about what you needs.

customAxisMax/min means you define the max/min, instead of calculating. When you add point to dataSet, axis max/min are calculated with these values already.

@SvenMuc
Copy link
Contributor

SvenMuc commented Jul 25, 2015

I used the following line of codes to zoom in by programatically for example to show just the min and max value of the data. Nevertheless, I haven't tried whether it is still possible to zoom in/out by the gestures.
Important topic for me was to set the labelCountcorrectly. Otherwise you might get strange steps on the axis.

lineChart.leftAxis.customAxisMin = max(0.0, lineChart.data!.yMin - 1.0)
lineChart.leftAxis.customAxisMax = min(10.0, lineChart.data!.yMax + 1.0)
lineChart.leftAxis.labelCount = Int(lineChart.leftAxis.customAxisMax - lineChart.leftAxis.customAxisMin)
lineChart.leftAxis.startAtZeroEnabled = false

@ricardosousaDev
Copy link

For those who find an issue of not having the customAxisMin/Max working, bare in mind that the dataSet should be added to the graph after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants