diff --git a/chart.go b/chart.go index d054841adb7063005a63ab8953f1ed50fbf5d056..3321697c8bf4a352bc3eab548917b8e800884abe 100644 --- a/chart.go +++ b/chart.go @@ -707,7 +707,11 @@ func (opts *Chart) parseTitle() { // mandatory option for every chart object. This option links the chart with // the worksheet data that it displays. // -// Fill: This set the format for the data series fill. +// Sizes: This sets the bubble size in a data series. The 'Sizes' property is +// optional and the default value was same with 'Values'. +// +// Fill: This set the format for the data series fill. The 'Fill' property is +// optional // // Line: This sets the line format of the line chart. The 'Line' property is // optional and if it isn't supplied it will default style. The options that diff --git a/chart_test.go b/chart_test.go index 350852eb4e8e27e6517e4cbd7d008f0c3a89e779..79501eeb7f3e2326b5e415a4bfb6b7f396ed21af 100644 --- a/chart_test.go +++ b/chart_test.go @@ -176,14 +176,14 @@ func TestAddChart(t *testing.T) { } series3 := []ChartSeries{{Name: "Sheet1!$A$30", Categories: "Sheet1!$A$30:$D$37", Values: "Sheet1!$B$30:$B$37"}} series4 := []ChartSeries{ - {Name: "Sheet1!$A$30", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$30:$D$30", DataLabelPosition: ChartDataLabelsPositionAbove}, - {Name: "Sheet1!$A$31", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$31:$D$31", DataLabelPosition: ChartDataLabelsPositionLeft}, - {Name: "Sheet1!$A$32", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$32:$D$32", DataLabelPosition: ChartDataLabelsPositionBestFit}, - {Name: "Sheet1!$A$33", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$33:$D$33", DataLabelPosition: ChartDataLabelsPositionCenter}, - {Name: "Sheet1!$A$34", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$34:$D$34", DataLabelPosition: ChartDataLabelsPositionInsideBase}, - {Name: "Sheet1!$A$35", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$35:$D$35", DataLabelPosition: ChartDataLabelsPositionInsideEnd}, - {Name: "Sheet1!$A$36", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$36:$D$36", DataLabelPosition: ChartDataLabelsPositionOutsideEnd}, - {Name: "Sheet1!$A$37", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$37:$D$37", DataLabelPosition: ChartDataLabelsPositionRight}, + {Name: "Sheet1!$A$30", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$30:$D$30", Sizes: "Sheet1!$B$30:$D$30", DataLabelPosition: ChartDataLabelsPositionAbove}, + {Name: "Sheet1!$A$31", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$31:$D$31", Sizes: "Sheet1!$B$31:$D$31", DataLabelPosition: ChartDataLabelsPositionLeft}, + {Name: "Sheet1!$A$32", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$32:$D$32", Sizes: "Sheet1!$B$32:$D$32", DataLabelPosition: ChartDataLabelsPositionBestFit}, + {Name: "Sheet1!$A$33", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$33:$D$33", Sizes: "Sheet1!$B$33:$D$33", DataLabelPosition: ChartDataLabelsPositionCenter}, + {Name: "Sheet1!$A$34", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$34:$D$34", Sizes: "Sheet1!$B$34:$D$34", DataLabelPosition: ChartDataLabelsPositionInsideBase}, + {Name: "Sheet1!$A$35", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$35:$D$35", Sizes: "Sheet1!$B$35:$D$35", DataLabelPosition: ChartDataLabelsPositionInsideEnd}, + {Name: "Sheet1!$A$36", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$36:$D$36", Sizes: "Sheet1!$B$36:$D$36", DataLabelPosition: ChartDataLabelsPositionOutsideEnd}, + {Name: "Sheet1!$A$37", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$37:$D$37", Sizes: "Sheet1!$B$37:$D$37", DataLabelPosition: ChartDataLabelsPositionRight}, } format := GraphicOptions{ ScaleX: defaultDrawingScale, diff --git a/drawing.go b/drawing.go index 43e33128f04c6ed9348e949ee48ac4dfb5776782..6003235254a639d078d698315a749516c4d7f41e 100644 --- a/drawing.go +++ b/drawing.go @@ -891,9 +891,13 @@ func (f *File) drawCharSeriesBubbleSize(v ChartSeries, opts *Chart) *cVal { if _, ok := map[ChartType]bool{Bubble: true, Bubble3D: true}[opts.Type]; !ok { return nil } + fVal := v.Values + if v.Sizes != "" { + fVal = v.Sizes + } return &cVal{ NumRef: &cNumRef{ - F: v.Values, + F: fVal, }, } } diff --git a/lib.go b/lib.go index bc564225e266214a7e0d93db97f749c35a2da1b3..db0d7d7a8047e178d492b47d42bb2e71a3f1ef48 100644 --- a/lib.go +++ b/lib.go @@ -431,8 +431,8 @@ func boolPtr(b bool) *bool { return &b } // intPtr returns a pointer to an int with the given value. func intPtr(i int) *int { return &i } -// uintPtr returns a pointer to an int with the given value. -func uintPtr(i uint) *uint { return &i } +// uintPtr returns a pointer to an unsigned integer with the given value. +func uintPtr(u uint) *uint { return &u } // float64Ptr returns a pointer to a float64 with the given value. func float64Ptr(f float64) *float64 { return &f } diff --git a/xmlChart.go b/xmlChart.go index 5e209303b6c32bc04b562d71a3b6014d247b6c6c..175fc866d252c8428142fec4c2482df9e416d5e7 100644 --- a/xmlChart.go +++ b/xmlChart.go @@ -607,6 +607,7 @@ type ChartSeries struct { Name string Categories string Values string + Sizes string Fill Fill Line ChartLine Marker ChartMarker