Skip to content

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants