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

Add options to shift pie chart around #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sambostock
Copy link

Add horizontalShift and verticalShift options for pie charts.
These options accept either a number (in px), or a px or % string.

Numbers or px strings shift right for positive numbers, left for
negatives.

% strings are converted to a px value equal to the percentage of the
width or height.

Once values are in px, negative values shift the chart to the top/left;
positive values shift the chart to the bottom/right.

The radius calculation has been updated to account for the shift. It
computes the maximum radius possible which would not cause the chart to
exceed the boundaries, then applies the sizeRatio to further scale the
chart.

Further improvements could be made in drying up the code a little, but the
function is all there.

Add `horizontalShift` and `verticalShift` options for pie charts.
These options accept either a number (in px), or a `px` or `%` string.

Numbers or `px` strings shift right for positive numbers, left for
negatives.

`%` strings are converted to a `px` value equal to the percentage of the
width or height.

Once values are in `px`, negative values shift the chart to the top/left;
positive values shift the chart to the bottom/right.

The radius calculation has been updated to account for the shift.  It
computes the maximum radius possible which would not cause the chart to
exceed the boundaries, then applies the sizeRatio to further scale the
chart.
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

Successfully merging this pull request may close these issues.

None yet

1 participant