Pptxgenjs: Enable catAxisLabelPos to be set to 'none'

Created on 14 Jan 2019  路  4Comments  路  Source: gitbrent/PptxGenJS

This renders the Axis line, but not the labels. It should be a minor tweak around line 3520 in the code, 'none' is a standard option that PowerPoint will eat, next to 'high', 'low', 'nextTo'.

I like to control the chart axis labels myself using regular PowerPoint shapes, rather than using the Excel chart engine for this.

For my own use, I hard coded the change for the moment.

enhancement-chart

Most helpful comment

This looks like a straight forward change:

strXml += ' <c:tickLblPos val="'+ (opts.catAxisLabelPos || opts.barDir == 'col' ? 'low' : 'nextTo') +'"/>';

update to:
strXml += ' <c:tickLblPos val="'+ (opts.catAxisLabelPos || (opts.barDir == 'col' ? 'low' : 'nextTo')) +'"/>';

The existing logic is validating as:
If this option is specified, or it's a column graph then set it to 'low'.
Otherwise set it to 'nextTo'.

Updating the parenthesis, correctly accepts any valid attribute including none.

I've tested on the example site and confirmed. I can submit a PR this week, as there's one or two other points with similar logic to check first.

All 4 comments

This looks like a straight forward change:

strXml += ' <c:tickLblPos val="'+ (opts.catAxisLabelPos || opts.barDir == 'col' ? 'low' : 'nextTo') +'"/>';

update to:
strXml += ' <c:tickLblPos val="'+ (opts.catAxisLabelPos || (opts.barDir == 'col' ? 'low' : 'nextTo')) +'"/>';

The existing logic is validating as:
If this option is specified, or it's a column graph then set it to 'low'.
Otherwise set it to 'nextTo'.

Updating the parenthesis, correctly accepts any valid attribute including none.

I've tested on the example site and confirmed. I can submit a PR this week, as there's one or two other points with similar logic to check first.

I can submit a PR this week, as there's one or two other points with similar logic to check first.

Perfect, thank you. I will follow and learn how to do these type of things.

Have submitted PR #482 to resolve this for each of the Axis settings and validate for legitimate input.

Closing as Pull is complete.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinresol picture kevinresol  路  3Comments

yodasodabob picture yodasodabob  路  6Comments

Skiizoo picture Skiizoo  路  6Comments

pimlottc-gov picture pimlottc-gov  路  3Comments

adrienco88 picture adrienco88  路  3Comments