Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix examples
Browse files Browse the repository at this point in the history
MetalBlueberry committed Aug 21, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
1 parent 36f4cb1 commit 39bd14e
Showing 4 changed files with 25 additions and 21 deletions.
15 changes: 8 additions & 7 deletions examples/bar_custom/main.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (

grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
"github.com/MetalBlueberry/go-plotly/types/arrayok"
)

func main() {
@@ -54,17 +55,17 @@ func main() {
Type: grob.TraceTypeBar,
X: xValue,
Y: yValue,
Text: grob.ArrayOKArray(toString(yValue)...),
Textposition: grob.ArrayOKValue(grob.BarTextpositionAuto),
Hoverinfo: grob.ArrayOKValue(grob.BarHoverinfoNone),
Text: arrayok.Array(toString(yValue)...),
Textposition: arrayok.Value(grob.BarTextpositionAuto),
Hoverinfo: arrayok.Value(grob.BarHoverinfoNone),
Marker: &grob.BarMarker{
Color: grob.ArrayOKValue(grob.UseColor(grob.Color(
Color: arrayok.Value(grob.UseColor(grob.Color(
markerColor.Hex(), // Use colorfull
))),
Opacity: grob.ArrayOKValue(0.6),
Opacity: arrayok.Value(0.6),
Line: &grob.BarMarkerLine{
Color: grob.ArrayOKValue(grob.UseColor("rgb(8,48,107)")), // Or just write the string
Width: grob.ArrayOKValue(1.5),
Color: arrayok.Value(grob.UseColor("rgb(8,48,107)")), // Or just write the string
Width: arrayok.Value(1.5),
},
},
}
5 changes: 3 additions & 2 deletions examples/colorscale/main.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import (

grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
"github.com/MetalBlueberry/go-plotly/types/arrayok"
)

type ColorScale struct {
@@ -51,10 +52,10 @@ func main() {
Cmin: 0,
Cmid: 5,
Cmax: 10,
Color: grob.ArrayOKArray(grob.UseColorScaleValues(z)...),
Color: arrayok.Array(grob.UseColorScaleValues(z)...),
Colorscale: colorScale,
Showscale: grob.True,
Size: grob.ArrayOKValue(4.0),
Size: arrayok.Value(4.0),
},
},
},
5 changes: 3 additions & 2 deletions examples/stargazers/main.go
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ import (
"github.com/pkg/browser"

grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
"github.com/MetalBlueberry/go-plotly/types/arrayok"
)

type User struct {
@@ -71,8 +72,8 @@ func main() {
Type: grob.TraceTypeScatter,
X: x,
Y: y,
Text: grob.ArrayOKArray(text...),
Meta: grob.ArrayOKArray(link...),
Text: arrayok.Array(text...),
Meta: arrayok.Array(link...),
Mode: grob.ScatterModeLines + "+" + grob.ScatterModeMarkers,
Name: "Stars",
Line: &grob.ScatterLine{
21 changes: 11 additions & 10 deletions examples/waterfall_bar_chart/main.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package main
import (
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
"github.com/MetalBlueberry/go-plotly/types/arrayok"
)

func main() {
@@ -124,7 +125,7 @@ func main() {
X: xData,
Y: []int{0, 430, 0, 570, 370, 370, 0},
Marker: &grob.BarMarker{
Color: grob.ArrayOKValue(grob.UseColor("rgba(1,1,1,0.0)")),
Color: arrayok.Value(grob.UseColor("rgba(1,1,1,0.0)")),
},
Type: grob.TraceTypeBar,
}
@@ -135,10 +136,10 @@ func main() {
X: xData,
Y: []int{430, 260, 690, 0, 0, 0, 0},
Marker: &grob.BarMarker{
Color: grob.ArrayOKValue(grob.UseColor("rgba(55,128,191,0.7)")),
Color: arrayok.Value(grob.UseColor("rgba(55,128,191,0.7)")),
Line: &grob.BarMarkerLine{
Color: grob.ArrayOKValue(grob.UseColor("rgba(55,128,191,1.0)")),
Width: grob.ArrayOKValue(2.0),
Color: arrayok.Value(grob.UseColor("rgba(55,128,191,1.0)")),
Width: arrayok.Value(2.0),
},
},
Type: grob.TraceTypeBar,
@@ -150,10 +151,10 @@ func main() {
X: xData,
Y: []int{0, 0, 0, 120, 200, 320, 0},
Marker: &grob.BarMarker{
Color: grob.ArrayOKValue(grob.UseColor("rgba(219, 64, 82, 0.7)")),
Color: arrayok.Value(grob.UseColor("rgba(219, 64, 82, 0.7)")),
Line: &grob.BarMarkerLine{
Color: grob.ArrayOKValue(grob.UseColor("rgba(219, 64, 82, 1.0)")),
Width: grob.ArrayOKValue(2.0),
Color: arrayok.Value(grob.UseColor("rgba(219, 64, 82, 1.0)")),
Width: arrayok.Value(2.0),
},
},
Type: grob.TraceTypeBar,
@@ -165,10 +166,10 @@ func main() {
X: xData,
Y: []int{0, 0, 0, 0, 0, 0, 370},
Marker: &grob.BarMarker{
Color: grob.ArrayOKValue(grob.UseColor("rgba(50,171, 96, 0.7)")),
Color: arrayok.Value(grob.UseColor("rgba(50,171, 96, 0.7)")),
Line: &grob.BarMarkerLine{
Color: grob.ArrayOKValue(grob.UseColor("rgba(50,171,96,1.0)")),
Width: grob.ArrayOKValue(2.0),
Color: arrayok.Value(grob.UseColor("rgba(50,171,96,1.0)")),
Width: arrayok.Value(2.0),
},
},
Type: grob.TraceTypeBar,

0 comments on commit 39bd14e

Please sign in to comment.