Public
Edited
Jul 8, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`**Edit me! woooo**`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Math.PI * 2
Insert cell
Insert cell
randomName = {
let diameter = 20;
let radius = diameter/2;
let area = Math.PI*(radius**2)
return area;
}
Insert cell
Insert cell
exponent = 22
Insert cell
2 ** exponent
Insert cell
Insert cell
Insert cell
html`<details>
<summary>Expand me...</summary>
<p>I’m made of <span style="font-weight:bold">HTML</span>!</p>
<br>
<p> I am some other html </p>
</details>`
Insert cell
Insert cell
md`The exponent is: ** ${exponent} **`
Insert cell
Insert cell
Insert cell
nycForecast = FileAttachment("canned-forecast.json").json()
Insert cell
Insert cell
Insert cell
nycForecastPeriods = nycForecast.properties.periods
Insert cell
Insert cell
Insert cell
Insert cell
import {table} from "@tmcw/tables/2"
Insert cell
Insert cell
Insert cell
forecastTable = table( // Call the table() function we imported, and
nycForecastPeriods.slice(0, 6).map( // pass it an array with the 1st 7 elements of the forecast data.
(period) => ({ // For each element of period data, display:....
Day: md`**${period.name}**`, // the day/night's name, ...
Temp: md`**${period.temperature}&nbsp;°F**`, // the temperature in °F, ...
Icon: html`<img width=70 src="${period.icon}" style="padding:5px"/>`, // the icon image, ...
Forecast: period[forecastType] // and the forecast text.
})
)
)
Insert cell
Insert cell
import {toc} from "@nebrius/indented-toc"
Insert cell
Insert cell
Insert cell
Insert cell
forecastType = 'shortForecast' // 👈 try replacing 'detailedForecast' with 'shortForecast'
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { weatherChart } with { nycForecast as forecast } from "@kerryrodden/simple-custom-weather-chart-in-d3"
Insert cell
Insert cell
weatherChart
Insert cell
Insert cell
Insert cell
Insert cell
viewof period = html`<select>
${nycForecastPeriods.map(p => html`<option>${p.name}</option>`)}
</select>`
Insert cell
Insert cell
forecastForPeriod = {
let tempF = nycForecastPeriods.filter(p => p.name === period)[0].temperature;
let preferredTemp = preferredUnit === 'F' ? tempF : f2c(tempF);

return md`**${period}** it will be **${preferredTemp}°${preferredUnit}**`
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
interactiveChart
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more