reader.py 719 Bytes
Newer Older
CharlieC's avatar
CharlieC committed
1
# Copyright (c) 2010-2021 openpyxl
2
3
4
5
6

"""
Read a chart
"""

7
8
def read_chart(chartspace):
    cs = chartspace
9
    plot = cs.chart.plotArea
CharlieC's avatar
CharlieC committed
10

11
12
    chart = plot._charts[0]
    chart._charts = plot._charts
13
14

    chart.title = cs.chart.title
15
16
    chart.display_blanks = cs.chart.dispBlanksAs
    chart.visible_cells_only = cs.chart.plotVisOnly
17
18
19
    chart.layout = plot.layout
    chart.legend = cs.chart.legend

CharlieC's avatar
CharlieC committed
20
21
22
23
    # 3d attributes
    chart.floor = cs.chart.floor
    chart.sideWall = cs.chart.sideWall
    chart.backWall = cs.chart.backWall
24
25
    chart.pivotSource = cs.pivotSource
    chart.pivotFormats = cs.chart.pivotFmts
26
    chart.idx_base = min((s.idx for s in chart.series), default=0)
27
    chart._reindex()
CharlieC's avatar
CharlieC committed
28

29
    return chart