Published
Edited
Oct 27, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Link 3 notebooks with a sunburst diagram. Try to choose notebooks that look like they'll be easy to import
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// what D3 function could we use to make our data look like the data above?
Insert cell
Insert cell
// Give each object in the "data" array a field called "value." "value" should be 1 for every object
Insert cell
// Use d3.rollup() to format the data. Use "Type 1" as the first key and use "Type 2" as the second key. Sum up the values according to the value field
Insert cell
Insert cell
// make a new variable called "formattedData." It should be an Object with two fields: "name" and "children" Assign "name" a value of "Types" For the "children" field assign it our nested data
Insert cell
// use import to import "chart" from '@d3/subburst' and use thw "with" statement to replace the notebook's "data" variable with our "formattedData" varaible
Insert cell
chart // the "null" just means that pokemon only has 1 type
Insert cell
Insert cell
d3 = require('d3@5')
Insert cell
import {
displayCaution,
code_styles,
renderDataTable
} from '@info474/utilities'
Insert cell
code_styles
Insert cell
data = d3.csv(
'https://gist.githubusercontent.com/armgilles/194bcff35001e7eb53a2a8b441e8b2c6/raw/92200bc0a673d5ce2110aaad4544ed6c4010f687/pokemon.csv',
d3.autoType
)
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