Source code

Download source archive ↓

src/openpyxl/chart/reader.py

1# Copyright (c) 2010-2024 openpyxl
2
3"""
4Read a chart
5"""
6
7def read_chart(chartspace):
8    cs = chartspace
9    plot = cs.chart.plotArea
10
11    chart = plot._charts[0]
12    chart._charts = plot._charts
13
14    chart.title = cs.chart.title
15    chart.display_blanks = cs.chart.dispBlanksAs
16    chart.visible_cells_only = cs.chart.plotVisOnly
17    chart.layout = plot.layout
18    chart.legend = cs.chart.legend
19
20    # 3d attributes
21    chart.floor = cs.chart.floor
22    chart.sideWall = cs.chart.sideWall
23    chart.backWall = cs.chart.backWall
24    chart.pivotSource = cs.pivotSource
25    chart.pivotFormats = cs.chart.pivotFmts
26    chart.idx_base = min((s.idx for s in chart.series), default=0)
27    chart._reindex()
28
29    # Border, fill, etc.
30    chart.graphical_properties = cs.graphical_properties
31
32    return chart