chart: more docs

This commit is contained in:
Todd 2017-09-05 20:53:11 -04:00
parent 04f24736db
commit f952019abd
3 changed files with 25 additions and 1 deletions

View File

@ -7,6 +7,8 @@
package chart
// Axis is the interface implemented by different axes when assigning to a
// chart.
type Axis interface {
AxisID() uint32
}

20
chart/axis_test.go Normal file
View File

@ -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())
}
}

View File

@ -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()