Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/GAP/pkg/jupyterviz/examples/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 16.7.2022 mit Größe 802 B image not shown  

Quelle  06loadfromjson.md   Sprache: unbekannt

 
Spracherkennung für: .md vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]


# Loading plot data from JSON

Many of the underlying visualization tools can store their plot
data in JSON form, and you might have some generated by another
source or downloaded from the web.  For example, in this package's
directory, the file `example/EV Charge Points.json`
contains JSON data from one of the Plotly project's blog posts.

You can load it and use it in a visualization as follows.

```
# load and convert into a record
jsonText := ReadAll( InputTextFile( "EV Charge Points.json" ) );;
gapRecord := JsonStringToGap( jsonText );;

# ensure it's big enough to be visible:
if IsBound( gapRecord.layout ) then
    gapRecord.layout.height := 500;;
else
    gapRecord.layout := rec( height := 500 );;
fi;

# show it
CreateVisualization( rec( tool := "plotly", data := gapRecord ) );
```


[ Dauer der Verarbeitung: 0.35 Sekunden  ]