This recover the Sizes field in the ChartSeries data type removed in commit dfaf418f34
- Update unit tests and documentation of the internal uintPtr function
This commit is contained in:
parent
e998c374ac
commit
8831afc558
6
chart.go
6
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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
4
lib.go
4
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 }
|
||||
|
|
|
@ -607,6 +607,7 @@ type ChartSeries struct {
|
|||
Name string
|
||||
Categories string
|
||||
Values string
|
||||
Sizes string
|
||||
Fill Fill
|
||||
Line ChartLine
|
||||
Marker ChartMarker
|
||||
|
|
Loading…
Reference in New Issue