Published
Edited
Jul 2, 2019
1 fork
Insert cell
md`# Mock JS Console`
Insert cell
data = 'https://gist.githubusercontent.com/chrisrzhou/2421ac6541b68c1680f8/raw/e9fe262498c65161f13838d9fd08f87f895a7644/data_car_ratings.csv'
Insert cell
thing = d3.csv(data)
Insert cell
typeof thing
Insert cell
Insert cell
config = d3.json("https://gist.githubusercontent.com/linjac/2978ae782043f42f2666e12639c6fce1/raw/344319b5c453ef1960fa71dd7e72e14838e6b609/config.json")
Insert cell
layers = config.layers
Insert cell
tableState = layers[2].source.data.features
Insert cell
heh = {
const grid = api.grid
for (var n in layers){
if (layers[n].id == "test"){
const tableJSON = JSON.parse(JSON.stringify(layers[n].source.data.features))
for (var cell in grid){
const type = grid[cell][0];
const rotation = grid[cell][1];
tableJSON[cell].properties.type = type;
tableJSON[cell].properties.rotation = rotation;
}
return tableJSON
}
}
}
Insert cell
tableState[0].properties.type
Insert cell
heh[0].properties.type
Insert cell
tableState == heh
Insert cell
d3 = require('d3@5')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more