Skip to content

Conversation

@sam-pitch
Copy link

Adds the "explosion" prop to PptxGenJS. This will allow us to get something approximating our pie chart padding

@sam-pitch sam-pitch self-assigned this Oct 10, 2022
@linear
Copy link

linear bot commented Oct 10, 2022

SWI-221 Chart: Pie options

Unsupported options

  • padding
  • rounding

Other problems

  • No option to set the label position

strXml += '<c:' + chartType + 'Chart>'
strXml += ' <c:varyColors val="1"/>'
strXml += '<c:ser>'
if (opts.chartPieExplosion) {

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?

Copy link
Author

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)) {

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.

Copy link
Author

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).

* @default 0
*/
firstSliceAng?: number
chartPieExplosion?: number
Copy link
Author

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

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.

@sam-pitch sam-pitch merged commit 647b102 into pitch-main Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants