reader.py 802 B

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