-
Notifications
You must be signed in to change notification settings - Fork 0
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 pie chart explosion opt to charts #17
Conversation
SWI-221 Chart: Pie options
Unsupported options
Other problems
|
src/gen-charts.ts
Outdated
@@ -1563,6 +1563,9 @@ function makeChartType(chartType: CHART_NAME, data: IOptsChartData[], opts: ICha | |||
strXml += '<c:' + chartType + 'Chart>' | |||
strXml += ' <c:varyColors val="1"/>' | |||
strXml += '<c:ser>' | |||
if (opts.chartPieExplosion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll need to do a couple of safety checks before passing it to the xml i.e. is it a valid number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the following fine?
if (opts.chartPieExplosion && Number.isInteger(opts.chartPieExplosion)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we support floats? And is there a min or max limit? I've seen some PPTX errors before because the number were out of range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and Explosion needs to be an integer value according to c-rex
I don't think we should be overly defensive here. The values which Pitch can produce are quite narrow (0 - 10).
@@ -1519,6 +1519,7 @@ export interface IChartPropsChartPie { | |||
* @default 0 | |||
*/ | |||
firstSliceAng?: number | |||
chartPieExplosion?: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this protect us from bad inputs without having to add manual inline checks? @tjinauyeung
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these definitions are not checked unfortunately. We're not using any of the TS definitions when using the library.
Adds the "explosion" prop to PptxGenJS. This will allow us to get something approximating our pie chart padding