Public
Edited
May 3, 2022
Insert cell
Insert cell
Insert cell
import {powerplants_2010} from "@emfielduva/dvlib_sampledata"
Insert cell
powerplants_2010
Insert cell
Insert cell
states = [... new Set (powerplants_2010.map(d => d["Plant state abbreviation"]))] // unique state values from the full data.
Insert cell
viewof selectedState = Inputs.select(states, {label: "State"})
Insert cell
selectedState // this is just to show you here what the variable `selectedState` is returning
Insert cell
Insert cell
powerplants_2010.filter(d => d["Plant state abbreviation"] == selectedState)
Insert cell
Insert cell
plantNamesInSelectedState = powerplants_2010.filter(d => d["Plant state abbreviation"] == selectedState).map(d => d["Plant name"])
Insert cell
Insert cell
viewof selectedPlantName = Inputs.select(plantNamesInSelectedState, {label: "Plant"})
Insert cell
selectedPlantName // the end result - one plant, that we use in the visual or somewhere else.
Insert cell
Insert cell
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