From f952019abdce1c85ebf7a3d93e929d397b65fe1d Mon Sep 17 00:00:00 2001 From: Todd Date: Tue, 5 Sep 2017 20:53:11 -0400 Subject: [PATCH] chart: more docs --- chart/axis.go | 2 ++ chart/axis_test.go | 20 ++++++++++++++++++++ chart/barchartseries.go | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 chart/axis_test.go diff --git a/chart/axis.go b/chart/axis.go index a73fd0dc..809cb6fa 100644 --- a/chart/axis.go +++ b/chart/axis.go @@ -7,6 +7,8 @@ package chart +// Axis is the interface implemented by different axes when assigning to a +// chart. type Axis interface { AxisID() uint32 } diff --git a/chart/axis_test.go b/chart/axis_test.go new file mode 100644 index 00000000..015e6b9c --- /dev/null +++ b/chart/axis_test.go @@ -0,0 +1,20 @@ +// Copyright 2017 Baliance. All rights reserved. +// +// Use of this source code is governed by the terms of the Affero GNU General +// Public License version 3.0 as published by the Free Software Foundation and +// appearing in the file LICENSE included in the packaging of this file. A +// commercial license can be purchased by contacting sales@baliance.com. + +package chart_test + +import ( + "testing" + + "baliance.com/gooxml/chart" +) + +func TestNullAxis(t *testing.T) { + if chart.NullAxis.AxisID() != 0 { + t.Errorf("expected null axis to have ID 0, go %d", chart.NullAxis.AxisID()) + } +} diff --git a/chart/barchartseries.go b/chart/barchartseries.go index 77ad1985..8b57daf0 100644 --- a/chart/barchartseries.go +++ b/chart/barchartseries.go @@ -13,6 +13,7 @@ import ( crt "baliance.com/gooxml/schema/schemas.openxmlformats.org/drawingml/2006/chart" ) +// BarChartSeries is a series to be used on a bar chart. type BarChartSeries struct { x *crt.CT_BarSer } @@ -26,7 +27,7 @@ func (c BarChartSeries) X() *crt.CT_BarSer { func (c BarChartSeries) InitializeDefaults() { } -// SetText sets the series text +// SetText sets the series text. func (c BarChartSeries) SetText(s string) { c.x.Tx = crt.NewCT_SerTx() c.x.Tx.Choice.V = &s @@ -39,6 +40,7 @@ func (c BarChartSeries) CategoryAxis() AxisDataSource { return MakeAxisDataSource(c.x.Cat) } +// func (c BarChartSeries) Values() NumberDataSource { if c.x.Val == nil { c.x.Val = crt.NewCT_NumDataSource()