Skip to content

Commit

Permalink
Implement arrayok types (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalBlueberry authored Aug 21, 2024
1 parent 93f77f6 commit b2d107e
Show file tree
Hide file tree
Showing 167 changed files with 16,494 additions and 8,859 deletions.
16 changes: 9 additions & 7 deletions examples/bar_custom/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ func main() {
Type: grob.TraceTypeBar,
X: xValue,
Y: yValue,
Text: toString(yValue),
Textposition: grob.BarTextpositionAuto,
Hoverinfo: grob.BarHoverinfoNone,
Text: grob.ArrayOKArray(toString(yValue)...),
Textposition: grob.ArrayOKValue(grob.BarTextpositionAuto),
Hoverinfo: grob.ArrayOKValue(grob.BarHoverinfoNone),
Marker: &grob.BarMarker{
Color: markerColor.Hex(), // Use colorfull
Opacity: 0.6,
Color: grob.ArrayOKValue(grob.UseColor(grob.Color(
markerColor.Hex(), // Use colorfull
))),
Opacity: grob.ArrayOKValue(0.6),
Line: &grob.BarMarkerLine{
Color: "rgb(8,48,107)", // Or just write the string
Width: 1.5,
Color: grob.ArrayOKValue(grob.UseColor("rgb(8,48,107)")), // Or just write the string
Width: grob.ArrayOKValue(1.5),
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions examples/colorscale/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func main() {
Cmin: 0,
Cmid: 5,
Cmax: 10,
Color: z,
Color: grob.ArrayOKArray(grob.UseColorScaleValues(z)...),
Colorscale: colorScale,
Showscale: grob.True,
Size: 4,
Size: grob.ArrayOKValue(4.0),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/shapes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {
Line: grob.ScatterLine{
Color: "LightSeaGreen",
Width: 4,
Dash: grob.Scatter3dLineDashDashdot,
Dash: string(grob.Scatter3dLineDashDashdot),
},
},
{
Expand All @@ -52,7 +52,7 @@ func main() {
Line: grob.ScatterLine{
Color: "MediumPurple",
Width: 4,
Dash: grob.Scatter3dLineDashDot,
Dash: string(grob.Scatter3dLineDashDot),
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions examples/stargazers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func main() {
x := []string{}
y := []int{}
text := []string{}
link := []string{}
link := []interface{}{}

for i := 0; i < len(starredAt); i++ {
x = append(x, starredAt[i].StarredAt.Format(time.RFC3339))
Expand All @@ -71,8 +71,8 @@ func main() {
Type: grob.TraceTypeScatter,
X: x,
Y: y,
Text: text,
Meta: link,
Text: grob.ArrayOKArray(text...),
Meta: grob.ArrayOKArray(link...),
Mode: grob.ScatterModeLines + "+" + grob.ScatterModeMarkers,
Name: "Stars",
Line: &grob.ScatterLine{
Expand Down
2 changes: 2 additions & 0 deletions examples/wasm/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
20 changes: 10 additions & 10 deletions examples/waterfall_bar_chart/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func main() {
X: xData,
Y: []int{0, 430, 0, 570, 370, 370, 0},
Marker: &grob.BarMarker{
Color: "rgba(1,1,1,0.0)",
Color: grob.ArrayOKValue(grob.UseColor("rgba(1,1,1,0.0)")),
},
Type: grob.TraceTypeBar,
}
Expand All @@ -135,10 +135,10 @@ func main() {
X: xData,
Y: []int{430, 260, 690, 0, 0, 0, 0},
Marker: &grob.BarMarker{
Color: "rgba(55,128,191,0.7)",
Color: grob.ArrayOKValue(grob.UseColor("rgba(55,128,191,0.7)")),
Line: &grob.BarMarkerLine{
Color: "rgba(55,128,191,1.0)",
Width: 2,
Color: grob.ArrayOKValue(grob.UseColor("rgba(55,128,191,1.0)")),
Width: grob.ArrayOKValue(2.0),
},
},
Type: grob.TraceTypeBar,
Expand All @@ -150,10 +150,10 @@ func main() {
X: xData,
Y: []int{0, 0, 0, 120, 200, 320, 0},
Marker: &grob.BarMarker{
Color: "rgba(219, 64, 82, 0.7)",
Color: grob.ArrayOKValue(grob.UseColor("rgba(219, 64, 82, 0.7)")),
Line: &grob.BarMarkerLine{
Color: "rgba(219, 64, 82, 1.0)",
Width: 2,
Color: grob.ArrayOKValue(grob.UseColor("rgba(219, 64, 82, 1.0)")),
Width: grob.ArrayOKValue(2.0),
},
},
Type: grob.TraceTypeBar,
Expand All @@ -165,10 +165,10 @@ func main() {
X: xData,
Y: []int{0, 0, 0, 0, 0, 0, 370},
Marker: &grob.BarMarker{
Color: "rgba(50,171, 96, 0.7)",
Color: grob.ArrayOKValue(grob.UseColor("rgba(50,171, 96, 0.7)")),
Line: &grob.BarMarkerLine{
Color: "rgba(50,171,96,1.0)",
Width: 2,
Color: grob.ArrayOKValue(grob.UseColor("rgba(50,171,96,1.0)")),
Width: grob.ArrayOKValue(2.0),
},
},
Type: grob.TraceTypeBar,
Expand Down
Loading

0 comments on commit b2d107e

Please sign in to comment.