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

How can I have a limit zone (in android library mpandroidchart) like feature in this iOS library #2073

Closed
dhruv-jindal opened this issue Jan 13, 2017 · 5 comments

Comments

@dhruv-jindal
Copy link

No description provided.

@dhruv-jindal dhruv-jindal changed the title How can I have a limit zone (in android) like feature in this iOS library How can I have a limit zone (in android library mpandroidchart) like feature in this iOS library Jan 13, 2017
@smawpaw
Copy link

smawpaw commented Jan 14, 2017

Do you mean limit lines? There is an addLimitLine(_:) method on the 3 axes (leftAxis, rightAxis, and xAxis) so you can do something like this:

let lowLimitLine = ChartLimitLine(limit: 100, label: "Low Threshold")
lowLimitLine.lineWidth = 1.0
lowLimitLine.lineDashLengths = [1, 2]
lowLimitLine.lineColor = UIColor.lightGray
lowLimitLine.valueTextColor = UIColor.lightGray
    
leftAxis.addLimitLine(lowLimitLine)

That will produce something like this:

low thresh limit line

You can add as many limit lines as you like as far as I know! See also the first example in ChartsDemo.

@dhruv-jindal

@dhruv-jindal
Copy link
Author

I already knew about limit lines and I am using that also in my app. What I want is something like this in the below pic :

screenshot_2017-01-16-10-13-42

I want to add 4 colours to the background of the chart. The colour zones depend on the y values.

@liuxuan30
Copy link
Member

liuxuan30 commented Jan 17, 2017

grid color stripe is not supported yet. However, you can add your own methods in drawExtra() or override some methods, to draw color grid. You can refer how the limit line/grid line is drawn, and you would know the coordinates to draw your rect then.

@dhruv-jindal
Copy link
Author

Thank you for the reply. I will try that solutions of yours.

@bhargavsejpalindianic
Copy link

@liuxuan30 @danielgindi can you please add the example for the same

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

4 participants