diff --git a/examples/bar_custom/main.go b/examples/bar_custom/main.go index 8250e6e..67dc04a 100644 --- a/examples/bar_custom/main.go +++ b/examples/bar_custom/main.go @@ -55,8 +55,8 @@ func main() { X: xValue, Y: yValue, Text: grob.ArrayOKArray(toString(yValue)...), - Textposition: grob.BarTextpositionAuto, - Hoverinfo: grob.BarHoverinfoNone, + Textposition: grob.ArrayOKValue(grob.BarTextpositionAuto), + Hoverinfo: grob.ArrayOKValue(grob.BarHoverinfoNone), Marker: &grob.BarMarker{ Color: grob.ArrayOKValue(grob.UseColor(grob.Color( markerColor.Hex(), // Use colorfull diff --git a/examples/wasm/main.go b/examples/wasm/main.go index 122762e..b9c71b3 100644 --- a/examples/wasm/main.go +++ b/examples/wasm/main.go @@ -1,3 +1,5 @@ +//go:build ignore + package main import ( diff --git a/generated/v2.19.0/graph_objects/contour_gen.go b/generated/v2.19.0/graph_objects/contour_gen.go index 2d41cbc..724ca1d 100644 --- a/generated/v2.19.0/graph_objects/contour_gen.go +++ b/generated/v2.19.0/graph_objects/contour_gen.go @@ -83,7 +83,7 @@ type Contour struct { // arrayOK: false // type: color // Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. - Fillcolor ColorWithColorScale `json:"fillcolor,omitempty"` + Fillcolor Color `json:"fillcolor,omitempty"` // Hoverinfo // arrayOK: true diff --git a/generated/v2.19.0/graph_objects/contourcarpet_gen.go b/generated/v2.19.0/graph_objects/contourcarpet_gen.go index 649802d..bf59314 100644 --- a/generated/v2.19.0/graph_objects/contourcarpet_gen.go +++ b/generated/v2.19.0/graph_objects/contourcarpet_gen.go @@ -133,7 +133,7 @@ type Contourcarpet struct { // arrayOK: false // type: color // Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. - Fillcolor ColorWithColorScale `json:"fillcolor,omitempty"` + Fillcolor Color `json:"fillcolor,omitempty"` // Hovertext // arrayOK: false diff --git a/generated/v2.19.0/graph_objects/layout_gen.go b/generated/v2.19.0/graph_objects/layout_gen.go index f2027d9..8ef5a01 100644 --- a/generated/v2.19.0/graph_objects/layout_gen.go +++ b/generated/v2.19.0/graph_objects/layout_gen.go @@ -314,7 +314,7 @@ type Layout struct { // arrayOK: false // type: color // Sets the background color of the paper where the graph is drawn. - PaperBgcolor ColorWithColorScale `json:"paper_bgcolor,omitempty"` + PaperBgcolor Color `json:"paper_bgcolor,omitempty"` // Piecolorway // arrayOK: false @@ -326,7 +326,7 @@ type Layout struct { // arrayOK: false // type: color // Sets the background color of the plotting area in-between x and y axes. - PlotBgcolor ColorWithColorScale `json:"plot_bgcolor,omitempty"` + PlotBgcolor Color `json:"plot_bgcolor,omitempty"` // Polar // arrayOK: false diff --git a/generated/v2.29.1/graph_objects/contour_gen.go b/generated/v2.29.1/graph_objects/contour_gen.go index da9c4a7..e9adbd7 100644 --- a/generated/v2.29.1/graph_objects/contour_gen.go +++ b/generated/v2.29.1/graph_objects/contour_gen.go @@ -83,7 +83,7 @@ type Contour struct { // arrayOK: false // type: color // Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. - Fillcolor ColorWithColorScale `json:"fillcolor,omitempty"` + Fillcolor Color `json:"fillcolor,omitempty"` // Hoverinfo // arrayOK: true diff --git a/generated/v2.29.1/graph_objects/contourcarpet_gen.go b/generated/v2.29.1/graph_objects/contourcarpet_gen.go index 5da30cf..e04f9aa 100644 --- a/generated/v2.29.1/graph_objects/contourcarpet_gen.go +++ b/generated/v2.29.1/graph_objects/contourcarpet_gen.go @@ -133,7 +133,7 @@ type Contourcarpet struct { // arrayOK: false // type: color // Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. - Fillcolor ColorWithColorScale `json:"fillcolor,omitempty"` + Fillcolor Color `json:"fillcolor,omitempty"` // Hovertext // arrayOK: false diff --git a/generated/v2.29.1/graph_objects/layout_gen.go b/generated/v2.29.1/graph_objects/layout_gen.go index 9cdcb01..bdcb87a 100644 --- a/generated/v2.29.1/graph_objects/layout_gen.go +++ b/generated/v2.29.1/graph_objects/layout_gen.go @@ -320,7 +320,7 @@ type Layout struct { // arrayOK: false // type: color // Sets the background color of the paper where the graph is drawn. - PaperBgcolor ColorWithColorScale `json:"paper_bgcolor,omitempty"` + PaperBgcolor Color `json:"paper_bgcolor,omitempty"` // Piecolorway // arrayOK: false @@ -332,7 +332,7 @@ type Layout struct { // arrayOK: false // type: color // Sets the background color of the plotting area in-between x and y axes. - PlotBgcolor ColorWithColorScale `json:"plot_bgcolor,omitempty"` + PlotBgcolor Color `json:"plot_bgcolor,omitempty"` // Polar // arrayOK: false diff --git a/generated/v2.31.1/graph_objects/contour_gen.go b/generated/v2.31.1/graph_objects/contour_gen.go index 736984b..e5a4f3a 100644 --- a/generated/v2.31.1/graph_objects/contour_gen.go +++ b/generated/v2.31.1/graph_objects/contour_gen.go @@ -83,7 +83,7 @@ type Contour struct { // arrayOK: false // type: color // Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. - Fillcolor ColorWithColorScale `json:"fillcolor,omitempty"` + Fillcolor Color `json:"fillcolor,omitempty"` // Hoverinfo // arrayOK: true diff --git a/generated/v2.31.1/graph_objects/contourcarpet_gen.go b/generated/v2.31.1/graph_objects/contourcarpet_gen.go index ca4843e..f0ab0e4 100644 --- a/generated/v2.31.1/graph_objects/contourcarpet_gen.go +++ b/generated/v2.31.1/graph_objects/contourcarpet_gen.go @@ -133,7 +133,7 @@ type Contourcarpet struct { // arrayOK: false // type: color // Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. - Fillcolor ColorWithColorScale `json:"fillcolor,omitempty"` + Fillcolor Color `json:"fillcolor,omitempty"` // Hovertext // arrayOK: false diff --git a/generated/v2.31.1/graph_objects/layout_gen.go b/generated/v2.31.1/graph_objects/layout_gen.go index 51c39b5..a0e48ca 100644 --- a/generated/v2.31.1/graph_objects/layout_gen.go +++ b/generated/v2.31.1/graph_objects/layout_gen.go @@ -327,7 +327,7 @@ type Layout struct { // arrayOK: false // type: color // Sets the background color of the paper where the graph is drawn. - PaperBgcolor ColorWithColorScale `json:"paper_bgcolor,omitempty"` + PaperBgcolor Color `json:"paper_bgcolor,omitempty"` // Piecolorway // arrayOK: false @@ -339,7 +339,7 @@ type Layout struct { // arrayOK: false // type: color // Sets the background color of the plotting area in-between x and y axes. - PlotBgcolor ColorWithColorScale `json:"plot_bgcolor,omitempty"` + PlotBgcolor Color `json:"plot_bgcolor,omitempty"` // Polar // arrayOK: false diff --git a/generator/typefile.go b/generator/typefile.go index fff4e7c..506c5a1 100644 --- a/generator/typefile.go +++ b/generator/typefile.go @@ -178,7 +178,9 @@ func (file *typeFile) parseAttributes(namePrefix string, typePrefix string, attr default: ty := valTypeMap[attr.ValType] - if attr.ValType == ValTypeColor && attrs["colorscale"] != nil { + + // Special case, the attribute color may also be a ColorScale + if attr.ValType == ValTypeColor && attr.Name == "color" && attrs["colorscale"] != nil { ty = "ColorWithColorScale" } if attr.ArrayOK {