mirror of
https://github.com/enso-org/enso.git
synced 2024-11-27 18:12:31 +03:00
Fixes visualizations when using Enso's builtin JSON parser (https://github.com/enso-org/ide/pull/912)
Original commit: 788892be52
This commit is contained in:
parent
3354d69381
commit
073f22a67c
@ -62,12 +62,21 @@ class MapViewVisualization extends Visualization {
|
||||
mapElem.setAttributeNS(null,"style","width:" + width + "px;height: " + height + "px;");
|
||||
this.dom.appendChild(mapElem);
|
||||
|
||||
const parsedData = eval('('+data+')' );
|
||||
let parsedData = data;
|
||||
if (typeof data === "string") {
|
||||
parsedData = JSON.parse(data);
|
||||
}
|
||||
|
||||
let defaultMapStyle = 'mapbox://styles/mapbox/light-v9';
|
||||
if (document.getElementById("root").classList.contains("dark")){
|
||||
defaultMapStyle = 'mapbox://styles/mapbox/dark-v9';
|
||||
}
|
||||
|
||||
|
||||
const deckgl = new deck.DeckGL({
|
||||
container: 'map',
|
||||
mapboxApiAccessToken: 'pk.eyJ1IjoiZW5zby1vcmciLCJhIjoiY2tmNnh5MXh2MGlyOTJ5cWdubnFxbXo4ZSJ9.3KdAcCiiXJcSM18nwk09-Q',
|
||||
mapStyle: parsedData.mapStyle || 'mapbox://styles/mapbox/light-v9',
|
||||
mapStyle: parsedData.mapStyle || defaultMapStyle,
|
||||
initialViewState: {
|
||||
longitude: parsedData.longitude || 0.0,
|
||||
latitude: parsedData.latitude || 0.0,
|
||||
|
@ -90,7 +90,10 @@ class ScatterPlot extends Visualization {
|
||||
const divElem = this.createDivElem(width,height);
|
||||
this.dom.appendChild(divElem);
|
||||
|
||||
let parsedData = JSON.parse(data);
|
||||
let parsedData = data;
|
||||
if (typeof data === "string") {
|
||||
parsedData = JSON.parse(data);
|
||||
}
|
||||
let axis = parsedData.axis || {x:{scale:linear_scale},y:{scale:linear_scale}};
|
||||
let focus = parsedData.focus;
|
||||
let points = parsedData.points || {labels:"invisible"};
|
||||
|
@ -233,10 +233,17 @@ class TableViewVisualization extends Visualization {
|
||||
tabElem.setAttributeNS(null,"style" ,tblViewStyle);
|
||||
this.dom.appendChild(tabElem);
|
||||
|
||||
let parsedData = JSON.parse(data);
|
||||
let table = genTable(parsedData.data || parsedData, 0, parsedData.header);
|
||||
tabElem.innerHTML = style_light + table;
|
||||
let parsedData = data;
|
||||
if (typeof data === "string") {
|
||||
parsedData = JSON.parse(data);
|
||||
}
|
||||
|
||||
let style = style_light
|
||||
if (document.getElementById("root").classList.contains("dark")){
|
||||
style = style_dark + table;
|
||||
}
|
||||
let table = genTable(parsedData.data || parsedData, 0, parsedData.header);
|
||||
tabElem.innerHTML = style + table;
|
||||
}
|
||||
|
||||
setSize(size) {
|
||||
|
Loading…
Reference in New Issue
Block a user