Published
Edited
Mar 5, 2021
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x).ticks(width / 180).tickSizeOuter(0))
.call(g => g.select(".domain").remove())
Insert cell
yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y)
.tickValues(d3.scaleLinear().domain(y.domain()).ticks(5))
.tickFormat(formatChange))
.call(g => g.selectAll(".tick line")
.select(function() { return this.parentNode.appendChild(this.cloneNode()); })
.attr("stroke-opacity", d => d === 0 ? null : 0.2)
.attr("x2", width - margin.left - margin.right))
.call(g => g.select(".domain").remove())
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.rollups(main_file, v => v.length >= 30? d3.mean(v, d => d['Google sentiment product'] ) : 0 , d => new Date(Number(getMonday(new Date(d['timestamp'])).getFullYear()), Number(getMonday(new Date(d['timestamp'])).getMonth()) - 1, Number(getMonday(new Date(d['timestamp'])).getDate()))).map(el => ({
date: el[0],
value: el[1]
})
)
Insert cell
getMonday(new Date()); // Mon Nov 08 2010
Insert cell
Insert cell
import {d3, main_file} from "@mtsvelik/book-club-whatsapp-group-what-our-posts-say-about-us-intro"
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