Practical javadocx

Charts

Introduction

Working with charts is as easy as with pictures. You just need to choose the kind of graphic to insert and add the values and legends.

There are 2D and 3D graphic available, with many formats like cylinder, cone or pyramid, column type, pie format, line, area, radar, surface, doughnut...

Adding charts

For adding charts in a document, call addChart:

It counts with multiple options to use in the array of parameters. The most important are:

  • "type": Type of chart
  • "dataNames": ArrayList
  • "dataValues": ArrayList
  • "title": Text used as a title

Beside these attributes, you can define other properties as rotation with rotX and rotY, perspective, distance between values, sizes, and so on.

For example, to add a pie type chart, first define names and values:

Next, define the options of the chart:

Finally, add the chart:

Adding charts in templates

You can create a chart as a WordFragment and substitute it instead of a specific placehoder. This procedure is similar to the placeholder template replacement for text and images.

replaceVariableByWordFragment is the same method as the one explained for images:

For example, you can create as a WordFragment the same chart seen before.

Then, replace it in the template:

Tips and tricks

javadocx includes the color schemes used in MS Word for charts. You can define this property through the "color" option of the addChart method.

Next - HTML and CSS