Am .07.2015, 18:38 Uhr, schrieb <
schacht...@gmail.com>:
> chart_object= charts.LineChart()
> x_axis= charts.Reference(overall_stats_sheet, (11,2), (11, 5))
> chart_object.set_categories(x_axis)
First of all,
hg up 2.3 to use the new charting facilities. The API is similar but not
entirely backwards compatible: everything related to charts was rewritten.
Assuming Delay = A11:D11
from openpyxl.chart import LineChart, Reference, Series
chart = LineChart()
timings = Reference(overall_stats_sheet, min_row=11, min_col=2, max_col=4)
# avoid calling it x_axis because the chart_object has an x-axis
erasure = Reference(overall_stats_sheet, min_row=15, min_col=1, max_col=4)
chart.series.append(Series(erasure, title_from_data=True)
# rinse and repeat for the other rows
chart.set_categories(timings) # this must be done after the series are
added.
Save the file, crack open a beer… Send me a pull request with the
documentation of how to do a line chart.
Charlie
PS. I was looking at whether you can have non-contiguous values in a
series. I suspect that it might be possible if you are prepared to work
with values as opposed to cell references but it's essentially
undocumented. Each series has one, and one only, values references. We
only work with the reference to cells in a worksheet and evaluate the
values but there are other possibilities. The primitives to do this are in
the source.
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel:
+49-211-600-3657
Mobile:
+49-178-782-6226