Published
Edited
Jun 13, 2021
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!**`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Math.PI * 2
Insert cell
Insert cell
{
let diameter = 20;
let radius = diameter/2;
let area = Math.PI*(radius**2)
return area;
}
Insert cell
Insert cell
exponent = 10
Insert cell
2 ** exponent
Insert cell
md`Observable also allows you to write paragraphs of text styled using the popular [Markdown syntax](https://www.markdownguide.org/basic-syntax/). You can create your own markdown cells with Observable’s builtin <code>md\`\`</code> tag - this cell is an example!`
Insert cell
Insert cell
html`<details>
<summary>Expand me...</summary>
<p>I’m made of <span style="font-weight:bold">HTML</span>!</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, 7).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
Insert cell
Insert cell
Insert cell
Insert cell
forecastType = 'detailedForecast' // 👈 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
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

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