-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Max Y value sometimes get clipped #405
Comments
you specified // make sure the graph values and grid cannot be drawn outside the content-rect
CGContextClipToRect(context, _viewPortHandler.contentRect)
...
renderer?.drawData(context: context)
...
// Removes clipping rectangle
CGContextRestoreGState(context) But you said |
@liuxuan30 thanks for looking into it! I've noticed the problem after upgrading to the latest ios-charts. So I thought that maybe this is a regression. Before the last upgrade of ios-charts version used in our app I was using b68481e and here is how it looks like with the same set of data: I also set |
I tried it on ChartsDemo line chart view controller, with commit 7b85077 (latest before today) _chartView.leftAxis.customAxisMax = 10;
NSMutableArray *xVals = [[NSMutableArray alloc] init];
[xVals addObject:@"1442246400000"];
[xVals addObject:@"1442419200000"];
[xVals addObject:@"1442505600000"];
[xVals addObject:@"1442764800000"];
[xVals addObject:@"1442851200000"];
NSMutableArray *yVals = [[NSMutableArray alloc] init];
[yVals addObject:[[ChartDataEntry alloc] initWithValue:0 xIndex:0]];
[yVals addObject:[[ChartDataEntry alloc] initWithValue:2 xIndex:1]];
[yVals addObject:[[ChartDataEntry alloc] initWithValue:10 xIndex:2]];
[yVals addObject:[[ChartDataEntry alloc] initWithValue:7 xIndex:3]];
[yVals addObject:[[ChartDataEntry alloc] initWithValue:3 xIndex:4]];
LineChartDataSet *set1 = [[LineChartDataSet alloc] initWithYVals:yVals label:@"DataSet 1"];
set1.lineWidth = 1.75;
set1.circleRadius = 3.0;
[set1 setColor:[UIColor orangeColor]];
[set1 setCircleColor:UIColor.whiteColor];
set1.highlightColor = UIColor.whiteColor;
set1.drawValuesEnabled = NO; it looks fine to me, the top value 10's circle is visible too: |
@liuxuan30 thanks for the help! I'll look closer into this in next few days. I'll try to localize since what ios-charts library I've started to get the different behavior and/or maybe will create a demo app or a unit test. Thanks again! |
No problem! |
I've tried to reproduce the problem and can't reproduce this anymore. Weird... I'll keep an eye on this. Xuan, thanks a lot for your time! 👍 |
I've just updated to the latest version of the library (v2.1.4, 7b85077) and have noticed an issue that sometimes max value doesn't show on the graph even it was shown before the update. Here is What I get now:
Here is my setup:
Here are the values I have:
Here is what I expect and can achieve with a workaround
self.chartView.leftAxis.customAxisMax = 11
:The text was updated successfully, but these errors were encountered: