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

[question] Does JBChartView support logarithmic scale? #211

Closed
dodikk opened this issue Jul 5, 2016 · 3 comments
Closed

[question] Does JBChartView support logarithmic scale? #211

dodikk opened this issue Jul 5, 2016 · 3 comments

Comments

@dodikk
Copy link

dodikk commented Jul 5, 2016

I need to implement a scatter plot with a logarithmic Y axis scale
See the link for details.
https://gist.github.com/dodikk/dbad6675a7ead2d322ced451495cac09

Is it feasible to use JBChartView?

P.S. I have not found any answers on Google, StackOverflow, etc.

@terryworona
Copy link
Collaborator

The library supports dots and solid/dashes lines out of the box.

The log scale is also fine - so long as your data model represents a log function.

The library is written in Objective C, so no worries there. It also has a bridging header for Swift integration.

The custom axis and background grids are also possible - but you'll have to spin that up yourself by subclassing the chart instance and poking around. It will require some work.

Hope this helps.

@dodikk
Copy link
Author

dodikk commented Jul 6, 2016

@terryworona , thanks for the reply.

The log scale is also fine - so long as your data model represents a log function.

I have not quite understood this point. Could you, please explain the approach with more details?
I have not found a log scale axis class. For example, shinobi has one.

Thanks in advance.

@terryworona
Copy link
Collaborator

The y-axis will normalize itself across whatever data model you have.

So, if that model is a log(x) function, it will render fine. Check out the demo project and just change:

- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
{
    return log(horizontalIndex);
}

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