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

Cannot rescale Y-axis even if changing axisMinimum and axisMaximum #2766

Closed
tomkowz opened this issue Sep 1, 2017 · 4 comments
Closed

Cannot rescale Y-axis even if changing axisMinimum and axisMaximum #2766

tomkowz opened this issue Sep 1, 2017 · 4 comments

Comments

@tomkowz
Copy link

tomkowz commented Sep 1, 2017

Hello,

I am trying to convert the code to the newest version. My current goal is to scale Y-axis, but it look like the framework is ignoring my settings.

Here is how it look like right now without setting rightAxis.axisMinimum and rightAxis.axisMaximum:
screen shot 2017-09-01 at 14 33 40

When I set it to some custom values of min and max like 0 to 300 it should scale it so there is a lot of blank space on the top and some blank space on the bottom of the chart, but... these values are seems to be ignored completely.

screen shot 2017-09-01 at 14 34 21

Here is a code snippet with right axis configuration:

    chartView.rightAxis.axisLineColor = [UIColor clearColor];
    chartView.rightAxis.labelFont = [UIFont mavenProLight300WithFontSize:12];
    chartView.rightAxis.labelTextColor = [UIColor whiteColor];
    chartView.rightAxis.gridColor = [UIColor colorWithWhite:1 alpha:0.3];

    chartView.rightAxis.axisMinimum = minValue;
    chartView.rightAxis.axisMaximum = maxValue;

    chartView.rightAxis.labelCount = 3;

Could you please guide me what's wrong in here?
Thank you in advance.

@liuxuan30
Copy link
Member

liuxuan30 commented Sep 5, 2017

Don't use chartView.rightAxis.labelCount = 3; use open func setLabelCount(_ count: Int, force: Bool) instead.

second you need to call setNeedsDisplay to trigger a redraw or call notifyDataSetsChanged

@tomkowz
Copy link
Author

tomkowz commented Sep 6, 2017

@liuxuan30 I just set axisMinimum = 0, axisMaximum = 300, as before, added following calls after I set it:

    [chartView.rightAxis setLabelCount:3];
    [chartView notifyDataSetChanged];
    [chartView setNeedsDisplay];

and nothing happen, no changes, it just looks the same with 0-300 on a right axis.

@liuxuan30
Copy link
Member

did you specify axisDependency for your data sets?

@tomkowz
Copy link
Author

tomkowz commented Sep 7, 2017

@liuxuan30 that was it. Thank you. I have to set it to Right. Never heard about this property before.

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

2 participants