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

Remove border around linechart with gradient fill #747

Closed
timaktimak opened this issue Feb 10, 2016 · 8 comments
Closed

Remove border around linechart with gradient fill #747

timaktimak opened this issue Feb 10, 2016 · 8 comments

Comments

@timaktimak
Copy link

I want to have a gradient fill for a linechart with no border around it. I basically copied the code from the obj-c demo Line Chart 1 (only wrote it using swift), but it draws a border around the fill.

I have (notice the green border, I want the left, right, bottom lines removed):
screen shot 2016-02-10 at 16 14 33

I want it like this (with no borders on the left, right, and bottom):
screen shot 2016-02-10 at 16 16 16

Is there a way to do it in Swift that I am missing? Please help.

@liuxuan30
Copy link
Member

Seems it's about drawCubic will introduce this border, while drawLinear does not have it.
There is slight difference for drawCubic. It will draw a sub path first

        var pt1 = CGPoint(x: CGFloat(to - 1), y: fillMin)
        var pt2 = CGPoint(x: CGFloat(from), y: fillMin)
        pt1 = CGPointApplyAffineTransform(pt1, matrix)
        pt2 = CGPointApplyAffineTransform(pt2, matrix)

        CGPathAddLineToPoint(spline, nil, pt1.x, pt1.y)
        CGPathAddLineToPoint(spline, nil, pt2.x, pt2.y)
        CGPathCloseSubpath(spline)

@danielgindi you think this a bug or by design?

@danielgindi
Copy link
Collaborator

It does not draw a subpath - it adds the path to the context in order to draw.
There shouldn't be any borders around the fill.
If you see borders only in your code - then maybe your gradient is not configured correctly and has "borders", colors stretching past the beginning/end colors etc.

@liuxuan30
Copy link
Member

@danielgindi I use ChartsDemo, and set set1.drawCubicEnabled = YES; and I could see it has bounding borders, while linear drawing not have the bounding border (above image)
dash

@danielgindi
Copy link
Collaborator

This screenshot is cubic- and does not have bounding borders... it has the line above the fill- which you can disable in many ways (transparent color, for example)

@liuxuan30
Copy link
Member

@danielgindi I think the issue is, my screenshot has dash lines around the whole fill area, while linear drawing does not have, on right, left and bottom side:
nohave
How can I disable rendering the addtional dash line on left, right, and bottom? I simply enable draw cubic, and the dashed lines are there then.

@danielgindi
Copy link
Collaborator

I actually found where this issue might be coming from - let me know if this fixed it.

@liuxuan30
Copy link
Member

the fix is positive on my side.

@danielgindi
Copy link
Collaborator

👍

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

3 participants