diff --git a/ooui/graph/indicator.py b/ooui/graph/indicator.py index 8c7dcad..b2aed07 100644 --- a/ooui/graph/indicator.py +++ b/ooui/graph/indicator.py @@ -51,6 +51,8 @@ def process(self, value, total=0): 'value': value, 'total': total, } + if self.suffix: + res['suffix'] = self.suffix if self.show_percent: res['percent'] = round_number(value / total * 100) if self.color: diff --git a/spec/graph/graph_spec.py b/spec/graph/graph_spec.py index 01e02f6..ff170fa 100644 --- a/spec/graph/graph_spec.py +++ b/spec/graph/graph_spec.py @@ -20,7 +20,7 @@ with it('should suport indicatorField graphs'): xml = """ - + """ @@ -33,6 +33,7 @@ expect(graph.fields).to(contain_only('potencia')) expect(graph.total_domain).to(be_none) expect(graph.show_percent).to(be_true) + expect(graph.suffix).to(equal('kW')) with it("should parse a chart graph XML with type line"): xml = """ diff --git a/spec/graph/processor_spec.py b/spec/graph/processor_spec.py index f5d8e40..62957c9 100644 --- a/spec/graph/processor_spec.py +++ b/spec/graph/processor_spec.py @@ -48,7 +48,7 @@ def get_graph_data(xml, model): with it('should process indicatorField graph'): xml = """ - + """ @@ -66,6 +66,7 @@ def get_graph_data(xml, model): total=275.72, color='red', icon='slack', + suffix='kW', )) with it('should process indicator graph'):