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

调用strokeChart点对应旧的值没更新 #445

Open
MeteoriteMan opened this issue Sep 6, 2018 · 1 comment
Open

调用strokeChart点对应旧的值没更新 #445

MeteoriteMan opened this issue Sep 6, 2018 · 1 comment

Comments

@MeteoriteMan
Copy link

No description provided.

@MeteoriteMan
Copy link
Author

MeteoriteMan commented Sep 6, 2018

我瞅了瞅源码.是以下方法创建的点上的文字

- (CATextLayer *)createPointLabelFor:(CGFloat)grade pointCenter:(CGPoint)pointCenter width:(CGFloat)width withChartData:(PNLineChartData *)chartData

然后作者使用了一个局部可变数组变量"gradePathArray"去存储实例化的CATextLayer.我们可以弄一个NSArray去记录一下这些layer.这些CATextLayer的实例化在如下方法中

- (void)calculateChartPath:(NSMutableArray *)chartPath andPointsPath:(NSMutableArray *)pointsPath andPathKeyPoints:(NSMutableArray *)pathPoints andPathStartEndPoints:(NSMutableArray *)pointsOfPath {

}

self.xxarray = gradePathArray.copy;
然后在调用stokeChart和updateChartData的时候便利一下这个数组.将其中存储的CATextLayer实例化对象removeFromSuperLayer.这样调用这俩方法的时候就会刷新了.

另,这个文字底部的白色默认颜色的问题可以搜索

[textLayer setBackgroundColor:[[[UIColor whiteColor] colorWithAlphaComponent:0.8] CGColor]];

因为这里头有些小细节的问题,具体我也不知道是哪一行了

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

1 participant