diff --git a/README.md b/README.md index 29b2129..9bfe4a0 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Example entry: Tag: v2.31.1 URL: https://raw.githubusercontent.com/plotly/plotly.js/v2.31.1/test/plot-schema.json Path: schemas/v2.31.1/plot-schema.json - Generated: generated/v2.31.1/graph_objects + Generated: generated/v2.31.1 CDN: https://cdn.plot.ly/plotly-2.31.1.min.js ``` diff --git a/examples/bar/main.go b/examples/bar/main.go index 0a8aecb..3525e93 100644 --- a/examples/bar/main.go +++ b/examples/bar/main.go @@ -4,7 +4,8 @@ import ( "fmt" "path/filepath" - grob "github.com/MetalBlueberry/go-plotly/generated/v2.29.1/graph_objects" + grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) func main() { @@ -32,14 +33,14 @@ func main() { } // by default, using the cdn reference, downloading the plotly js on demand - grob.ToHtml(fig, "bar.html") - grob.Show(fig) + offline.ToHtml(fig, "bar.html") + offline.Show(fig) // example for using static assets, which can be embedded into the golang application abs, err := filepath.Abs("asset/plotly-2.29.1.min.js") if err != nil { return } - grob.ToHtml(fig, "bar.html", grob.FigOptions{HeadContent: fmt.Sprintf(`Offline Bars`, abs)}) - grob.Show(fig, grob.FigOptions{HeadContent: fmt.Sprintf(`Offline Bars`, abs)}) + offline.ToHtml(fig, "bar.html", offline.FigOptions{HeadContent: fmt.Sprintf(`Offline Bars`, abs)}) + offline.Show(fig, offline.FigOptions{HeadContent: fmt.Sprintf(`Offline Bars`, abs)}) } diff --git a/examples/bar_custom/main.go b/examples/bar_custom/main.go index 4a055e8..ccd611e 100644 --- a/examples/bar_custom/main.go +++ b/examples/bar_custom/main.go @@ -7,6 +7,7 @@ import ( "github.com/lucasb-eyer/go-colorful" grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) func main() { @@ -77,8 +78,8 @@ func main() { Layout: layout, } - grob.ToHtml(fig, "bar_custom.html") - grob.Show(fig) + offline.ToHtml(fig, "bar_custom.html") + offline.Show(fig) } func toString(in []int) []string { diff --git a/examples/colorscale/main.go b/examples/colorscale/main.go index d06536c..f66347a 100644 --- a/examples/colorscale/main.go +++ b/examples/colorscale/main.go @@ -5,6 +5,7 @@ import ( "math" grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) type ColorScale struct { @@ -65,7 +66,7 @@ func main() { }, }, } - grob.Show(fig) + offline.Show(fig) } func linspace(start, stop float64, points int) []float64 { diff --git a/examples/range_slider/main.go b/examples/range_slider/main.go index 416f46c..6c388f2 100644 --- a/examples/range_slider/main.go +++ b/examples/range_slider/main.go @@ -7,6 +7,7 @@ import ( "github.com/go-gota/gota/dataframe" grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) func main() { @@ -126,8 +127,8 @@ func main() { }, } - grob.ToHtml(fig, "range_slider.html") - grob.Show(fig) + offline.ToHtml(fig, "range_slider.html") + offline.Show(fig) } // Button is a custom type for the cases where the autogenerated code falls short. diff --git a/examples/responsive/main.go b/examples/responsive/main.go index 3ed4665..d6c703c 100644 --- a/examples/responsive/main.go +++ b/examples/responsive/main.go @@ -2,6 +2,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" ) func main() { @@ -31,6 +32,6 @@ func main() { }, } - grob.ToHtml(fig, "bar.html") - grob.Show(fig) + offline.ToHtml(fig, "bar.html") + offline.Show(fig) } diff --git a/examples/scatter/main.go b/examples/scatter/main.go index 3c0afa6..45e5bfc 100644 --- a/examples/scatter/main.go +++ b/examples/scatter/main.go @@ -4,6 +4,7 @@ import ( "math" grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) func main() { @@ -47,8 +48,8 @@ func main() { }, } - grob.ToHtml(fig, "scatter.html") - grob.Show(fig) + offline.ToHtml(fig, "scatter.html") + offline.Show(fig) } func linspace(start, stop float64, points int) []float64 { diff --git a/examples/scatter3d/main.go b/examples/scatter3d/main.go index f698e3f..952122f 100644 --- a/examples/scatter3d/main.go +++ b/examples/scatter3d/main.go @@ -4,6 +4,7 @@ import ( "math" grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) func main() { @@ -37,8 +38,8 @@ func main() { }, } - grob.ToHtml(fig, "scatter3d.html") - grob.Show(fig) + offline.ToHtml(fig, "scatter3d.html") + offline.Show(fig) } func linspace(start, stop float64, points int) []float64 { diff --git a/examples/shapes/main.go b/examples/shapes/main.go index 32eaca4..ad707dd 100644 --- a/examples/shapes/main.go +++ b/examples/shapes/main.go @@ -2,6 +2,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" ) func main() { @@ -58,8 +59,8 @@ func main() { }, } - grob.ToHtml(fig, "bar.html") - grob.Show(fig) + offline.ToHtml(fig, "bar.html") + offline.Show(fig) } type LineShape struct { diff --git a/examples/subplots_share_axes/main.go b/examples/subplots_share_axes/main.go index ed87928..163777c 100644 --- a/examples/subplots_share_axes/main.go +++ b/examples/subplots_share_axes/main.go @@ -2,6 +2,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" ) func main() { @@ -93,6 +94,6 @@ func main() { }, } - grob.ToHtml(fig, "subplots_share_axes.html") - grob.Show(fig) + offline.ToHtml(fig, "subplots_share_axes.html") + offline.Show(fig) } diff --git a/examples/transforms/main.go b/examples/transforms/main.go index 81cce6e..101f167 100644 --- a/examples/transforms/main.go +++ b/examples/transforms/main.go @@ -2,6 +2,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" ) func main() { @@ -28,6 +29,6 @@ func main() { }, } - grob.ToHtml(fig, "bar.html") - grob.Show(fig) + offline.ToHtml(fig, "bar.html") + offline.Show(fig) } diff --git a/examples/unmarshal/main.go b/examples/unmarshal/main.go index 187d027..0be7cf7 100644 --- a/examples/unmarshal/main.go +++ b/examples/unmarshal/main.go @@ -5,6 +5,7 @@ import ( "math" grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" + "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/offline" ) func main() { @@ -30,7 +31,7 @@ func main() { // Demonstrates that a json representation can be loaded recoveredFig := &grob.Fig{} json.Unmarshal(bytes, recoveredFig) - grob.Show(recoveredFig) + offline.Show(recoveredFig) } func linspace(start, stop float64, points int) []float64 { diff --git a/examples/waterfall_bar_chart/main.go b/examples/waterfall_bar_chart/main.go index dd140b6..de13ed0 100644 --- a/examples/waterfall_bar_chart/main.go +++ b/examples/waterfall_bar_chart/main.go @@ -2,6 +2,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" ) func main() { @@ -208,8 +209,8 @@ func main() { Layout: layout, } - grob.ToHtml(fig, "waterfall.html") - grob.Show(fig) + offline.ToHtml(fig, "waterfall.html") + offline.Show(fig) } type Annotation struct { diff --git a/generated/v2.19.0/graph_objects/plot_gen.go b/generated/v2.19.0/offline/plot_gen.go similarity index 87% rename from generated/v2.19.0/graph_objects/plot_gen.go rename to generated/v2.19.0/offline/plot_gen.go index 154be7d..566b465 100644 --- a/generated/v2.19.0/graph_objects/plot_gen.go +++ b/generated/v2.19.0/offline/plot_gen.go @@ -1,4 +1,4 @@ -package grob +package offline import ( "bytes" @@ -12,6 +12,8 @@ import ( "github.com/pkg/browser" "github.com/pkg/errors" + + grob "github.com/MetalBlueberry/go-plotly/generated/v2.19.0/graph_objects" ) // FigOptions enables users to pass their custom cdn or local plotly file reference to allow building offline solutions @@ -25,7 +27,7 @@ type Options struct { } // ToWriter saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { +func ToWriter(fig *grob.Fig, w io.Writer, options ...FigOptions) { _, err := w.Write(figToBuffer(fig, options...).Bytes()) if err != nil { panic(errors.New(fmt.Sprintf("failed to write figure to passed writer: %v", err))) @@ -33,14 +35,14 @@ func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { } // ToHtml saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToHtml(fig *Fig, path string, options ...FigOptions) { +func ToHtml(fig *grob.Fig, path string, options ...FigOptions) { buf := figToBuffer(fig, options...) os.WriteFile(path, buf.Bytes(), os.ModePerm) } // Show displays the figure in your browser. // Use serve if you want a persistent view -func Show(fig *Fig, options ...FigOptions) { +func Show(fig *grob.Fig, options ...FigOptions) { buf := figToBuffer(fig, options...) browser.OpenReader(buf) } @@ -59,7 +61,7 @@ func computeFigOptions(options ...FigOptions) string { } // figToBuffer with optional parameter options, only the first argument is evaluated -func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { +func figToBuffer(fig *grob.Fig, options ...FigOptions) *bytes.Buffer { var headContent string = computeFigOptions(options...) figBytes, err := json.Marshal(fig) @@ -77,7 +79,7 @@ func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { // Serve creates a local web server that displays the image using plotly.js // Is a good alternative to Show to avoid creating tmp files. -func Serve(fig *Fig, opt ...Options) { +func Serve(fig *grob.Fig, opt ...Options) { opts := computeOptions(Options{ FigOptions: FigOptions{HeadContent: cdnUrl}, Addr: "localhost:8080", diff --git a/generated/v2.29.1/graph_objects/plot_gen.go b/generated/v2.29.1/offline/plot_gen.go similarity index 87% rename from generated/v2.29.1/graph_objects/plot_gen.go rename to generated/v2.29.1/offline/plot_gen.go index a272cc1..f94a005 100644 --- a/generated/v2.29.1/graph_objects/plot_gen.go +++ b/generated/v2.29.1/offline/plot_gen.go @@ -1,4 +1,4 @@ -package grob +package offline import ( "bytes" @@ -12,6 +12,8 @@ import ( "github.com/pkg/browser" "github.com/pkg/errors" + + grob "github.com/MetalBlueberry/go-plotly/generated/v2.29.1/graph_objects" ) // FigOptions enables users to pass their custom cdn or local plotly file reference to allow building offline solutions @@ -25,7 +27,7 @@ type Options struct { } // ToWriter saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { +func ToWriter(fig *grob.Fig, w io.Writer, options ...FigOptions) { _, err := w.Write(figToBuffer(fig, options...).Bytes()) if err != nil { panic(errors.New(fmt.Sprintf("failed to write figure to passed writer: %v", err))) @@ -33,14 +35,14 @@ func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { } // ToHtml saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToHtml(fig *Fig, path string, options ...FigOptions) { +func ToHtml(fig *grob.Fig, path string, options ...FigOptions) { buf := figToBuffer(fig, options...) os.WriteFile(path, buf.Bytes(), os.ModePerm) } // Show displays the figure in your browser. // Use serve if you want a persistent view -func Show(fig *Fig, options ...FigOptions) { +func Show(fig *grob.Fig, options ...FigOptions) { buf := figToBuffer(fig, options...) browser.OpenReader(buf) } @@ -59,7 +61,7 @@ func computeFigOptions(options ...FigOptions) string { } // figToBuffer with optional parameter options, only the first argument is evaluated -func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { +func figToBuffer(fig *grob.Fig, options ...FigOptions) *bytes.Buffer { var headContent string = computeFigOptions(options...) figBytes, err := json.Marshal(fig) @@ -77,7 +79,7 @@ func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { // Serve creates a local web server that displays the image using plotly.js // Is a good alternative to Show to avoid creating tmp files. -func Serve(fig *Fig, opt ...Options) { +func Serve(fig *grob.Fig, opt ...Options) { opts := computeOptions(Options{ FigOptions: FigOptions{HeadContent: cdnUrl}, Addr: "localhost:8080", diff --git a/generated/v2.31.1/graph_objects/plot_gen.go b/generated/v2.31.1/offline/plot_gen.go similarity index 87% rename from generated/v2.31.1/graph_objects/plot_gen.go rename to generated/v2.31.1/offline/plot_gen.go index b65d00a..ca34734 100644 --- a/generated/v2.31.1/graph_objects/plot_gen.go +++ b/generated/v2.31.1/offline/plot_gen.go @@ -1,4 +1,4 @@ -package grob +package offline import ( "bytes" @@ -12,6 +12,8 @@ import ( "github.com/pkg/browser" "github.com/pkg/errors" + + grob "github.com/MetalBlueberry/go-plotly/generated/v2.31.1/graph_objects" ) // FigOptions enables users to pass their custom cdn or local plotly file reference to allow building offline solutions @@ -25,7 +27,7 @@ type Options struct { } // ToWriter saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { +func ToWriter(fig *grob.Fig, w io.Writer, options ...FigOptions) { _, err := w.Write(figToBuffer(fig, options...).Bytes()) if err != nil { panic(errors.New(fmt.Sprintf("failed to write figure to passed writer: %v", err))) @@ -33,14 +35,14 @@ func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { } // ToHtml saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToHtml(fig *Fig, path string, options ...FigOptions) { +func ToHtml(fig *grob.Fig, path string, options ...FigOptions) { buf := figToBuffer(fig, options...) os.WriteFile(path, buf.Bytes(), os.ModePerm) } // Show displays the figure in your browser. // Use serve if you want a persistent view -func Show(fig *Fig, options ...FigOptions) { +func Show(fig *grob.Fig, options ...FigOptions) { buf := figToBuffer(fig, options...) browser.OpenReader(buf) } @@ -59,7 +61,7 @@ func computeFigOptions(options ...FigOptions) string { } // figToBuffer with optional parameter options, only the first argument is evaluated -func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { +func figToBuffer(fig *grob.Fig, options ...FigOptions) *bytes.Buffer { var headContent string = computeFigOptions(options...) figBytes, err := json.Marshal(fig) @@ -77,7 +79,7 @@ func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { // Serve creates a local web server that displays the image using plotly.js // Is a good alternative to Show to avoid creating tmp files. -func Serve(fig *Fig, opt ...Options) { +func Serve(fig *grob.Fig, opt ...Options) { opts := computeOptions(Options{ FigOptions: FigOptions{HeadContent: cdnUrl}, Addr: "localhost:8080", diff --git a/generator/cmd/generator/main.go b/generator/cmd/generator/main.go index eee5fa8..041ccb1 100644 --- a/generator/cmd/generator/main.go +++ b/generator/cmd/generator/main.go @@ -29,7 +29,7 @@ func main() { return } for _, schema := range schemas { - generatePackage(schema.Path, schema.Generated, schema.Cdn) + generatePackage(schema.Path, schema.Generated, schema.Cdn, schema.Tag) } } @@ -60,16 +60,19 @@ func FindDir(schema, output string) (string, string) { } // create the packages and write them into the specified folders -func generatePackage(schema, output, cdnUrl string) { +func generatePackage(schema, versionOutput, cdnUrl, tag string) { // look for the correct schema and output paths - schema, output = FindDir(schema, output) - log.Println("schema:", schema, "output", output) + schema, versionOutput = FindDir(schema, versionOutput) + log.Println("schema:", schema, "versionoutput", versionOutput) file, err := os.Open(schema) if err != nil { log.Fatalf("unable to open schema, %s", err) } + graphObjectsOuput := filepath.Join(versionOutput, "graph_objects") + offlineOuput := filepath.Join(versionOutput, "offline") + root, err := generator.LoadSchema(file) if err != nil { log.Fatalf("unable to load schema, %s", err) @@ -80,47 +83,45 @@ func generatePackage(schema, output, cdnUrl string) { log.Fatalf("unable to create a new renderer, %s", err) } - err = os.RemoveAll(output) - if err != nil { - log.Fatalf("Failed to clean output directory, %s", err) - } + for _, path := range []string{graphObjectsOuput, offlineOuput} { + err = os.RemoveAll(path) + if err != nil { + log.Fatalf("Failed to clean output directory, %s", err) + } - if err = os.MkdirAll(output, 0755); err != nil { - log.Fatalf("Failed to create output dir %s, %s", output, err) + if err = os.MkdirAll(path, 0755); err != nil { + log.Fatalf("Failed to create output dir %s, %s", path, err) + } } - err = r.CreatePlotGo(output, cdnUrl) + // plot_gen.go must be separate in an offline package + err = r.CreatePlotGo(offlineOuput, cdnUrl, tag) if err != nil { log.Fatalf("unable to write plot.go, %s", err) } - if err = os.MkdirAll(output, 0755); err != nil { - log.Fatalf("Error creating directory, %s", err) - } - err = r.CreatePlotly(output) + // graphobjects + err = r.CreatePlotly(graphObjectsOuput) if err != nil { log.Fatalf("unable to write plotly, %s", err) } - if err = os.MkdirAll(output, 0755); err != nil { - log.Fatalf("Error creating directory, %s", err) - } - err = r.CreateTraces(output) + err = r.CreateTraces(graphObjectsOuput) if err != nil { log.Fatalf("unable to write traces, %s", err) } - err = r.CreateLayout(output) + err = r.CreateLayout(graphObjectsOuput) if err != nil { log.Fatalf("unable to write layout, %s", err) } - err = r.CreateConfig(output) + err = r.CreateConfig(graphObjectsOuput) if err != nil { log.Fatalf("unable to write config, %s", err) } - err = r.CreateUnmarshal(output) + err = r.CreateUnmarshal(graphObjectsOuput) if err != nil { log.Fatalf("unable to write unmarshal, %s", err) } diff --git a/generator/renderer.go b/generator/renderer.go index 71506f6..7105fb4 100644 --- a/generator/renderer.go +++ b/generator/renderer.go @@ -46,9 +46,9 @@ func NewRenderer(fs Creator, root *Root) (*Renderer, error) { var doNotEdit = "// Code generated by go-plotly/generator. DO NOT EDIT." -func (r *Renderer) CreatePlotGo(dir, cdnUrl string) error { +func (r *Renderer) CreatePlotGo(dir, cdnUrl, tag string) error { src := &bytes.Buffer{} - err := r.WritePlotGo(src, cdnUrl) + err := r.WritePlotGo(src, cdnUrl, tag) if err != nil { return err @@ -111,12 +111,13 @@ const generationTemplate = ` ` // WritePlotly writes the base plotly file -func (r *Renderer) WritePlotGo(w io.Writer, cdnUrl string) error { +func (r *Renderer) WritePlotGo(w io.Writer, cdnUrl string, tag string) error { // inject the basehtml with the correct plotly cdn reference data := struct { CDN string Template string - }{CDN: cdnUrl, Template: fmt.Sprintf("fmt.Sprintf(`%s`, head)", generationTemplate)} + Tag string + }{CDN: cdnUrl, Template: fmt.Sprintf("fmt.Sprintf(`%s`, head)", generationTemplate), Tag: tag} finished := r.tmpl.ExecuteTemplate(w, "plot.tmpl", data) return finished diff --git a/generator/templates/plot.tmpl b/generator/templates/plot.tmpl index 9574310..35e4789 100644 --- a/generator/templates/plot.tmpl +++ b/generator/templates/plot.tmpl @@ -1,4 +1,4 @@ -package grob +package offline import ( "bytes" @@ -12,6 +12,8 @@ import ( "github.com/pkg/browser" "github.com/pkg/errors" + + grob "github.com/MetalBlueberry/go-plotly/generated/{{.Tag}}/graph_objects" ) // FigOptions enables users to pass their custom cdn or local plotly file reference to allow building offline solutions @@ -25,7 +27,7 @@ type Options struct { } // ToWriter saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { +func ToWriter(fig *grob.Fig, w io.Writer, options ...FigOptions) { _, err := w.Write(figToBuffer(fig, options...).Bytes()) if err != nil { panic(errors.New(fmt.Sprintf("failed to write figure to passed writer: %v", err))) @@ -33,14 +35,14 @@ func ToWriter(fig *Fig, w io.Writer, options ...FigOptions) { } // ToHtml saves the figure as standalone HTML. It still requires internet to load plotly.js from CDN. -func ToHtml(fig *Fig, path string, options ...FigOptions) { +func ToHtml(fig *grob.Fig, path string, options ...FigOptions) { buf := figToBuffer(fig, options...) os.WriteFile(path, buf.Bytes(), os.ModePerm) } // Show displays the figure in your browser. // Use serve if you want a persistent view -func Show(fig *Fig, options ...FigOptions) { +func Show(fig *grob.Fig, options ...FigOptions) { buf := figToBuffer(fig, options...) browser.OpenReader(buf) } @@ -59,7 +61,7 @@ func computeFigOptions(options ...FigOptions) string { } // figToBuffer with optional parameter options, only the first argument is evaluated -func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { +func figToBuffer(fig *grob.Fig, options ...FigOptions) *bytes.Buffer { var headContent string = computeFigOptions(options...) figBytes, err := json.Marshal(fig) @@ -77,7 +79,7 @@ func figToBuffer(fig *Fig, options ...FigOptions) *bytes.Buffer { // Serve creates a local web server that displays the image using plotly.js // Is a good alternative to Show to avoid creating tmp files. -func Serve(fig *Fig, opt ...Options) { +func Serve(fig *grob.Fig, opt ...Options) { opts := computeOptions(Options{ FigOptions: FigOptions{HeadContent: cdnUrl}, Addr: "localhost:8080", diff --git a/schemas.yaml b/schemas.yaml index 517f33c..a7f8e87 100644 --- a/schemas.yaml +++ b/schemas.yaml @@ -3,17 +3,17 @@ versions: Tag: v2.31.1 URL: https://raw.githubusercontent.com/plotly/plotly.js/v2.31.1/test/plot-schema.json Path: schemas/v2.31.1/plot-schema.json - Generated: generated/v2.31.1/graph_objects + Generated: generated/v2.31.1 CDN: https://cdn.plot.ly/plotly-2.31.1.min.js - Name: Plotly 2.29.1 Tag: v2.29.1 URL: https://raw.githubusercontent.com/plotly/plotly.js/v2.29.1/test/plot-schema.json Path: schemas/v2.29.1/plot-schema.json - Generated: generated/v2.29.1/graph_objects + Generated: generated/v2.29.1 CDN: https://cdn.plot.ly/plotly-2.29.1.min.js - Name: Plotly 2.19.0 Tag: v2.19.0 URL: https://raw.githubusercontent.com/plotly/plotly.js/v2.19.0/test/plot-schema.json Path: schemas/v2.19.0/plot-schema.json - Generated: generated/v2.19.0/graph_objects + Generated: generated/v2.19.0 CDN: https://cdn.plot.ly/plotly-2.19.0.min.js \ No newline at end of file