Charts: add area charts (chartType "area")

Đang mở
#620 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
77/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Read the chart builder in sdpm/sdpm/engine/builder/elements/chart.py and converter in sdpm/sdpm/engine/converter/chart.py, then check the lint rules and the chart round-trip tests. Use the bar-variant and bar-series-color tests as models; update the guides and changelog listed in the issue. Done when area charts build and round-trip with stacked state and series data, lint validates area, and the specified checks pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement good first issue
What problem would this solve?

Native charts support chartType bar, line, pie and donut only. Area charts are common in business decks (volume over time, stacked share of a total), and python-pptx builds them natively (XL_CHART_TYPE.AREA, AREA_STACKED). Today an agent has to fall back to a line chart, and an area chart imported with pptx_to_json is read as a bar chart that only its _chartXml keeps (_chartRebuildable: false).

Proposed solution

Add chartType: "area", with the existing stacked flag:

{
  "type": "chart", "chartType": "area",
  "x": 192, "y": 216, "width": 1536, "height": 700,
  "categories": ["Jan", "Feb", "Mar", "Apr"],
  "series": [
    {"name": "Lambda", "values": [120, 150, 180, 210], "color": "#FF9900"},
    {"name": "ECS", "values": [80, 95, 90, 130], "color": "#41B3FF"}
  ],
  "stacked": true,
  "legend": true,
  "dataLabels": false
}
  • stacked: false → XL_CHART_TYPE.AREA, stacked: true → XL_CHART_TYPE.AREA_STACKED. 100% stacked (AREA_STACKED_100) is out of scope and stays non-rebuildable.
  • Axes, valueAxis / categoryAxis, numberFormat, style (gridlines, fonts, legend position) work as for bar. Series color is the area fill.

Files to touch:

  • sdpm/sdpm/engine/builder/elements/chart.py (_add_chart): the type_map, and the series colour branch (it handles line and pie/donut separately; an area series takes a fill like a bar).
  • sdpm/sdpm/engine/converter/chart.py (extract_chart_element): map AREA / AREA_STACKED in type_map so the chart reads back as area and becomes rebuildable.
  • sdpm/sdpm/engine/schema/lint.py: add area to _CHART_TYPES, update the "Specify bar, line, pie, or donut" message, and let the "stacked is only valid for bar" rule accept area.
  • Docs: the chart section of sdpm/references/guides/slide-json-media.md (chartType list and guide list), and a new sdpm/references/guides/chart-area.md modelled on chart-line.md. If you add the guide, also add it next to chart-bar / chart-line / chart-pie in sdpm/references/guides/slide-json-spec.md and sdpm/references/workflows/composer.md.
  • CHANGELOG.md: an entry under [Unreleased] → Added.

Done when

  • chartType: "area" builds an c:areaChart (stacked and not stacked), and pptx_to_json reads it back as chartType: "area" with stacked, categories, series names, values and colours intact.
  • An edited area chart is rebuilt from its JSON: drop "area" from the kind list of TestChartsTheJsonCannotDescribe::test_edited_chart_keeps_its_type in tests/test_chart_roundtrip.py, and point the other tests in that class that use "area" at another non-rebuildable kind (radar or stacked100).
  • Lint accepts area and still rejects unknown types.
  • make lint and uv run pytest tests/test_chart_roundtrip.py -v pass.

Tests to copy: TestChartTypes::test_bar_variants and TestColors::test_bar_series_colors in tests/test_chart_roundtrip.py (they use _one_chart / _built_chart, no LibreOffice needed).

Which area?

Slide generation / engine (layouts, elements, charts)

🤖 Created by Kiro Crew

Ngôn ngữ chính
Python
Star
136
Fork
13
Merge trung bình
7 giờ 36 phút
Pull request đã merge (30 ngày)
175

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aws-samples/sample-spec-driven-presentation-maker

Tất cả issue của aws-samples/sample-spec-driven-presentation-maker

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.