Public
Edited
May 1, 2023
2 forks
Insert cell
Insert cell
Insert cell
Insert cell
import { data_standardized } from "64387482b4a7ad66"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { interval } from "@mootari/range-slider@1786"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
time_slider
Insert cell
Insert cell
Insert cell
erliestYear_slider = time_slider[0]
Insert cell
latestYear_slider = time_slider[1]
Insert cell
Insert cell
Insert cell
earliestYear_slider_asTime = new Date(time_slider[0], 1).getTime()
Insert cell
latestYear_slider_asTime = new Date(time_slider[1], 1).getTime()
Insert cell
Insert cell
Insert cell
data_standerdized_filtered = aq
.from(data_standardized)
.filter(aq.escape((d) => d["Date"] > earliestYear_slider_asTime))
.filter(aq.escape((d) => d["Date"] < latestYear_slider_asTime))
.objects()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
nice: true,
grid: true,
y: {
label: "Z-Score"
},
marks: [
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon"
}),
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step"
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
nice: true,
grid: true,
y: {
label: "Z-Score"
},
marks: [
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon"
}),
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step"
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon",
title: (d) => d3.format(".4s")(d["Close"]),
r: 1
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step",
title: (d) => d3.format(".4s")(d["Volume"]),
r: 1
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
// Uncomment to activate

import { Plot } from "@mkfreeman/plot-tooltip"
Insert cell
Insert cell
Plot.plot({
nice: true,
grid: true,
y: {
label: "Z-Score"
},
marks: [
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon"
}),
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step"
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon",
title: (d) => d3.format(".4s")(d["Close"]),
r: 1
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step",
title: (d) => d3.format(".4s")(d["Volume"]),
r: 1
})
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
nice: true,
grid: true,
y: {
label: "Z-Score"
},
marks: [
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon"
}),
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step"
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon",
title: (d) => d3.format(".4s")(d["Close"]),
r: 1,
opacity: 0
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step",
title: (d) => d3.format(".4s")(d["Volume"]),
r: 1,
opacity: 0
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
nice: true,
grid: true,
y: {
label: "Z-Score"
},
marks: [
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon"
}),
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step"
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "CloseStandardized",
stroke: "salmon",
title: (d) => d["Close"].toFixed() + " USD",
r: 1,
opacity: 0
}),
Plot.dot(data_standerdized_filtered, {
x: "Date",
y: "VolumeStandardized",
stroke: "dodgerblue",
curve: "step",
title: (d) => (d["Volume"] / 1_000_000_000).toFixed() + " Billion USD",
r: 1,
opacity: 0
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
grid: true,
nice: true,
height: 150,

y: {
label: "Volume in Billion USD",
transform: (d) => d / 1_000_000_000
},
marks: [
Plot.lineY(data_standerdized_filtered, {
x: "Date",
y: "Volume",
stroke: "dodgerblue",
curve: "step"
})
]
})
Insert cell
Insert cell
Insert cell
import {imageToDo} from "@clokman/student-blocks"
Insert cell
imageToDo
Insert cell
import {howTo} from "@clokman/howto"
Insert cell
import {showMe} from "@observablehq/show-me"
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