Skip to content

Commit 8831afc

Browse files
committed
This recover the Sizes field in the ChartSeries data type removed in commit dfaf418
- Update unit tests and documentation of the internal uintPtr function
1 parent e998c37 commit 8831afc

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

chart.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,11 @@ func (opts *Chart) parseTitle() {
707707
// mandatory option for every chart object. This option links the chart with
708708
// the worksheet data that it displays.
709709
//
710-
// Fill: This set the format for the data series fill.
710+
// Sizes: This sets the bubble size in a data series. The 'Sizes' property is
711+
// optional and the default value was same with 'Values'.
712+
//
713+
// Fill: This set the format for the data series fill. The 'Fill' property is
714+
// optional
711715
//
712716
// Line: This sets the line format of the line chart. The 'Line' property is
713717
// optional and if it isn't supplied it will default style. The options that

chart_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ func TestAddChart(t *testing.T) {
176176
}
177177
series3 := []ChartSeries{{Name: "Sheet1!$A$30", Categories: "Sheet1!$A$30:$D$37", Values: "Sheet1!$B$30:$B$37"}}
178178
series4 := []ChartSeries{
179-
{Name: "Sheet1!$A$30", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$30:$D$30", DataLabelPosition: ChartDataLabelsPositionAbove},
180-
{Name: "Sheet1!$A$31", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$31:$D$31", DataLabelPosition: ChartDataLabelsPositionLeft},
181-
{Name: "Sheet1!$A$32", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$32:$D$32", DataLabelPosition: ChartDataLabelsPositionBestFit},
182-
{Name: "Sheet1!$A$33", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$33:$D$33", DataLabelPosition: ChartDataLabelsPositionCenter},
183-
{Name: "Sheet1!$A$34", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$34:$D$34", DataLabelPosition: ChartDataLabelsPositionInsideBase},
184-
{Name: "Sheet1!$A$35", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$35:$D$35", DataLabelPosition: ChartDataLabelsPositionInsideEnd},
185-
{Name: "Sheet1!$A$36", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$36:$D$36", DataLabelPosition: ChartDataLabelsPositionOutsideEnd},
186-
{Name: "Sheet1!$A$37", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$37:$D$37", DataLabelPosition: ChartDataLabelsPositionRight},
179+
{Name: "Sheet1!$A$30", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$30:$D$30", Sizes: "Sheet1!$B$30:$D$30", DataLabelPosition: ChartDataLabelsPositionAbove},
180+
{Name: "Sheet1!$A$31", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$31:$D$31", Sizes: "Sheet1!$B$31:$D$31", DataLabelPosition: ChartDataLabelsPositionLeft},
181+
{Name: "Sheet1!$A$32", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$32:$D$32", Sizes: "Sheet1!$B$32:$D$32", DataLabelPosition: ChartDataLabelsPositionBestFit},
182+
{Name: "Sheet1!$A$33", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$33:$D$33", Sizes: "Sheet1!$B$33:$D$33", DataLabelPosition: ChartDataLabelsPositionCenter},
183+
{Name: "Sheet1!$A$34", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$34:$D$34", Sizes: "Sheet1!$B$34:$D$34", DataLabelPosition: ChartDataLabelsPositionInsideBase},
184+
{Name: "Sheet1!$A$35", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$35:$D$35", Sizes: "Sheet1!$B$35:$D$35", DataLabelPosition: ChartDataLabelsPositionInsideEnd},
185+
{Name: "Sheet1!$A$36", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$36:$D$36", Sizes: "Sheet1!$B$36:$D$36", DataLabelPosition: ChartDataLabelsPositionOutsideEnd},
186+
{Name: "Sheet1!$A$37", Categories: "Sheet1!$B$29:$D$29", Values: "Sheet1!$B$37:$D$37", Sizes: "Sheet1!$B$37:$D$37", DataLabelPosition: ChartDataLabelsPositionRight},
187187
}
188188
format := GraphicOptions{
189189
ScaleX: defaultDrawingScale,

drawing.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,9 +891,13 @@ func (f *File) drawCharSeriesBubbleSize(v ChartSeries, opts *Chart) *cVal {
891891
if _, ok := map[ChartType]bool{Bubble: true, Bubble3D: true}[opts.Type]; !ok {
892892
return nil
893893
}
894+
fVal := v.Values
895+
if v.Sizes != "" {
896+
fVal = v.Sizes
897+
}
894898
return &cVal{
895899
NumRef: &cNumRef{
896-
F: v.Values,
900+
F: fVal,
897901
},
898902
}
899903
}

lib.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ func boolPtr(b bool) *bool { return &b }
431431
// intPtr returns a pointer to an int with the given value.
432432
func intPtr(i int) *int { return &i }
433433

434-
// uintPtr returns a pointer to an int with the given value.
435-
func uintPtr(i uint) *uint { return &i }
434+
// uintPtr returns a pointer to an unsigned integer with the given value.
435+
func uintPtr(u uint) *uint { return &u }
436436

437437
// float64Ptr returns a pointer to a float64 with the given value.
438438
func float64Ptr(f float64) *float64 { return &f }

xmlChart.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ type ChartSeries struct {
607607
Name string
608608
Categories string
609609
Values string
610+
Sizes string
610611
Fill Fill
611612
Line ChartLine
612613
Marker ChartMarker

0 commit comments

Comments
 (0)