Appearance
Class: Diagram ​
A SmartArt graphic frame's diagram, backed by its dgm:dataModel part.
Constructors ​
Constructor ​
new Diagram(
part,relIds,opc,frameRelationships,themeContext):Diagram
Parameters ​
| Parameter | Type | Description |
|---|---|---|
part | Part | The diagram's data part (/ppt/diagrams/data{N}.xml), whose root is dgm:dataModel. |
relIds | Element | The frame's dgm:relIds, which names the other three parts by relationship id. |
opc | OpcPackage | - |
frameRelationships | Relationships | Relationships of the part holding the frame — what dgm:relIds resolves against. |
themeContext | ThemeContext | - |
Returns ​
Diagram
Properties ​
part ​
readonlypart:Part
The diagram's data part (/ppt/diagrams/data{N}.xml), whose root is dgm:dataModel.
Accessors ​
colorsPart ​
Get Signature ​
get colorsPart():
Part|null
The colours part (dgm:relIds/@r:cs), or null when missing from the package.
Returns ​
Part | null
colorsTypeId ​
Get Signature ​
get colorsTypeId():
string|null
The colour preset (the doc point's dgm:prSet/@csTypeId).
Returns ​
string | null
connections ​
Get Signature ​
get connections():
DiagramConnection[]
Every edge (dgm:cxnLst/dgm:cxn) in document order.
Returns ​
drawingPart ​
Get Signature ​
get drawingPart():
Part|null
The fallback drawing part (dsp:drawing) that renders the diagram for a consumer with no SmartArt layout engine, or null when the deck carries none. It is named by an MS extension on the data model rather than by dgm:relIds, so a slide holding two diagrams still resolves each to its own drawing.
Returns ​
Part | null
element_ ​
Get Signature ​
get element_():
Element|null
Escape hatch: the underlying dgm:dataModel element. After mutating it call markDirty, or save() writes the original bytes.
Returns ​
Element | null
layoutPart ​
Get Signature ​
get layoutPart():
Part|null
The layout definition part (dgm:relIds/@r:lo), or null when missing from the package.
Returns ​
Part | null
layoutTypeId ​
Get Signature ​
get layoutTypeId():
string|null
The layout preset the diagram is drawn with (the doc point's dgm:prSet/@loTypeId), e.g. urn:microsoft.com/office/officeart/2005/8/layout/hList1. This is what names the SmartArt kind; layoutPart is that preset's definition.
Returns ​
string | null
nodes ​
Get Signature ​
get nodes():
DiagramNode[]
The authored tree — every node and asst point in its place, roots in @srcOrd order — as a view over points and connections rather than a replacement for either.
A root is a content point whose parOf parent is not itself content, which in a PowerPoint-authored model means the doc point. Transition points are not members; see this module's header for that decision and the two beside it.
Throws ​
PackageReadError diagram/parent-edge-cycle when the parOf edges make a point its own ancestor, which is a corrupt model rather than a diagram shape.
Returns ​
partName ​
Get Signature ​
get partName():
string
Partname of the diagram data part.
Returns ​
string
points ​
Get Signature ​
get points():
DiagramPoint[]
Every point (dgm:ptLst/dgm:pt) in document order, unfiltered — generated pres points and the doc root included. Filter on DiagramPoint.type for the user's nodes; text is the shortcut for the common case, nodes the structured one.
Built per access like every other read proxy (docs/reference/read-object-model.md, "Object model"), so points[0] !== points[0] while both wrap the same dgm:pt. Key a Map on DiagramPoint.modelId, not on the point.
Returns ​
quickStylePart ​
Get Signature ​
get quickStylePart():
Part|null
The quick-style part (dgm:relIds/@r:qs), or null when missing from the package.
Returns ​
Part | null
quickStyleTypeId ​
Get Signature ​
get quickStyleTypeId():
string|null
The quick-style preset (the doc point's dgm:prSet/@qsTypeId).
Returns ​
string | null
text ​
Get Signature ​
get text():
string
The diagram's text in document order, blocks joined by \n — the counterpart to TextFrame.text for a construct that has no single text body.
Contributing points are the ones a user can type into: everything except the generated pres points, the doc root, and any point flagged as an unfilled placeholder. A point with no text contributes no blank line. Transition labels (parTrans/sibTrans) are included where a layout has them, which is why this is not simply the node list.
Returns ​
string
Methods ​
markDirty() ​
markDirty():
void
Mark the diagram data part dirty so save() reserializes it. Call after mutating element_.
Returns ​
void
point() ​
point(
modelId):DiagramPoint|null
The point with this @modelId, or null — the lookup every connection getter implies, since a DiagramConnection names its ends by id and nothing else resolves them.
Parameters ​
| Parameter | Type |
|---|---|
modelId | string |
Returns ​
DiagramPoint | null