Published unlisted
Edited
Nov 10, 2020
Insert cell
Insert cell
Insert cell
scrubbedPresidentialElectionChart = {
const svg = transactionsOverTime(
d3.create("svg"),
presidentialDebateColors,
scrubbedElectionTransactions[2],
[],
// {timeExtent: d3.extent(TIK_TOK.transactions, t => new Date(t.timestamp))},
{
annotateReasons: true,
transactionLines: false,
transactionPoints: true,
answerUnifiedLine: false,
hourlyPriceLines: true,
},
);
return svg.node();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
percFormat = d3.format('.0%');
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
presidentialDebateColors = d3.scaleOrdinal()
.domain(PRESIDENTIAL_ELECTION.answers.map(a => a.answer_id))
.range([`rgb(247, 102, 84)`, `rgb(70, 150, 191)`, 'rgb(70, 150, 191)', 'rgb(247, 102, 84)']);
Insert cell
PRESIDENTIAL_ELECTION = computeQuestion("TWFya2V0OlZaX25SYk1RSHlN", PRESIDENTIAL_ELECTION_TRANSACTIONS, {hideInverse: true});
Insert cell
PRESIDENTIAL_ELECTION_TRANSACTIONS = FileAttachment("transactions-TWFya2V0OlZaX25SYk1RSHlN.json").json();
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
DAY_IN_MS = 60 * 60 * 1000 * 24
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3_svg_legend = require("d3-svg-legend")
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