Skip to content

Commit 4b5f552

Browse files
update examples
1 parent beecec5 commit 4b5f552

File tree

10 files changed

+93
-7
lines changed

10 files changed

+93
-7
lines changed

examples/bar/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func main() {
2222
Y: []float64{1, 2, 3},
2323
},
2424
},
25-
Layout: grob.Layout{
25+
Layout: &grob.Layout{
2626
Title: &grob.LayoutTitle{
2727
Text: "A Figure Specified By Go Struct",
2828
},

examples/bar_custom/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func main() {
6666
},
6767
}
6868

69-
layout := grob.Layout{
69+
layout := &grob.Layout{
7070
Title: &grob.LayoutTitle{
7171
Text: "A Figure Specified By Go Struct",
7272
},

examples/dataframe/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func main() {
6868
})
6969
}
7070

71-
fig.Layout = grob.Layout{
71+
fig.Layout = &grob.Layout{
7272
Barmode: grob.LayoutBarmode_stack,
7373
}
7474

examples/range_slider/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func main() {
8383
Y: df.Col("High").Float(),
8484
})
8585

86-
fig.Layout = grob.Layout{
86+
fig.Layout = &grob.Layout{
8787
Title: &grob.LayoutTitle{
8888
Text: "Time series with range slider and selectors",
8989
},

examples/responsive/bar.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
<head>
3+
<script src="https://cdn.plot.ly/plotly-1.54.0.min.js"></script>
4+
</head>
5+
</body>
6+
<div id="tester"></div>
7+
<script>
8+
console.log("start")
9+
data = JSON.parse('{"data":[{"type":"bar","x":[1,2,3],"y":[1,2,3]}],"layout":{"title":{"text":"A Figure Specified By Go Struct"}},"config":{"responsive":true}}')
10+
11+
TESTER = document.getElementById('tester');
12+
Plotly.newPlot(TESTER, data);
13+
</script>
14+
<body>
15+

examples/responsive/main.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package main
2+
3+
import (
4+
grob "github.com/MetalBlueberry/go-plotly/graph_objects"
5+
"github.com/MetalBlueberry/go-plotly/offline"
6+
)
7+
8+
func main() {
9+
/*
10+
fig = dict({
11+
"data": [{"type": "bar",
12+
"x": [1, 2, 3],
13+
"y": [1, 3, 2]}],
14+
"layout": {"title": {"text": "A Figure Specified By Python Dictionary"}}
15+
})
16+
*/
17+
fig := &grob.Fig{
18+
Data: grob.Traces{
19+
&grob.Bar{
20+
Type: grob.TraceTypeBar,
21+
X: []float64{1, 2, 3},
22+
Y: []float64{1, 2, 3},
23+
},
24+
},
25+
Layout: &grob.Layout{
26+
Title: &grob.LayoutTitle{
27+
Text: "A Figure Specified By Go Struct",
28+
},
29+
},
30+
Config: &grob.Config{
31+
Responsive: grob.True,
32+
},
33+
}
34+
35+
offline.ToHtml(fig, "bar.html")
36+
offline.Show(fig)
37+
}

examples/shapes/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func main() {
1515
})
1616
*/
1717
fig := &grob.Fig{
18-
Layout: grob.Layout{
18+
Layout: &grob.Layout{
1919
Title: &grob.LayoutTitle{
2020
Text: "A Figure Specified By Go Struct",
2121
},

examples/subplots_share_axes/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func main() {
8181
Yaxis: "y4",
8282
},
8383
},
84-
Layout: grob.Layout{
84+
Layout: &grob.Layout{
8585
Grid: &grob.LayoutGrid{
8686
Rows: 2,
8787
Columns: 2,

examples/transforms/main.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package main
2+
3+
import (
4+
grob "github.com/MetalBlueberry/go-plotly/graph_objects"
5+
"github.com/MetalBlueberry/go-plotly/offline"
6+
)
7+
8+
func main() {
9+
/*
10+
fig = dict({
11+
"data": [{"type": "bar",
12+
"x": [1, 2, 3],
13+
"y": [1, 3, 2]}],
14+
"layout": {"title": {"text": "A Figure Specified By Python Dictionary"}}
15+
})
16+
*/
17+
fig := &grob.Fig{
18+
Data: grob.Traces{
19+
&grob.Bar{
20+
Type: grob.TraceTypeBar,
21+
X: []float64{1, 2, 3},
22+
Y: []float64{1, 2, 3},
23+
},
24+
},
25+
Layout: &grob.Layout{
26+
Title: &grob.LayoutTitle{
27+
Text: "A Figure Specified By Go Struct",
28+
},
29+
},
30+
}
31+
32+
offline.ToHtml(fig, "bar.html")
33+
offline.Show(fig)
34+
}

examples/waterfall_bar_chart/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func main() {
191191
}
192192
}
193193

194-
layout := grob.Layout{
194+
layout := &grob.Layout{
195195
Title: &grob.LayoutTitle{
196196
Text: "Annual Profit 2015",
197197
},

0 commit comments

Comments
 (0)