Expand description
ChartShape:高阶图表。
图表在 OOXML 中通过 <p:graphicFrame> + <a:graphicData uri="...chart">
<c:chart r:id="..."/>引用一个独立的/ppt/charts/chartN.xmlpart。 本高阶 API 把 graphicFrame 包装为ChartShape,提供类型 / 数据 / rid 的便捷访问,并让Shapetrait 直接可用。
§与 python-pptx 的对应
pptx.chart.Chart←→crate::oxml::chart::Chart(数据/类型/标题);pptx.shapes.graphfrm.GraphicFrame←→ 本ChartShape(承载位置/尺寸 + 引用)。
§写出语义
ChartShape序列化时只写出<p:graphicFrame>+ 引用元素<c:chart r:id="..."/>;- 真正的 chart 数据由
crate::presentation::Presentation::save在to_opc_package中遍历每张 slide 的chart_entries写出独立的chartN.xmlpart; - slide 的
_rels/slideN.xml.rels中会添加chart关系指向该 part。
§限制
- 当前仅支持柱/条/线/饼 4 种类型(见
crate::oxml::chart::ChartType); - 数据通过
<c:numCache>/<c:strCache>内嵌,不依赖嵌入 Excel; - 读取已有图表的 graphicFrame 时,仅保留 r:id 引用,不解析 chartN.xml 内容。
Structs§
- Chart
Shape - 高阶图表形状(承载
<p:graphicFrame>+<c:chart r:id="..."/>引用)。