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

Marker behind line limit #867

Closed
mosaic6 opened this issue Mar 21, 2016 · 3 comments
Closed

Marker behind line limit #867

mosaic6 opened this issue Mar 21, 2016 · 3 comments

Comments

@mosaic6
Copy link

mosaic6 commented Mar 21, 2016

Hi Daniel,

I'm working on loading multiple charts with different datasets. Most of the charts have a line limit and marker called on each data point. For some reason my marker is being drawn behind the line. Any thoughts?
screenshot 2016-03-21 14 00 58

@liuxuan30
Copy link
Member

I checked the code, drawLimitLines is called before drawMarkers, so it should not happen...
I tried with ChartsDemo's line chart, negative as well.
Could you debug on your side?

@mosaic6
Copy link
Author

mosaic6 commented Mar 24, 2016

Ok I looked into it more and I think the issue is on our custom BarChart class. We have implemented the limit line on drawRect

// after render chart, render limit line again
override func drawRect(rect: CGRect) {
super.drawRect(rect)

    // we want to render the limit line label (7k) to the left of the data. The default impl clips the drawing context
    // we need to redraw it here w/o clipping the context
    if let context = UIGraphicsGetCurrentContext() {
        leftYAxisRenderer.renderLimitLines(context: context)
    }
}

If I remove this the marker appears on top of the line but the left axis value doesn't show up (7,000)

@liuxuan30
Copy link
Member

in your custom bar chart class, usually you don't have to change drawRect, just override the drawing functions.
If you don't want the limit line to be clipped beyond contentRect, then you have to change your rendering order. Be careful, the super class will still draw the limit line (may introduce overlap), if you don't handle it well.

I think this can be closed since you find the root cause.

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