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

CGContextAddLineToPoint no current point. #419

Closed
yuravake opened this issue Sep 25, 2015 · 8 comments
Closed

CGContextAddLineToPoint no current point. #419

yuravake opened this issue Sep 25, 2015 · 8 comments
Labels

Comments

@yuravake
Copy link

When drawing LineChart i have a lot of warnings in console "CGContextAddLineToPoint: no current point." and "CGContextClosePath: no current point."

So i think, that LineChartRenderer missing CGPathMoveToPoint line at 234 or so, but can't figure out how to make it work... %)

@liuxuan30
Copy link
Member

can we reproduce it with ChartsDemo? I don't see it in my project.
Also, what line chart type you are using, cubic or linear, and have you enabled dataSet.isDrawFilledEnabled

@yuravake
Copy link
Author

i managed to get same error in ChartsDemo when i changed LineChartDataSet in LineChart1ViewController to follows :
[set1 setColor:[UIColor blackColor]];
set1.lineWidth = 3.0;
set1.fillAlpha = 1;
set1.fillColor = [UIColor blackColor];
set1.drawCubicEnabled = YES;
set1.drawFilledEnabled = YES;
set1.drawCirclesEnabled = NO;
set1.drawValuesEnabled = NO;

@liuxuan30 liuxuan30 added the bug label Sep 28, 2015
@liuxuan30
Copy link
Member

I see it with:

    set1.drawCubicEnabled = YES;
    set1.drawFilledEnabled = YES;

function: internal func drawCubicFill

234        CGContextAddLineToPoint(context, pt1.x, pt1.y)
235        CGContextAddLineToPoint(context, pt2.x, pt2.y)

I see size - minx >= 2 is false, so the path is not fully initialized yet. Pending fix. You can use drawLinear right now

@yuravake
Copy link
Author

so, the graph actually draws correctly...its just console messages...

@liuxuan30
Copy link
Member

Find out more:
It's related with the animation:
phaseX is 0 at first if you turned on animate X, so it calculates the size to be 0:
let size = Int(ceil(CGFloat(maxx - minx) * phaseX + CGFloat(minx))), if you turn off animate X, drawCubic is also fine.
Though it won't crash nor incorerct rendering, still needs attension to fix.

@yuravake
Copy link
Author

Yes, without X animation all good, thanks.

danielgindi added a commit to danielgindi/MPAndroidChart that referenced this issue Oct 1, 2015
@danielgindi
Copy link
Collaborator

@liuxuan30 thanks for narrowing the case :-)

@liuxuan30
Copy link
Member

@danielgindi I would help to fix, but drawLinear and drawCubic is a little complicated to find out the proper solution :( still learning when having some chances

regas99 pushed a commit to regas99/MPAndroidChart that referenced this issue Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants