Skip to content

Commit 0d193c7

Browse files
committed
This closes qax-os#1492, fix data bar min/max value doesn't work
1 parent dc3bf33 commit 0d193c7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

styles.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3457,7 +3457,9 @@ func extractCondFmtDataBar(c *xlsxCfRule, extLst *xlsxExtLst) ConditionalFormatO
34573457
if c.DataBar != nil {
34583458
format.StopIfTrue = c.StopIfTrue
34593459
format.MinType = c.DataBar.Cfvo[0].Type
3460+
format.MinValue = c.DataBar.Cfvo[0].Val
34603461
format.MaxType = c.DataBar.Cfvo[1].Type
3462+
format.MaxValue = c.DataBar.Cfvo[1].Val
34613463
format.BarColor = "#" + strings.TrimPrefix(strings.ToUpper(c.DataBar.Color[0].RGB), "FF")
34623464
if c.DataBar.ShowValue != nil {
34633465
format.BarOnly = !*c.DataBar.ShowValue
@@ -3707,7 +3709,7 @@ func drawCondFmtDataBar(p int, ct, GUID string, format *ConditionalFormatOptions
37073709
Type: validType[format.Type],
37083710
DataBar: &xlsxDataBar{
37093711
ShowValue: boolPtr(!format.BarOnly),
3710-
Cfvo: []*xlsxCfvo{{Type: format.MinType}, {Type: format.MaxType}},
3712+
Cfvo: []*xlsxCfvo{{Type: format.MinType, Val: format.MinValue}, {Type: format.MaxType, Val: format.MaxValue}},
37113713
Color: []*xlsxColor{{RGB: getPaletteColor(format.BarColor)}},
37123714
},
37133715
ExtLst: extLst,

styles_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func TestGetConditionalFormats(t *testing.T) {
205205
{{Type: "unique", Format: 1, Criteria: "="}},
206206
{{Type: "3_color_scale", Criteria: "=", MinType: "num", MidType: "num", MaxType: "num", MinValue: "-10", MidValue: "50", MaxValue: "10", MinColor: "#FF0000", MidColor: "#00FF00", MaxColor: "#0000FF"}},
207207
{{Type: "2_color_scale", Criteria: "=", MinType: "num", MaxType: "num", MinColor: "#FF0000", MaxColor: "#0000FF"}},
208-
{{Type: "data_bar", Criteria: "=", MinType: "min", MaxType: "max", BarBorderColor: "#0000FF", BarColor: "#638EC6", BarOnly: true, BarSolid: true, StopIfTrue: true}},
208+
{{Type: "data_bar", Criteria: "=", MinType: "num", MaxType: "num", MinValue: "-10", MaxValue: "10", BarBorderColor: "#0000FF", BarColor: "#638EC6", BarOnly: true, BarSolid: true, StopIfTrue: true}},
209209
{{Type: "data_bar", Criteria: "=", MinType: "min", MaxType: "max", BarBorderColor: "#0000FF", BarColor: "#638EC6", BarDirection: "rightToLeft", BarOnly: true, BarSolid: true, StopIfTrue: true}},
210210
{{Type: "formula", Format: 1, Criteria: "="}},
211211
{{Type: "icon_set", IconStyle: "3Arrows", ReverseIcons: true, IconsOnly: true}},

0 commit comments

Comments
 (0)