Skip to content

Add an easy way to serialize GenericChart directly #399

Closed
@kMutagene

Description

@kMutagene

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": ...
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions