Class: Chart
A chart graphic-frame's chart, backed by its chart part.
Constructors
Constructor
new Chart(
part,rels?):Chart
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
part | Part | undefined | The chart's OPC part (/ppt/charts/chartN.xml). |
rels | Relationships | null | null | The chart part's relationships, which resolve a picture fill's image; null leaves it unresolved. |
Returns
Chart
Properties
part
readonlypart:Part
The chart's OPC part (/ppt/charts/chartN.xml).
Accessors
axes
Get Signature
get axes():
ChartAxis[]
The category/value/series axes (c:catAx/c:valAx/c:dateAx/c:serAx) in plot-area document order. Empty for pie/doughnut charts (no axes).
Returns
categories
Get Signature
get categories(): (
string|null)[]
Category labels, read from the first series' cached categories (c:cat), as written. Empty when the chart has no category axis.
Returns
(string | null)[]
categoryAxis
Get Signature
get categoryAxis():
ChartAxis|null
The category axis (c:catAx/c:dateAx), or null when the chart has none.
Returns
ChartAxis | null
categoryLevels
Get Signature
get categoryLevels(): (
string|null)[][]
Every category level of the first series, leaf first; see ChartSeries.categoryLevels.
Returns
(string | null)[][]
chartArea
Get Signature
get chartArea():
ChartAreaFormat|null
The chart area's fill and border (c:chartSpace/c:spPr), or null when it states none.
Returns
ChartAreaFormat | null
chartType
Get Signature
get chartType():
string|null
The first chart-group type, or null for an empty plot area.
Returns
string | null
chartTypes
Get Signature
get chartTypes():
string[]
The chart-group type tokens present in the plot area, in document order (e.g. ['line'], ['bar'], ['bar', 'line'] for a combo chart). Derived from the plot-area element local names (lineChart → line).
Returns
string[]
dataLabels
Get Signature
get dataLabels():
ChartDataLabels|null
The chart-level data-label settings, read from the first plot group's aggregate c:dLbls (the group-wide block after the series). null when the plot group carries no data-label block.
A pie keeps its labels on the series instead: PowerPoint writes the flags the user set into c:ser/c:dLbls and leaves this block all off, and this library's writer emits no group block for a pie at all. Read those through ChartSeries.dataLabels.
Returns
ChartDataLabels | null
dataTable
Get Signature
get dataTable():
ChartDataTable|null
The data table under the plot (c:plotArea/c:dTable), or null when the chart draws none.
Returns
ChartDataTable | null
displayBlanksAs
Get Signature
get displayBlanksAs():
string|null
How blank cells plot (c:chart/c:dispBlanksAs): gap, zero or span, or null when unstated.
Returns
string | null
element_
Get Signature
get element_():
Element|null
Escape hatch: the underlying c:chartSpace element. After mutating it call markDirty, or save() writes the original bytes.
Returns
Element | null
language
Get Signature
get language():
string|null
The language the chart's text is tagged with: c:lang, which PowerPoint writes, else the first paragraph end's @lang in the part, where addChart writes its lang. null when neither says.
Returns
string | null
legend
Get Signature
get legend():
ChartLegend|null
The legend (c:chart/c:legend) position + overlay, or null when hidden.
Returns
ChartLegend | null
metadata
Get Signature
get metadata():
Record<string,string> |null
The key/value annotations addChart's metadata option writes: the pptx-ts extension on c:chartSpace/c:extLst (uri {094A432E-1F6C-499B-95B8-B57DC9536949}). null when the chart carries no such extension; an extension with no item reads as an empty map.
Returns
Record<string, string> | null
partName
Get Signature
get partName():
string
Partname of the chart part.
Returns
string
plotArea
Get Signature
get plotArea():
ChartAreaFormat|null
The plot area's fill, border and manual layout, or null when the chart has no plot area.
Returns
ChartAreaFormat | null
plotGroups
Get Signature
get plotGroups():
ChartPlotGroup[]
The plot groups (c:barChart, c:lineChart, …) of the plot area, in document order, each with what it sets on all its series and the series it plots. A combo chart has several.
Returns
roundedCorners
Get Signature
get roundedCorners():
boolean|null
Whether the chart area's corners are rounded (c:roundedCorners), or null when unstated.
Returns
boolean | null
series
Get Signature
get series():
ChartSeries[]
The data series (c:ser) across all chart groups, in document order.
Returns
title
Get Signature
get title():
string|null
The chart title (c:chart/c:title rich text), or null when absent/auto.
Returns
string | null
titleLayout
Get Signature
get titleLayout():
ChartManualLayout|null
The title's manual layout (c:title/c:layout), or null when it is placed automatically.
Returns
ChartManualLayout | null
titleStyle
Get Signature
get titleStyle():
ChartTextStyle|null
The chart title's formatting (c:title/c:tx/c:rich), or null when the chart has no rich title.
Returns
ChartTextStyle | null
valueAxis
Get Signature
get valueAxis():
ChartAxis|null
The (primary) value axis (c:valAx), or null when the chart has none.
Returns
ChartAxis | null
view3D
Get Signature
get view3D():
ChartView3D|null
The 3-D view (c:chart/c:view3D), or null when the chart states none.
Returns
ChartView3D | null
Methods
markDirty()
markDirty():
void
Mark the chart part dirty so save() reserializes it. Call after mutating element_.
Returns
void