Charts: setting `valueAxis` skips theme styling of axis labels and axis lines

未关闭
#630 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@ShotaroKataoka 已经在做这个了。

开始于 2026年11月16日。

  • #645 来自 @ShotaroKataoka —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
67/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Start with _add_chart in sdpm/sdpm/engine/builder/elements/chart.py and read how valueAxis, categoryAxis, and _chartFingerprint distinguish edited imports from hand-written JSON. Review tests/test_chart_roundtrip.py and add the stated case: a scale-only valueAxis should retain themed tick-label size and colour. Run the chart round-trip tests; done when the regression passes without changing styling restored for unedited PPTX charts.

由索引模型根据 Issue 内容生成。

描述

bug
What happened?

_add_chart (sdpm/sdpm/engine/builder/elements/chart.py) treats a chart that has valueAxis or categoryAxis as a round-tripped chart (if not val_axis_def and not cat_axis_def:). For such a chart it skips:

  • tick label font size, colour and font (tick_font_size, text_muted, fonts["halfwidth"])
  • the subtle axis line colour and width
  • the title colour (elif not elem.get("valueAxis")) and the data label font

So a chart written by an agent that only sets the scale ("valueAxis": {"min": 0, "max": 5, "majorUnit": 1}) gets the default chart text: large, without the theme colour or font, with default tick marks. The same chart without valueAxis gets 10pt muted labels in the template font.

This affects bar, line and radar. It matters most for radar (#623): its guide recommends valueAxis so the rings match the scoring scale, so most radar charts take this path. Rendering the chart-radar guide's example on blank-dark shows white labels at the default size and white cross tick marks on every spoke. Removing valueAxis gives themed labels.

Expected

Setting the axis scale should not turn off theme styling. Only a chart read back from a PPTX should keep the styling it came with.

Notes for the fix
  • Round-tripped charts are now told apart by _chartFingerprint. An unedited one restores _chartXml and never reaches this code, so this code path only runs for an edited import or for JSON written by hand or by an agent.
  • --minimal JSON (sdpm/sdpm/engine/schema/minimal.py) drops every _ key, including _chartFingerprint and _chartFontSize. Decide what a minimal round trip should look like before choosing the new condition.
  • Tests: tests/test_chart_roundtrip.py. Add a case where valueAxis with only min/max/majorUnit still gets the themed tick label font size and colour.
Version

main at a44c66a3 (plus #623 for the radar case)

主要语言
Python
星标
136
派生
13
平均合并
7 小时 36 分钟
30 天内合并 PR
175

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws-samples/sample-spec-driven-presentation-maker 的其他 Issue

查看 aws-samples/sample-spec-driven-presentation-maker 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。