PNChart icon indicating copy to clipboard operation
PNChart copied to clipboard

Help with rangeColors

Open miguelkennedy opened this issue 7 years ago • 1 comments

Hi guys,

I'm fairly new to Objective-C and I need some help understanding the rangeColors property for the line chart.

For instance, I want values from 1 to 55 to be red, 56 to 110 to be green, 111 to 130 to be yellow and 131 upwards too be red. Here's my code

lineChartData.rangeColors = @[ [[PNLineChartColorRange alloc] initWithRange:NSMakeRange(1, 55) color:[UIColor redColor]], [[PNLineChartColorRange alloc] initWithRange:NSMakeRange(56, 55) color:[UIColor greenColor]], [[PNLineChartColorRange alloc] initWithRange:NSMakeRange(111, 20) color:[UIColor yellowColor]], [[PNLineChartColorRange alloc] initWithRange:NSMakeRange(131, 20000) color:[UIColor redColor]] ];

This doesn't seem to work... Line colors are not attributed correctly :(

Can somebody please help me understand how this works?

Thanks!

miguelkennedy avatar Feb 05 '18 15:02 miguelkennedy

thanks to huge help from Miguel for reporting the bug, defining the use cases and testing out all patches posted in https://github.com/kevinzhow/PNChart/pull/429.

as part of PR 429 i have also bumped up the pod version so that we can release new PNChart version there which includes LineChart fixes.

farshidce avatar Mar 07 '18 16:03 farshidce