From 99285f1456a147e57ba7a138d604b935949a798e Mon Sep 17 00:00:00 2001 From: GitBrent Date: Thu, 10 Aug 2017 22:29:05 -0500 Subject: [PATCH] Added new chart option 'valAxisLabelFormatCode' from Issue #132 --- README.md | 23 ++++++++++++----------- dist/pptxgen.js | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 520711a8c..54419f549 100644 --- a/README.md +++ b/README.md @@ -347,18 +347,19 @@ slide.addChart({TYPE}, {DATA}, {OPTIONS}); | `titleFontSize` | number | points | `18` | font size | 1-256. Ex: `{ titleFontSize:12 }` | ### Chart Axis Options -| Option | Type | Unit | Default | Description | Possible Values | -| :--------------------- | :------ | :------ | :-------- | :---------------------- | :----------------------------------------- | -| `catAxisLabelColor` | string | | `000000` | category-axis color | hex color code. Ex: `{ catAxisLabelColor:'0088CC' }` | -| `catAxisLabelFontFace` | string | | `Arial` | category-axis font face | font name. Ex: `{ titleFontFace:'Arial' }` | -| `catAxisLabelFontSize` | number | points | `18` | category-axis font size | 1-256. Ex: `{ titleFontSize:12 }` | +| Option | Type | Unit | Default | Description | Possible Values | +| :--------------------- | :------ | :------ | :-------- | :----------------------- | :----------------------------------------- | +| `catAxisLabelColor` | string | | `000000` | category-axis color | hex color code. Ex: `{ catAxisLabelColor:'0088CC' }` | +| `catAxisLabelFontFace` | string | | `Arial` | category-axis font face | font name. Ex: `{ titleFontFace:'Arial' }` | +| `catAxisLabelFontSize` | number | points | `18` | category-axis font size | 1-256. Ex: `{ titleFontSize:12 }` | | `catAxisOrientation` | string | | `minMax` | category-axis orientation | `maxMin` (high->low) or `minMax` (low->high) | -| `majorUnit` | number | float | `1.0` | value-axis tick steps | Float or whole number. Ex: `{ majorUnit:0.2 }` | -| `valAxisLabelColor` | string | | `000000` | value-axis color | hex color code. Ex: `{ valAxisLabelColor:'0088CC' }` | -| `valAxisLabelFontFace` | string | | `Arial` | value-axis font face | font name. Ex: `{ titleFontFace:'Arial' }` | -| `valAxisLabelFontSize` | number | points | `18` | value-axis font size | 1-256. Ex: `{ titleFontSize:12 }` | -| `valAxisMaxVal` | number | | | maximum value for Value Axis | 1-N. Ex: `{ valAxisMaxVal:125 }` | -| `valAxisOrientation` | string | | `minMax` | value-axis orientation | `maxMin` (high->low) or `minMax` (low->high) | +| `valAxisLabelColor` | string | | `000000` | value-axis color | hex color code. Ex: `{ valAxisLabelColor:'0088CC' }` | +| `valAxisLabelFontFace` | string | | `Arial` | value-axis font face | font name. Ex: `{ titleFontFace:'Arial' }` | +| `valAxisLabelFontSize` | number | points | `18` | value-axis font size | 1-256. Ex: `{ titleFontSize:12 }` | +| `valAxisLabelFormatCode` | string | | | value-axis number format | format string. Ex: `{ axisLabelFormatCode:'#,##0' }` [MicroSoft Number Format Codes](https://support.office.com/en-us/article/Number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68) | +| `valAxisMajorUnit` | number | float | `1.0` | value-axis tick steps | Float or whole number. Ex: `{ majorUnit:0.2 }` | +| `valAxisMaxVal` | number | | | value-axis maximum value | 1-N. Ex: `{ valAxisMaxVal:125 }` | +| `valAxisOrientation` | string | | `minMax` | value-axis orientation | `maxMin` (high->low) or `minMax` (low->high) | ### Chart Data Options | Option | Type | Unit | Default | Description | Possible Values | diff --git a/dist/pptxgen.js b/dist/pptxgen.js index 0d1f7b03c..8b4cde834 100644 --- a/dist/pptxgen.js +++ b/dist/pptxgen.js @@ -1170,7 +1170,7 @@ var PptxGenJS = function(){ \ \ '; - strXml += ' '; + strXml += ' '; strXml += ' '; strXml += ' '; strXml += ' '; @@ -1192,7 +1192,7 @@ var PptxGenJS = function(){ strXml += ' '; strXml += ' '; strXml += ' '; - if ( rel.opts.majorUnit ) strXml += ' '; + if ( rel.opts.valAxisMajorUnit ) strXml += ' '; strXml += ''; } @@ -2872,7 +2872,7 @@ var PptxGenJS = function(){ options.dataLabelFormatCode = ( options.dataLabelFormatCode && typeof options.dataLabelFormatCode === 'string' ? options.dataLabelFormatCode : (options.type == 'pie' ? '0%' : '#,##0') ); // options.lineSize = ( typeof options.lineSize === 'number' ? options.lineSize : 2 ); - options.majorUnit = ( typeof options.majorUnit === 'number' ? options.majorUnit : null ); + options.valAxisMajorUnit = ( typeof options.valAxisMajorUnit === 'number' ? options.valAxisMajorUnit : null ); // STEP 4: Set props gObjPptx.slides[slideNum].data[slideObjNum] = {};