Support specifies that each data marker in the series has a different color

This commit is contained in:
xuri 2021-04-10 00:15:39 +08:00
parent a8197485b5
commit 1559dd31be
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
3 changed files with 19 additions and 15 deletions

View File

@ -494,6 +494,7 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
Title: formatChartTitle{
Name: " ",
},
VaryColors: true,
ShowBlanksAs: "gap",
}
err := json.Unmarshal([]byte(formatSet), &format)
@ -711,6 +712,8 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
//
// zero: Specifies that blank values shall be treated as zero.
//
// Specifies that each data marker in the series has a different color by vary_colors. The default value is true.
//
// Set chart offset, scale, aspect ratio setting and print settings by format, same as function AddPicture.
//
// Set the position of the chart plot area by plotarea. The properties that can be set are:

View File

@ -271,7 +271,7 @@ func (f *File) drawBaseChart(formatSet *formatChart) *cPlotArea {
Val: stringPtr("clustered"),
},
VaryColors: &attrValBool{
Val: boolPtr(true),
Val: boolPtr(formatSet.VaryColors),
},
Ser: f.drawChartSeries(formatSet),
Shape: f.drawChartShape(formatSet),
@ -515,7 +515,7 @@ func (f *File) drawDoughnutChart(formatSet *formatChart) *cPlotArea {
return &cPlotArea{
DoughnutChart: &cCharts{
VaryColors: &attrValBool{
Val: boolPtr(true),
Val: boolPtr(formatSet.VaryColors),
},
Ser: f.drawChartSeries(formatSet),
HoleSize: &attrValInt{Val: intPtr(75)},
@ -555,7 +555,7 @@ func (f *File) drawPieChart(formatSet *formatChart) *cPlotArea {
return &cPlotArea{
PieChart: &cCharts{
VaryColors: &attrValBool{
Val: boolPtr(true),
Val: boolPtr(formatSet.VaryColors),
},
Ser: f.drawChartSeries(formatSet),
},
@ -568,7 +568,7 @@ func (f *File) drawPie3DChart(formatSet *formatChart) *cPlotArea {
return &cPlotArea{
Pie3DChart: &cCharts{
VaryColors: &attrValBool{
Val: boolPtr(true),
Val: boolPtr(formatSet.VaryColors),
},
Ser: f.drawChartSeries(formatSet),
},
@ -584,7 +584,7 @@ func (f *File) drawPieOfPieChart(formatSet *formatChart) *cPlotArea {
Val: stringPtr("pie"),
},
VaryColors: &attrValBool{
Val: boolPtr(true),
Val: boolPtr(formatSet.VaryColors),
},
Ser: f.drawChartSeries(formatSet),
SerLines: &attrValString{},
@ -601,7 +601,7 @@ func (f *File) drawBarOfPieChart(formatSet *formatChart) *cPlotArea {
Val: stringPtr("bar"),
},
VaryColors: &attrValBool{
Val: boolPtr(true),
Val: boolPtr(formatSet.VaryColors),
},
Ser: f.drawChartSeries(formatSet),
SerLines: &attrValString{},

View File

@ -553,15 +553,16 @@ type formatChartDimension struct {
// formatChart directly maps the format settings of the chart.
type formatChart struct {
Type string `json:"type"`
Series []formatChartSeries `json:"series"`
Format formatPicture `json:"format"`
Dimension formatChartDimension `json:"dimension"`
Legend formatChartLegend `json:"legend"`
Title formatChartTitle `json:"title"`
XAxis formatChartAxis `json:"x_axis"`
YAxis formatChartAxis `json:"y_axis"`
Chartarea struct {
Type string `json:"type"`
Series []formatChartSeries `json:"series"`
Format formatPicture `json:"format"`
Dimension formatChartDimension `json:"dimension"`
Legend formatChartLegend `json:"legend"`
Title formatChartTitle `json:"title"`
VaryColors bool `json:"vary_colors"`
XAxis formatChartAxis `json:"x_axis"`
YAxis formatChartAxis `json:"y_axis"`
Chartarea struct {
Border struct {
None bool `json:"none"`
} `json:"border"`