summaryrefslogtreecommitdiff
path: root/drawing.go
diff options
context:
space:
mode:
authorArtem Tarasenko <Beeb0p@users.noreply.github.com>2022-09-13 19:05:05 +0300
committerGitHub <noreply@github.com>2022-09-14 00:05:05 +0800
commit73cc4bd44933994ffa8efad9c3e05fe7cb826b49 (patch)
treebbe07292ad8a64ee231664b9615d263203c09ca7 /drawing.go
parentb6cc43d8242fd3f7f0c6163db9fcd759b9b992b1 (diff)
This closes #1345, support set custom line color in the charts (#1346)
Diffstat (limited to 'drawing.go')
-rw-r--r--drawing.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/drawing.go b/drawing.go
index 59b6d2a..e05c9be 100644
--- a/drawing.go
+++ b/drawing.go
@@ -768,6 +768,16 @@ func (f *File) drawChartSeries(formatSet *formatChart) *[]cSer {
// drawChartSeriesSpPr provides a function to draw the c:spPr element by given
// format sets.
func (f *File) drawChartSeriesSpPr(i int, formatSet *formatChart) *cSpPr {
+ var srgbClr *attrValString
+ var schemeClr *aSchemeClr
+
+ if color := stringPtr(formatSet.Series[i].Line.Color); *color != "" {
+ *color = strings.TrimPrefix(*color, "#")
+ srgbClr = &attrValString{Val: color}
+ } else {
+ schemeClr = &aSchemeClr{Val: "accent" + strconv.Itoa((formatSet.order+i)%6+1)}
+ }
+
spPrScatter := &cSpPr{
Ln: &aLn{
W: 25400,
@@ -779,7 +789,8 @@ func (f *File) drawChartSeriesSpPr(i int, formatSet *formatChart) *cSpPr {
W: f.ptToEMUs(formatSet.Series[i].Line.Width),
Cap: "rnd", // rnd, sq, flat
SolidFill: &aSolidFill{
- SchemeClr: &aSchemeClr{Val: "accent" + strconv.Itoa((formatSet.order+i)%6+1)},
+ SchemeClr: schemeClr,
+ SrgbClr: srgbClr,
},
},
}