Public
Edited
Mar 3, 2023
Insert cell
Insert cell
Insert cell
md`
## !!! 2 additional functions added
* function *on* to capture mouse events which is hooked on each bar of a letter
* function *clicked* to get executed on a captured mouseclick

The idea is now in the react code to redefine the function *clickec* with a function defined in react
`
Insert cell
Insert cell
Insert cell
Insert cell
myBarChart = Plot.plot({
marks: [
on(
Plot.barY(alphabet, {
x: "letter",
y: "frequency",
sort: { x: "y", reverse: true }
}),
{
click: clicked
}
),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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