Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit 9f5caf6a authored by CharlieC's avatar CharlieC
Browse files

Expose the display blanks attribute to the chart object. Values can be 'span', 'zero' or 'gap'.

Resolves #877

--HG--
branch : 2.5
parent c3b9409bcbeb
......@@ -11,6 +11,7 @@ from openpyxl.descriptors import (
Alias,
MinMax,
Bool,
Set,
)
from openpyxl.descriptors.nested import Nested
from openpyxl.descriptors.sequence import NestedSequence, ValueSequence
......@@ -51,6 +52,7 @@ class ChartBase(Serialisable):
roundedCorners = Bool(allow_none=True)
axId = ValueSequence(expected_type=int)
visible_cells_only = Bool()
display_blanks = Set(values=['span', 'gap', 'zero'])
_series_type = ""
ser = ()
......@@ -78,7 +80,8 @@ class ChartBase(Serialisable):
self.style = None
self.plot_area = PlotArea()
self.axId = axId
super(ChartBase, self).__init__(**kw)
self.display_blanks = 'gap'
def __hash__(self):
"""
......@@ -122,6 +125,7 @@ class ChartBase(Serialisable):
container.sideWall = chart.sideWall
container.backWall = chart.backWall
container.plotVisOnly = self.visible_cells_only
container.dispBlanksAs = self.display_blanks
cs = ChartSpace(chart=container)
cs.style = self.style
cs.roundedCorners = self.roundedCorners
......
......@@ -27,6 +27,8 @@ def read_chart(chartspace):
chart._charts = plot._charts
chart.title = cs.chart.title
chart.display_blanks = cs.chart.dispBlanksAs
chart.visible_cells_only = cs.chart.plotVisOnly
chart.layout = plot.layout
chart.legend = cs.chart.legend
......
......@@ -1187,7 +1187,7 @@
<c:overlay val="0"/>
</c:legend>
<c:plotVisOnly val="0"/>
<c:dispBlanksAs val="gap"/>
<c:dispBlanksAs val="span"/>
<c:showDLblsOverMax val="0"/>
</c:chart>
<c:printSettings>
......
......@@ -119,7 +119,7 @@ class TestChartBase:
<chartSpace xmlns="http://schemas.openxmlformats.org/drawingml/2006/chart">
<chart>
<plotArea>
<DummyChart visible_cells_only="0"></DummyChart>
<DummyChart visible_cells_only="0" display_blanks="gap" />
</plotArea>
<legend>
<legendPos val="r"></legendPos>
......
......@@ -22,6 +22,7 @@ def test_read(datadir):
assert isinstance(chart, LineChart)
assert chart.title.tx.rich.p[0].r[0].t == "Website Performance"
assert chart.display_blanks == "span"
assert isinstance(chart.y_axis, NumericAxis)
assert chart.y_axis.title.tx.rich.p[0].r[0].t == "Time in seconds"
......
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