Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Fixed #20 - renders single-item pie chart correctly now #45

Merged
merged 1 commit into from
Jan 26, 2017
Merged

Conversation

marzolfb
Copy link
Contributor

Fixes #20 so that a single-item pie chart renders correctly now.

This was a bit tricky as it was a bit unexpected that an arc with the same start and ending point renders nothing in svg as opposed to rendering a complete circle (which seems more natural from an end-user standpoint but maybe not natural from a pure mathematical standpoint). This issue is discussed in this StackOverflow question.

The paths-js library which this library depends on directly to provide the svg paths to draw the pie chart doesn't have any special handling for a complete-circle arc either. So, I took the approach of looking specifically for the scenario where there was only 1 data item and substituting react-native-svg <Circle>s - one "outer circle" with a radius of props.R and one "inner circle" with a radius of props.r.

Along the way I also discovered we weren't probably handling inner radius values of 0 nor fallback logic for either the inner or outer radius. So, I cleaned that up a bit as well.

Also, added a jest test for the single-item pie chart scenario.

@marzolfb marzolfb requested a review from katscott January 21, 2017 20:18
@jasmo2
Copy link

jasmo2 commented Jan 23, 2017

Hello thanks for it.
¿When could we have this improvement?

@marzolfb
Copy link
Contributor Author

Soon.

Before publishing a new version of this library with this new PR merged in, I would like to get this library updated to using newer versions of react-native and react-native-svg (see my comments on #55 and #49). (I'm hoping to tackle this in the next day or two)

@marzolfb marzolfb merged commit b1a4eef into master Jan 26, 2017
@marzolfb marzolfb deleted the fix-20 branch January 26, 2017 16:53
@jasmo2
Copy link

jasmo2 commented Jan 27, 2017

I am very thank to you for this awesome library. I would like to help you in any future issues.
Thats why I ask you. ¿Where should I begin reading the repo to understanding in deep?

@marzolfb
Copy link
Contributor Author

Wonderful! The source code for each type of chart is quite varied and picking a single starting point is tough. I guess I would suggest picking your favorite type of chart and try implementing some enhancement to it that you think would be useful. In doing that, you will frequently reference two valuable sources of documentation:

dgladkov pushed a commit to dgladkov/react-native-pathjs-charts that referenced this pull request Apr 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants