Skip to content

Commit a00b8b2

Browse files
authored
chore(docs): Extended chart types
1 parent 431b78a commit a00b8b2

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# pptx-automizer
2-
This is a pptx generator for Node.js based on templates. It can read pptx files and insert selected slides or single slide elements into another presentation. *pptx-automizer* will not write files from scratch, but edit and merge existing pptx files. Template slides are styled within PowerPoint and will be merged into the output presentation. Most of the content can be modified by using callbacks with [xmldom](https://github.com/xmldom/xmldom).
2+
This is a pptx generator for Node.js based on templates. It can read pptx files and insert selected slides or single slide elements into another presentation. `pptx-automizer` will not write files from scratch, but edit and merge existing pptx files. Template slides are styled within PowerPoint and will be merged into the output presentation. Most of the content can be modified by using callbacks with [xmldom](https://github.com/xmldom/xmldom).
33

4-
*pptx-automizer* will fit best to users who try to maintain their own library of pptx template files. This is perfect to anyone who uses complex and well-styled customized layouts. Any existing slide and even a single element can be a data driven template for output pptx files.
4+
`pptx-automizer` will fit best to users who try to maintain their own library of pptx template files. This is perfect to anyone who uses complex and well-styled customized layouts. Any existing slide and even a single element can be a data driven template for output pptx files.
55

6-
This project comes along with [automizer-data](https://github.com/singerla/automizer-data). You can use *automizer-data* to import, browse and transform XSLX-data into perfectly fitting graph or table data.
6+
This project comes along with [automizer-data](https://github.com/singerla/automizer-data). You can use `automizer-data` to import, browse and transform XSLX-data into perfectly fitting graph or table data.
77

88
## Requirements
99
This generator can only be used on the server-side and requires a [Node.js](https://nodejs.org/en/download/package-manager/) environment.
@@ -13,7 +13,7 @@ This generator can only be used on the server-side and requires a [Node.js](http
1313
Please note that this project is *work in progress*. At the moment, you might encounter difficulties for special shape types that require further relations (e.g. links will not work properly). Although, most shape types are already supported, such as connection shapes, tables or charts. You are welcome to [report any issue](https://github.com/singerla/pptx-automizer/issues/new).
1414

1515
### Chart types
16-
Extended chart types, like waterfall or map charts, are not supported right now.
16+
Extended chart types, like waterfall or map charts, are basically supported. You might need additional modifiers to handle extended properties, which are not implemented yet. Please help to improve `pptx-automizer` and [report](https://github.com/singerla/pptx-automizer/issues/new) issues regarding extended charts.
1717

1818
### PowerPoint Version
1919
All testing focuses on PowerPoint 2019 pptx file format.
@@ -23,7 +23,7 @@ It is currently not supported to import slide masters or slide layouts into the
2323

2424

2525
## Install
26-
There are basically two ways to use *pptx-automizer*.
26+
There are basically two ways to use `pptx-automizer`.
2727

2828
### As a cloned repository
2929
If you want to see how it works and you like to run own tests, you should clone this repository and install the dependencies:
@@ -39,7 +39,7 @@ $ yarn dev
3939
and see the most recent feature from `src/dev.ts`. Every time you change & save this file, you will see new console output and a pptx file in the destination folder. Take a look into `__tests__`-directory to see a lot of examples for several use cases!
4040

4141
### As a package
42-
If you are working on an existing project, you can add *pptx-automizer* to it using npm or yarn. Run
42+
If you are working on an existing project, you can add `pptx-automizer` to it using npm or yarn. Run
4343
```
4444
$ yarn add pptx-automizer
4545
```
@@ -160,8 +160,33 @@ pres.addSlide('charts', 2, (slide) => {
160160
})
161161
])
162162
})
163+
```
164+
165+
## Modify extended charts
166+
If you need to modify extended chart types, such like waterfall or map charts, you need to use `modify.setExtendedChartData`.
163167

168+
```ts
169+
// Add and modify a waterfall chart on slide.
170+
pres.addSlide('charts', 2, (slide) => {
171+
slide.addElement('ChartWaterfall.pptx', 1, 'Waterfall 1', [
172+
modify.setExtendedChartData(<ChartData>{
173+
series: [{ label: 'series 1' }],
174+
categories: [
175+
{ label: 'cat 2-1', values: [100] },
176+
{ label: 'cat 2-2', values: [20] },
177+
{ label: 'cat 2-3', values: [50] },
178+
{ label: 'cat 2-4', values: [-40] },
179+
{ label: 'cat 2-5', values: [130] },
180+
{ label: 'cat 2-6', values: [-60] },
181+
{ label: 'cat 2-7', values: [70] },
182+
{ label: 'cat 2-8', values: [140] },
183+
],
184+
}),
185+
]);
186+
})
164187
```
188+
189+
165190
## Remove elements from a slide
166191

167192
You can as well remove elements from slides.
@@ -201,15 +226,15 @@ const automizer = new Automizer({
201226

202227

203228
let pres = automizer.loadRoot(`RootTemplate.pptx`)
204-
// We load this twice to make it slide reordeing available
229+
// We load this twice to make it available for sorting slide
205230
.load(`RootTemplate.pptx`, 'root')
206231
.load(`SlideWithShapes.pptx`, 'shapes')
207232
.load(`SlideWithGraph.pptx`, 'graph')
208233

209234
pres.addSlide('root', 1) // First slide will be taken from root
210235
.addSlide('graph', 1)
211236
.addSlide('shapes', 1)
212-
.addSlide('root', 3) // Third slide from root we be appended
237+
.addSlide('root', 3) // Third slide from root will be appended
213238
.addSlide('root', 2) // Second and third slide will switch position
214239
})
215240

0 commit comments

Comments
 (0)