mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +08:00
chart: more docs
This commit is contained in:
parent
04f24736db
commit
f952019abd
@ -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
20
chart/axis_test.go
Normal 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())
|
||||
}
|
||||
}
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user