1 Star 0 Fork 1

窦雪峰 / unioffice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
categoryaxisdatasource.go 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
Todd 提交于 2017-09-23 08:39 . schema: rename drawingml to dml
// 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
import (
crt "baliance.com/gooxml/schema/soo/dml/chart"
)
// CategoryAxisDataSource specifies the data for an axis. It's commonly used with
// SetReference to set the axis data to a range of cells.
type CategoryAxisDataSource struct {
x *crt.CT_AxDataSource
}
// MakeAxisDataSource constructs an AxisDataSource wrapper.
func MakeAxisDataSource(x *crt.CT_AxDataSource) CategoryAxisDataSource {
return CategoryAxisDataSource{x}
}
// SetLabelReference is used to set the source data to a range of cells
// containing strings.
func (a CategoryAxisDataSource) SetLabelReference(s string) {
a.x.Choice = crt.NewCT_AxDataSourceChoice()
a.x.Choice.StrRef = crt.NewCT_StrRef()
a.x.Choice.StrRef.F = s
}
// SetNumberReference is used to set the source data to a range of cells containing
// numbers.
func (a CategoryAxisDataSource) SetNumberReference(s string) {
a.x.Choice = crt.NewCT_AxDataSourceChoice()
a.x.Choice.NumRef = crt.NewCT_NumRef()
a.x.Choice.NumRef.F = s
}
// SetValues is used to set the source data to a set of values.
func (a CategoryAxisDataSource) SetValues(v []string) {
a.x.Choice = crt.NewCT_AxDataSourceChoice()
a.x.Choice.StrLit = crt.NewCT_StrData()
a.x.Choice.StrLit.PtCount = crt.NewCT_UnsignedInt()
a.x.Choice.StrLit.PtCount.ValAttr = uint32(len(v))
for i, x := range v {
a.x.Choice.StrLit.Pt = append(a.x.Choice.StrLit.Pt,
&crt.CT_StrVal{
IdxAttr: uint32(i),
V: x})
}
}
1
https://gitee.com/douxuefeng/unioffice.git
git@gitee.com:douxuefeng/unioffice.git
douxuefeng
unioffice
unioffice
v0.7.1

搜索帮助

53164aa7 5694891 3bd8fe86 5694891