XML API - pdx:addChart

pdx:addChart

Inserts a chart into a Word document.

Note

You are reading the XML API documentation. For the PHP API method please go to addChart.

Description

Element definition

This element allows the insertion of a chart into your Word document.

You may insert many different types of 2D and 3D charts:

  • 2D
    • Bar (clustered, stacked and 100% stacked).
    • Column (clustered, stacked and 100% stacked).
    • Doughnut.
    • Line.
    • Area.
    • Surface.
    • Radar.
    • XY(scatter).
    • Bubble.
  • 3D
    • Bar: box (default), cylinder, cone, and pyramid (clustered, stacked and 100% stacked).
    • Column: box (default), cylinder, cone, and pyramid (clustered, stacked and 100% stacked).
    • Pie (simple and exploded).
    • Surface.
    • Line.

Attributes and sub-elements
Key Description
chartType The possible values are:
  • barChart
  • bar3DChart
  • bar3DChartCylinder
  • bar3DChartCone
  • bar3DChartPyramid
  • col3DChart
  • col3DChartCylinder
  • col3DChartCone
  • bar3DChartPyramid
  • pieChart
  • pie3DChart
  • ofPieChart (pie of pie and bar of pie charts)
  • lineChart
  • line3DChart
  • areaChart
  • area3DChart
  • radarChart
  • scatterChart
  • bubbleChart
  • doughnutChart
  • surfaceChart
title The chart title (if any).
border Border width in points.
color Word color scheme for charts:
  • 1: greyscale
  • 2: default Word color scheme for charts
  • 3: blue scheme
  • for the remaining color schemes (up to 48) check the Word interface
chartAlign Chart alignment: left (default), right or center.
externalXLSX Possible attributes and values are:
  • src => (string) path to the external file.
  • occurrences => (array) (optional) by default the option adds all charts of the source file. If occurrences is not empty, it adds the referenced positions. Value from 1.
float Floating chart: left, right or center. It only applies if textWrap is not inline (default value).
font The font to be used. Arial, Calibri...
sizeX The chart width in centimeters (default value aprox 8.5 cm).
sizeY The chart height in centimeters (default value aprox 6.0 cm).
textWrap The way text shoud wrap the chart. Possible values are (check in the Word interface for the graphical explanation of the different terms):
  • 0 (inline)
  • 1 (square)
  • 2 (front)
  • 3 (back)
  • 4 (up and bottom)

Chart display properties

Key Description
formatCode Number format.
formatDataLabels Possible attributes and values are:
  • rotation => int value
  • position => center, insideEnd, insideBase, outsideEnd
haxLabel Label for the horizontal axis.
haxLabelDisplay How to display the label of the horizontal axis. Possible values are: vertical, horizontal, rotated.
hgrid Horizontal grid. Possible values are:
  • 0 (no grid)
  • 1 (only major grid lines - default)
  • 2 (only minor grid lines)
  • 3 (both major and minor grid lines)
horizontalOffset Given in emus (1cm = 360000 emus).
majorUnit Major unit value for bar, col, line, area, radar and scatter charts.
minorUnit Minor unit value for bar, col, line, area, radar and scatter charts.
scalingMax Scaling max value for bar, col, line, area, radar and scatter charts.
scalingMin Scaling max value for bar, col, line, area, radar and scatter charts.
vaxLabel Label for the vertical axis.
vaxLabelDisplay How to display the label of the horizontal axis. Possible values are: vertical, horizontal, rotated.
verticalOffset Given in emus (1cm = 360000 emus).
vgrid Vertical grid. Possible values are:
  • 0 (no grid)
  • 1 (only major grid lines - default)
  • 2 (only minor grid lines)
  • 3 (both major and minor grid lines)

The available parameters to display legends and data include:

Key Description
legendOverlay If true the legend may overlay the chart. This option may hinder the legibility of tha data so it is only recommended if it is crucial to "save space".
legendPos The possible values are:
  • b (bottom)
  • l (left)
  • r (right)
  • t (top)
  • none
showCategory If true shows the categories inside the chart.
showLegendKey If true shows the legend values.
showPercent If true shows the percentage values.
showSeries If true shows the series values.
showTable If true shows the chart data in an associated table.
showValue If true shows the chart data values.

Further configuration options for specific chart types are:

Key Description
Bar and column charts
groupBar Different ways to group the data. Possible values are: clustered, stacked, percentStacked and standard.
tickLblPos Tick label position.
Pie and doughnut charts
explosion Distance among different sectors.
holeSize Size of the inner hole (only doughnut charts).
ofPieCharts: pie of pie and bar of pie charts
custSplit Custom split. Array (zero based) of values that go in the second chart. For example: array(3,4,7) will pick the fourth, fifth and eighth value.
gapWidth Distance between the two charts.
secondPieSize Percentage size of the auxiliary chart.
splitPos Determines the threshold value to split the charts.
splitType How to split the two charts. Possible values are:
  • auto (default split type)
  • cust (custom Split)
  • percent (split by percentage)
  • pos (split by position)
  • val (split by value)
subtype Defines if the auxiliary chart is a pie or bar chart. Possible values are pie or bar.
Line and scatter (XY) charts.
smooth If true it smooths the line (only scatter charts)
symbol The possible symbol values:
  • Line charts: none, dot, plus, square, star, triangle, x, diamond, circle and dash.
  • Scatter charts: dot and line.
symbolSize The size of the symbol used.
Radar charts.
style Defines the radar chart style. Possible values are:
  • radar (lines without dots)
  • marker (lines with dots)
  • filled (filled enclosed area)
Surface charts
wireframe If true the surface is shown as a wireframe.

Additional available options for 3D charts:

Key Description
perspective Perspective angle. Angles beyond 25 degrees provoke a big distortion in the 3D chart representation.
rotX Rotation angle respect the vertical axis. Standard values are between 10 and 20 degrees.
rotY Rotation angle respect the horizontal axis. Standard values are between 10 and 20 degrees.

Theme options (Only available in Premium linceses):

key Description
chartArea backgroundColor
gridLines capType, color, dashType, width
horizontalAxis textBold, textDirection (horizontal, rotate90, rotate270), textItalic, textSize, textUnderline (DrawingML values such as none, sng, dash)
legendArea backgroundColor, textBold, textItalic, textSize, textUnderline
plotArea backgroundColor
serRgbColors series colors
valueRgbColors values colors
verticalAxis textBold, textDirection (horizontal, rotate90, rotate270), textItalic, textSize, textUnderline (DrawingML values such as none, sng, dash)
Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code

The resulting Word document looks like: