Support specifies the values in second plot for the bar/pie of pie chart
- Upgrade dependencies package golang.org/x/image to 0.5.0 - Update unit tests
This commit is contained in:
parent
21ec143778
commit
cb0c1b012b
4
chart.go
4
chart.go
|
@ -751,6 +751,7 @@ func parseChartOptions(opts *Chart) (*Chart, error) {
|
|||
// Set the position of the chart plot area by PlotArea. The properties that can
|
||||
// be set are:
|
||||
//
|
||||
// SecondPlotValues
|
||||
// ShowBubbleSize
|
||||
// ShowCatName
|
||||
// ShowLeaderLines
|
||||
|
@ -758,6 +759,9 @@ func parseChartOptions(opts *Chart) (*Chart, error) {
|
|||
// ShowSerName
|
||||
// ShowVal
|
||||
//
|
||||
// SecondPlotValues: Specifies the values in second plot for the 'pieOfPie' and
|
||||
// 'barOfPie' chart.
|
||||
//
|
||||
// ShowBubbleSize: Specifies the bubble size shall be shown in a data label. The
|
||||
// 'ShowBubbleSize' property is optional. The default value is false.
|
||||
//
|
||||
|
|
|
@ -186,12 +186,13 @@ func TestAddChart(t *testing.T) {
|
|||
}
|
||||
legend := ChartLegend{Position: "left", ShowLegendKey: false}
|
||||
plotArea := ChartPlotArea{
|
||||
ShowBubbleSize: true,
|
||||
ShowCatName: true,
|
||||
ShowLeaderLines: false,
|
||||
ShowPercent: true,
|
||||
ShowSerName: true,
|
||||
ShowVal: true,
|
||||
SecondPlotValues: 3,
|
||||
ShowBubbleSize: true,
|
||||
ShowCatName: true,
|
||||
ShowLeaderLines: false,
|
||||
ShowPercent: true,
|
||||
ShowSerName: true,
|
||||
ShowVal: true,
|
||||
}
|
||||
for _, c := range []struct {
|
||||
sheetName, cell string
|
||||
|
|
10
drawing.go
10
drawing.go
|
@ -602,6 +602,10 @@ func (f *File) drawPie3DChart(opts *Chart) *cPlotArea {
|
|||
// drawPieOfPieChart provides a function to draw the c:plotArea element for
|
||||
// pie chart by given format sets.
|
||||
func (f *File) drawPieOfPieChart(opts *Chart) *cPlotArea {
|
||||
var splitPos *attrValInt
|
||||
if opts.PlotArea.SecondPlotValues > 0 {
|
||||
splitPos = &attrValInt{Val: intPtr(opts.PlotArea.SecondPlotValues)}
|
||||
}
|
||||
return &cPlotArea{
|
||||
OfPieChart: &cCharts{
|
||||
OfPieType: &attrValString{
|
||||
|
@ -611,6 +615,7 @@ func (f *File) drawPieOfPieChart(opts *Chart) *cPlotArea {
|
|||
Val: opts.VaryColors,
|
||||
},
|
||||
Ser: f.drawChartSeries(opts),
|
||||
SplitPos: splitPos,
|
||||
SerLines: &attrValString{},
|
||||
},
|
||||
}
|
||||
|
@ -619,6 +624,10 @@ func (f *File) drawPieOfPieChart(opts *Chart) *cPlotArea {
|
|||
// drawBarOfPieChart provides a function to draw the c:plotArea element for
|
||||
// pie chart by given format sets.
|
||||
func (f *File) drawBarOfPieChart(opts *Chart) *cPlotArea {
|
||||
var splitPos *attrValInt
|
||||
if opts.PlotArea.SecondPlotValues > 0 {
|
||||
splitPos = &attrValInt{Val: intPtr(opts.PlotArea.SecondPlotValues)}
|
||||
}
|
||||
return &cPlotArea{
|
||||
OfPieChart: &cCharts{
|
||||
OfPieType: &attrValString{
|
||||
|
@ -627,6 +636,7 @@ func (f *File) drawBarOfPieChart(opts *Chart) *cPlotArea {
|
|||
VaryColors: &attrValBool{
|
||||
Val: opts.VaryColors,
|
||||
},
|
||||
SplitPos: splitPos,
|
||||
Ser: f.drawChartSeries(opts),
|
||||
SerLines: &attrValString{},
|
||||
},
|
||||
|
|
2
go.mod
2
go.mod
|
@ -9,7 +9,7 @@ require (
|
|||
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470
|
||||
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22
|
||||
golang.org/x/crypto v0.5.0
|
||||
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69
|
||||
golang.org/x/image v0.5.0
|
||||
golang.org/x/net v0.7.0
|
||||
golang.org/x/text v0.7.0
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -24,8 +24,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
|||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 h1:Lj6HJGCSn5AjxRAH2+r35Mir4icalbqku+CLUtjnvXY=
|
||||
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
|
||||
golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI=
|
||||
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
|
|
14
xmlChart.go
14
xmlChart.go
|
@ -333,6 +333,7 @@ type cCharts struct {
|
|||
VaryColors *attrValBool `xml:"varyColors"`
|
||||
Wireframe *attrValBool `xml:"wireframe"`
|
||||
Ser *[]cSer `xml:"ser"`
|
||||
SplitPos *attrValInt `xml:"splitPos"`
|
||||
SerLines *attrValString `xml:"serLines"`
|
||||
DLbls *cDLbls `xml:"dLbls"`
|
||||
Shape *attrValString `xml:"shape"`
|
||||
|
@ -540,12 +541,13 @@ type ChartDimension struct {
|
|||
|
||||
// ChartPlotArea directly maps the format settings of the plot area.
|
||||
type ChartPlotArea struct {
|
||||
ShowBubbleSize bool
|
||||
ShowCatName bool
|
||||
ShowLeaderLines bool
|
||||
ShowPercent bool
|
||||
ShowSerName bool
|
||||
ShowVal bool
|
||||
SecondPlotValues int
|
||||
ShowBubbleSize bool
|
||||
ShowCatName bool
|
||||
ShowLeaderLines bool
|
||||
ShowPercent bool
|
||||
ShowSerName bool
|
||||
ShowVal bool
|
||||
}
|
||||
|
||||
// Chart directly maps the format settings of the chart.
|
||||
|
|
Loading…
Reference in New Issue