ArthurGuibert / FSInteractiveMap

A charting library to visualize and interact with a vector map on iOS. It's like Geochart but for iOS!
Apache License 2.0
551 stars 80 forks source link

Prevent division by zero #9

Open caotrido opened 8 years ago

caotrido commented 8 years ago

Made a change to prevent a division by zero when there is only one value in the datas or one color.

danieldabate commented 8 years ago

Great change, thank you! It would be awesome to see it merged on FSInteractiveMap.

xiaomage1478 commented 7 years ago

Hello, i need to show the name of the province on the map in China, what do i need to do?

danielebogo commented 5 years ago

@ArthurGuibert can this PR being merged? Or at least have another PR with those lines?

float s = ([value floatValue] - min) / ( ((max-min) == 0 ? 1 : (max-min)) );
float segmentLength = 1.0 / ( (([colors count] - 1) == 0 ? 1 : ([colors count] - 1)) );

Happy to do it and help. Without this fix it crashes.