This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit af28e7a0 authored by CharlieC's avatar CharlieC
Browse files

Adjust implementation to rely on being passed in a chartspace object.

--HG--
branch : 2.5
parent 7ab12ce94c1b
......@@ -19,9 +19,8 @@ _types = ('areaChart', 'area3DChart', 'lineChart', 'line3DChart',
_axes = ('valAx', 'catAx', 'dateAx', 'serAx',)
def read_chart(src):
node = fromstring(src)
cs = ChartSpace.from_tree(node)
def read_chart(chartspace):
cs = chartspace
plot = cs.chart.plotArea
for t in _types:
chart = getattr(plot, t, None)
......@@ -58,7 +57,8 @@ def find_charts(archive, path):
charts = []
for rel in drawing._chart_rels:
chart = get_rel(archive, deps, rel.id, ChartSpace)
cs = get_rel(archive, deps, rel.id, ChartSpace)
chart = read_chart(cs)
chart.anchor = rel.anchor
charts.append(chart)
......
......@@ -3,8 +3,11 @@ from __future__ import absolute_import
from zipfile import ZipFile
from openpyxl.xml.functions import fromstring
from .. line_chart import LineChart
from .. axis import NumericAxis, DateAxis
from .. chartspace import ChartSpace
def test_read(datadir):
......@@ -13,8 +16,10 @@ def test_read(datadir):
with open("chart1.xml") as src:
xml = src.read()
tree = fromstring(xml)
cs = ChartSpace.from_tree(tree)
chart = read_chart(cs)
chart = read_chart(xml)
assert isinstance(chart, LineChart)
assert chart.title.tx.rich.p[0].r.t == "Website Performance"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment