Skip to content

Add an easy way to serialize GenericChart directly #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kMutagene opened this issue Jul 10, 2023 · 0 comments
Closed

Add an easy way to serialize GenericChart directly #399

kMutagene opened this issue Jul 10, 2023 · 0 comments
Labels
Area: Core API Area: MissingAbstraction Plotly.js functionality that has to be implemented Type: Enhancement

Comments

@kMutagene
Copy link
Collaborator

Currently, JSON serialization is hidden internally, for example here:

let toChartHTMLNodes gChart =
let tracesJson =
let traces = getTraces gChart
JsonConvert.SerializeObject(traces, Globals.JSON_CONFIG)
let layoutJson =
let layout = getLayout gChart
JsonConvert.SerializeObject(layout, Globals.JSON_CONFIG)
let configJson =
let config = getConfig gChart
JsonConvert.SerializeObject(config, Globals.JSON_CONFIG)

It should be an easy addition to add two functions:

  • GenericChart.toFigureJson, returns the DTO originally intended for exchange with dash:
    {
      "data": ...
      "layout": ...
      "frames": ...
    }
  • GenericChart.toJson, returns the json representatin that is used in the generated html:
    {
      "data": ...
      "layout": ...
      "config": ...
    }
@kMutagene kMutagene added Type: Enhancement Area: MissingAbstraction Plotly.js functionality that has to be implemented Area: Core API labels Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core API Area: MissingAbstraction Plotly.js functionality that has to be implemented Type: Enhancement
Projects
None yet
Development

No branches or pull requests

1 participant