Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(native_objects): avoid treating chart bounds as axis titles

hugohe3a5a7095f047a
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects.py
index 0a4bd4bc..d41db518 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects.py
@@ -843,12 +843,15 @@ def _axis_titles(payload: dict[str, Any]) -> dict[str, Any]:
axis_map = raw if isinstance(raw, dict) else {}
style_axis_map = style_raw if isinstance(style_raw, dict) else {}
- def pick(*keys: str) -> Any:
+ def pick(axis_keys: tuple[str, ...], root_keys: tuple[str, ...]) -> Any:
values: list[Any] = []
- for key in keys:
+ for key in root_keys:
values.extend((
payload.get(key),
style.get(key),
+ ))
+ for key in axis_keys + root_keys:
+ values.extend((
axis_map.get(key),
style_axis_map.get(key),
))
@@ -856,25 +859,18 @@ def _axis_titles(payload: dict[str, Any]) -> dict[str, Any]:
return {
"category": pick(
- "category",
- "cat",
- "category_axis",
- "categoryAxis",
- "category_axis_title",
- "categoryAxisTitle",
+ ("category", "cat", "category_axis", "categoryAxis"),
+ ("category_axis_title", "categoryAxisTitle"),
+ ),
+ "value": pick(
+ ("value", "val", "value_axis", "valueAxis"),
+ ("value_axis_title", "valueAxisTitle"),
),
- "value": pick("value", "val", "value_axis", "valueAxis", "value_axis_title", "valueAxisTitle"),
- "x": pick("x", "x_axis", "xAxis", "x_axis_title", "xAxisTitle"),
- "y": pick("y", "y_axis", "yAxis", "y_axis_title", "yAxisTitle"),
+ "x": pick(("x", "x_axis", "xAxis"), ("x_axis_title", "xAxisTitle")),
+ "y": pick(("y", "y_axis", "yAxis"), ("y_axis_title", "yAxisTitle")),
"secondary_value": pick(
- "secondary_value",
- "secondaryValue",
- "secondary_value_axis",
- "secondaryValueAxis",
- "secondary_value_axis_title",
- "secondaryValueAxisTitle",
- "right_axis_title",
- "rightAxisTitle",
+ ("secondary_value", "secondaryValue", "secondary_value_axis", "secondaryValueAxis"),
+ ("secondary_value_axis_title", "secondaryValueAxisTitle", "right_axis_title", "rightAxisTitle"),
),
}