Skip to content

Commit

Permalink
Added new chart option 'valAxisLabelFormatCode' from Issue #132
Browse files Browse the repository at this point in the history
  • Loading branch information
GitBrent authored and GitBrent committed Aug 11, 2017
1 parent 65ff143 commit 99285f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
6 changes: 3 additions & 3 deletions dist/pptxgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ var PptxGenJS = function(){
</a:ln>\
</c:spPr>\
</c:majorGridlines>';
strXml += ' <c:numFmt formatCode="General" sourceLinked="0"/>';
strXml += ' <c:numFmt formatCode="'+ (rel.opts.valAxisLabelFormatCode ? rel.opts.valAxisLabelFormatCode : 'General') +'" sourceLinked="0"/>';
strXml += ' <c:majorTickMark val="out"/>';
strXml += ' <c:minorTickMark val="none"/>';
strXml += ' <c:tickLblPos val="'+ (rel.opts.barDir == 'col' ? 'nextTo' : 'low') +'"/>';
Expand All @@ -1192,7 +1192,7 @@ var PptxGenJS = function(){
strXml += ' <c:crossAx val="2094734552"/>';
strXml += ' <c:crosses val="autoZero"/>';
strXml += ' <c:crossBetween val="'+ ( rel.opts.type == 'area' ? 'midCat' : 'between' ) +'"/>';
if ( rel.opts.majorUnit ) strXml += ' <c:majorUnit val="'+ rel.opts.majorUnit +'"/>';
if ( rel.opts.valAxisMajorUnit ) strXml += ' <c:majorUnit val="'+ rel.opts.valAxisMajorUnit +'"/>';
strXml += '</c:valAx>';
}

Expand Down Expand Up @@ -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] = {};
Expand Down

0 comments on commit 99285f1

Please sign in to comment.