Published
Edited
Jul 1, 2021
Insert cell
md`# Teste`
Insert cell
viewof height = html`<input type = "range" min = "180" max = "900">`
Insert cell
viewof attribs = multiAutoSelect(Object.keys(data[0]))
Insert cell
viewof typeoftree = select(["treemap","treemapcascaded","zoomtreemap"])
Insert cell
Insert cell
chart = typeoftree === "treemap"? treemap : typeoftree === "treemapcascaded"? treemapcascaded : zoomtreemap;
Insert cell
treedata = table2Tree(data, attribs)
Insert cell
html`<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">`
Insert cell
url = "https://testenbanodejs.herokuapp.com/person/"
Insert cell
data = fetch(url).then(res => res.json())
Insert cell
import { chart as treemap } with {treedata as data, height, attribs, color } from "@d3/treemap"
Insert cell
import { chart as treemapcascaded } with {treedata as data, height, attribs, color} from "@d3/cascaded-treemap"
Insert cell
import {chart as zoomtreemap } with {treedata as data, height, attribs, color} from "@mfgomezb/zoomable-treemap"
Insert cell
import { table2Tree } from "@john-guerra/table-2-tree"
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
import {multiAutoSelect} from "@john-guerra/multi-auto-select"
Insert cell
import { select } from "@jashkenas/inputs"
Insert cell

color = function color (d){
var colors = {
"Male": "Red",
"Female": "Blue",
};
return colors[d];

}

Insert cell
d3 = require("d3@6")
Insert cell
minAge = d3.min(data, d => d.age)
Insert cell
maxAge = d3.max(data, d => d.age)
Insert cell
hierarchy = d3.hierarchy(treedata)
.sum(d => treedata.value)
.sort((a, b) => b.value - a.value)
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