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
andverticalShift
options for pie charts. These options accept either a number (inpx
), or apx
or%
string.Numbers or
px
strings shift right for positive numbers, left for negatives.%
strings are converted to apx
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 thesizeRatio
to further scale the chart.Further improvements could be made in drying up the code a little, but the function is all there.