wrong dot color with NAN after click graph
GuessEver opened this issue · comments
Zhihao Jiang commented
There are 3 dots, 1
, NAN
and 2
, with color red
, yellow
, green
(Of course, dot with color yellow
doesn't show)
After reloadData
, the graph can be shown correctly.
But when I click the graph, the color of dots changed. (More specifically, dots with value NAN
do not take place)
Code
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.graph = [[JBLineChartView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
[self.view addSubview:self.graph];
[self.graph setDelegate:self];
[self.graph setDataSource:self];
self.data = @[
@1,
[NSNumber numberWithDouble:NAN],
@2
];
self.color = @[
[UIColor redColor],
[UIColor yellowColor],
[UIColor greenColor]
];
[self.graph reloadDataAnimated:YES];
}
- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView {
return 1;
}
- (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex {
return self.data.count;
}
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex {
return [self.data[horizontalIndex] doubleValue];
}
- (UIColor*)lineChartView:(JBLineChartView *)lineChartView colorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex {
return self.color[horizontalIndex];
}
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView widthForLineAtLineIndex:(NSUInteger)lineIndex {
return 1;
}
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dotRadiusForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex {
return 4;
}
- (BOOL)lineChartView:(JBLineChartView *)lineChartView showsDotsForLineAtLineIndex:(NSUInteger)lineIndex {
return YES;
}
Terry Worona commented
This indeed appears to be a bug. Good catch! Will look into as soon as I can.
In the meantime, if you wanted you could start debugging the JBLineChartDotsView:
- (void)setSelectedLineIndex:(NSInteger)selectedLineIndex animated:(BOOL)animated
Terry Worona commented
Fixed via v3.0.13