Skip to content

Commit 8018f9a

Browse files
Unify all types under /types
1 parent c95b945 commit 8018f9a

File tree

190 files changed

+14270
-14718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+14270
-14718
lines changed

examples/bar/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
5-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
5+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
66
)
77

88
func main() {

examples/bar_custom/main.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import (
77
"github.com/lucasb-eyer/go-colorful"
88

99
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
10-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
11-
"github.com/MetalBlueberry/go-plotly/pkg/types/arrayok"
12-
gcolor "github.com/MetalBlueberry/go-plotly/pkg/types/color"
10+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
11+
"github.com/MetalBlueberry/go-plotly/pkg/types"
1312
)
1413

1514
func main() {
@@ -55,17 +54,17 @@ func main() {
5554
trace1 := &grob.Bar{
5655
X: xValue,
5756
Y: yValue,
58-
Text: arrayok.Array(toString(yValue)...),
59-
Textposition: arrayok.Value(grob.BarTextpositionAuto),
60-
Hoverinfo: arrayok.Value(grob.BarHoverinfoNone),
57+
Text: types.ArrayOKArray(toString(yValue)...),
58+
Textposition: types.ArrayOKValue(grob.BarTextpositionAuto),
59+
Hoverinfo: types.ArrayOKValue(grob.BarHoverinfoNone),
6160
Marker: &grob.BarMarker{
62-
Color: arrayok.Value(gcolor.UseColor(gcolor.String(
61+
Color: types.ArrayOKValue(types.UseColor(types.Color(
6362
markerColor.Hex(), // Use colorfull
6463
))),
65-
Opacity: arrayok.Value(0.6),
64+
Opacity: types.ArrayOKValue(0.6),
6665
Line: &grob.BarMarkerLine{
67-
Color: arrayok.Value(gcolor.UseColor("rgb(8,48,107)")), // Or just write the string
68-
Width: arrayok.Value(1.5),
66+
Color: types.ArrayOKValue(types.UseColor("rgb(8,48,107)")), // Or just write the string
67+
Width: types.ArrayOKValue(1.5),
6968
},
7069
},
7170
}
@@ -85,8 +84,8 @@ func main() {
8584
offline.Show(fig)
8685
}
8786

88-
func toString(in []int) []string {
89-
out := make([]string, len(in))
87+
func toString(in []int) []types.String {
88+
out := make([]types.String, len(in))
9089
for i := range in {
9190
out[i] = strconv.Itoa(in[i])
9291
}

examples/colorscale/main.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import (
44
"math"
55

66
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
7-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
8-
"github.com/MetalBlueberry/go-plotly/pkg/types/arrayok"
9-
"github.com/MetalBlueberry/go-plotly/pkg/types/color"
7+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
8+
"github.com/MetalBlueberry/go-plotly/pkg/types"
109
)
1110

1211
func main() {
@@ -22,14 +21,14 @@ func main() {
2221
Z: z,
2322
Mode: grob.Scatter3dModeMarkers,
2423
Marker: &grob.Scatter3dMarker{
25-
Autocolorscale: grob.False,
26-
Cauto: grob.False,
24+
Autocolorscale: types.False,
25+
Cauto: types.False,
2726
Cmin: 0,
2827
Cmid: 5,
2928
Cmax: 10,
30-
Color: arrayok.Array(color.UseColorScaleValues(z)...),
31-
Colorscale: color.Scale{
32-
Values: []color.ScaleReference{
29+
Color: types.ArrayOKArray(types.UseColorScaleValues(z)...),
30+
Colorscale: types.ColorScale{
31+
Values: []types.ColorScaleReference{
3332
{NormalizedValue: 0.0, Color: "#6e40aa"},
3433
{NormalizedValue: 0.1, Color: `#963db3`},
3534
{NormalizedValue: 0.2, Color: "#bf3caf"},
@@ -43,8 +42,8 @@ func main() {
4342
{NormalizedValue: 1.0, Color: "#aff05b"},
4443
},
4544
},
46-
Showscale: grob.True,
47-
Size: arrayok.Value(4.0),
45+
Showscale: types.True,
46+
Size: types.ArrayOKValue(4.0),
4847
},
4948
},
5049
},

examples/range_slider/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import (
77
"github.com/go-gota/gota/dataframe"
88

99
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
10-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
10+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
11+
"github.com/MetalBlueberry/go-plotly/pkg/types"
1112
)
1213

1314
func main() {
@@ -120,7 +121,7 @@ func main() {
120121
},
121122
},
122123
Rangeslider: &grob.LayoutXaxisRangeslider{
123-
Visible: grob.True,
124+
Visible: types.True,
124125
},
125126
Type: grob.LayoutXaxisTypeDate,
126127
},

examples/responsive/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package main
22

33
import (
44
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
5-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
5+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
6+
"github.com/MetalBlueberry/go-plotly/pkg/types"
67
)
78

89
func main() {
@@ -17,8 +18,8 @@ func main() {
1718
fig := &grob.Fig{
1819
Data: grob.Traces{
1920
&grob.Bar{
20-
X: []float64{1, 2, 3},
21-
Y: []float64{1, 2, 3},
21+
X: []float64{1, 2, 3},
22+
Y: []float64{1, 2, 3},
2223
},
2324
},
2425
Layout: &grob.Layout{
@@ -27,7 +28,7 @@ func main() {
2728
},
2829
},
2930
Config: &grob.Config{
30-
Responsive: grob.True,
31+
Responsive: types.True,
3132
},
3233
}
3334

examples/scatter/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"math"
55

66
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
7-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
7+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
88
)
99

1010
func main() {

examples/scatter3d/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"math"
55

66
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
7-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
7+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
88
)
99

1010
func main() {

examples/shapes/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
5-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
4+
grob "github.com/MetalBlueberry/go-plotly/generated/v2.19.0/graph_objects"
5+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
66
)
77

88
func main() {

examples/stargazers/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/pkg/browser"
1414

1515
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
16-
"github.com/MetalBlueberry/go-plotly/pkg/types/arrayok"
16+
"github.com/MetalBlueberry/go-plotly/pkg/types"
1717
)
1818

1919
type User struct {
@@ -55,7 +55,7 @@ func main() {
5555

5656
x := []string{}
5757
y := []int{}
58-
text := []string{}
58+
text := []types.String{}
5959
link := []interface{}{}
6060

6161
for i := 0; i < len(starredAt); i++ {
@@ -71,8 +71,8 @@ func main() {
7171
&grob.Scatter{
7272
X: x,
7373
Y: y,
74-
Text: arrayok.Array(text...),
75-
Meta: arrayok.Array(link...),
74+
Text: types.ArrayOKArray(text...),
75+
Meta: types.ArrayOKArray(link...),
7676
Mode: grob.ScatterModeLines + "+" + grob.ScatterModeMarkers,
7777
Name: "Stars",
7878
Line: &grob.ScatterLine{

examples/subplots_share_axes/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
5-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
5+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
66
)
77

88
func main() {
@@ -55,8 +55,8 @@ func main() {
5555
fig := &grob.Fig{
5656
Data: grob.Traces{
5757
&grob.Scatter{
58-
X: []float64{1, 2, 3},
59-
Y: []float64{2, 3, 4},
58+
X: []float64{1, 2, 3},
59+
Y: []float64{2, 3, 4},
6060
},
6161
&grob.Scatter{
6262
X: []float64{20, 30, 40},

examples/transforms/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
5-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
5+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
66
)
77

88
func main() {
@@ -17,8 +17,8 @@ func main() {
1717
fig := &grob.Fig{
1818
Data: grob.Traces{
1919
&grob.Bar{
20-
X: []float64{1, 2, 3},
21-
Y: []float64{1, 2, 3},
20+
X: []float64{1, 2, 3},
21+
Y: []float64{1, 2, 3},
2222
},
2323
},
2424
Layout: &grob.Layout{

examples/unmarshal/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"math"
66

77
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
8-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
8+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
99
)
1010

1111
func main() {

examples/wasm/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func plot(this js.Value, inputs []js.Value) interface{} {
1515
fig := &grob.Fig{
1616
Data: grob.Traces{
1717
&grob.Choropleth{
18-
Autocolorscale: grob.True,
18+
Autocolorscale: types.True,
1919
Locationmode: grob.ChoroplethLocationmodeUSAStates,
2020
},
2121
},

examples/waterfall_bar_chart/main.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package main
22

33
import (
44
grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects"
5-
"github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline"
6-
"github.com/MetalBlueberry/go-plotly/pkg/types/arrayok"
7-
"github.com/MetalBlueberry/go-plotly/pkg/types/color"
5+
"github.com/MetalBlueberry/go-plotly/pkg/offline"
6+
"github.com/MetalBlueberry/go-plotly/pkg/types"
87
)
98

109
func main() {
@@ -126,7 +125,7 @@ func main() {
126125
X: xData,
127126
Y: []int{0, 430, 0, 570, 370, 370, 0},
128127
Marker: &grob.BarMarker{
129-
Color: arrayok.Value(color.UseColor("rgba(1,1,1,0.0)")),
128+
Color: types.ArrayOKValue(types.UseColor("rgba(1,1,1,0.0)")),
130129
},
131130
}
132131

@@ -136,10 +135,10 @@ func main() {
136135
X: xData,
137136
Y: []int{430, 260, 690, 0, 0, 0, 0},
138137
Marker: &grob.BarMarker{
139-
Color: arrayok.Value(color.UseColor("rgba(55,128,191,0.7)")),
138+
Color: types.ArrayOKValue(types.UseColor("rgba(55,128,191,0.7)")),
140139
Line: &grob.BarMarkerLine{
141-
Color: arrayok.Value(color.UseColor("rgba(55,128,191,1.0)")),
142-
Width: arrayok.Value(2.0),
140+
Color: types.ArrayOKValue(types.UseColor("rgba(55,128,191,1.0)")),
141+
Width: types.ArrayOKValue(2.0),
143142
},
144143
},
145144
}
@@ -150,10 +149,10 @@ func main() {
150149
X: xData,
151150
Y: []int{0, 0, 0, 120, 200, 320, 0},
152151
Marker: &grob.BarMarker{
153-
Color: arrayok.Value(color.UseColor("rgba(219, 64, 82, 0.7)")),
152+
Color: types.ArrayOKValue(types.UseColor("rgba(219, 64, 82, 0.7)")),
154153
Line: &grob.BarMarkerLine{
155-
Color: arrayok.Value(color.UseColor("rgba(219, 64, 82, 1.0)")),
156-
Width: arrayok.Value(2.0),
154+
Color: types.ArrayOKValue(types.UseColor("rgba(219, 64, 82, 1.0)")),
155+
Width: types.ArrayOKValue(2.0),
157156
},
158157
},
159158
}
@@ -164,10 +163,10 @@ func main() {
164163
X: xData,
165164
Y: []int{0, 0, 0, 0, 0, 0, 370},
166165
Marker: &grob.BarMarker{
167-
Color: arrayok.Value(color.UseColor("rgba(50,171, 96, 0.7)")),
166+
Color: types.ArrayOKValue(types.UseColor("rgba(50,171, 96, 0.7)")),
168167
Line: &grob.BarMarkerLine{
169-
Color: arrayok.Value(color.UseColor("rgba(50,171,96,1.0)")),
170-
Width: arrayok.Value(2.0),
168+
Color: types.ArrayOKValue(types.UseColor("rgba(50,171,96,1.0)")),
169+
Width: types.ArrayOKValue(2.0),
171170
},
172171
},
173172
}
@@ -198,7 +197,7 @@ func main() {
198197
PlotBgcolor: "rgba(245,246,249,1)",
199198
Width: 600,
200199
Height: 600,
201-
Showlegend: grob.False,
200+
Showlegend: types.False,
202201
Annotations: annotations, // Not implemented yet
203202
}
204203

0 commit comments

Comments
 (0)