Skip to main content

Module chartshape

Module chartshape 

Source
Expand description

ChartShape:高阶图表。

图表在 OOXML 中通过 <p:graphicFrame> + <a:graphicData uri="...chart">

  • <c:chart r:id="..."/> 引用一个独立的 /ppt/charts/chartN.xml part。 本高阶 API 把 graphicFrame 包装为 ChartShape,提供类型 / 数据 / rid 的便捷访问,并让 Shape trait 直接可用。

§与 python-pptx 的对应

§写出语义

  • ChartShape 序列化时只写出 <p:graphicFrame> + 引用元素 <c:chart r:id="..."/>
  • 真正的 chart 数据由 crate::presentation::Presentation::saveto_opc_package 中遍历每张 slide 的 chart_entries 写出独立的 chartN.xml part;
  • slide 的 _rels/slideN.xml.rels 中会添加 chart 关系指向该 part。

§限制

  • 当前仅支持柱/条/线/饼 4 种类型(见 crate::oxml::chart::ChartType);
  • 数据通过 <c:numCache> / <c:strCache> 内嵌,不依赖嵌入 Excel;
  • 读取已有图表的 graphicFrame 时,仅保留 r:id 引用,不解析 chartN.xml 内容。

Structs§

ChartShape
高阶图表形状(承载 <p:graphicFrame> + <c:chart r:id="..."/> 引用)。