Published
Edited
May 4, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
xMin = 0
Insert cell
yMax = d3.max(filteredData.map(d => d[Variable]))
Insert cell
yMin = Variable === "GC_skew" ? d3.min(filteredData.map(d => d[Variable])) : 0
Insert cell
line = d3
.line()
.x(d => x(d.window))
.y(d => y(d[Variable]))
Insert cell
line2 = d3
.line()
.x(d => x2(d.window))
.y(d => y2(d[Variable]))
Insert cell
y = d3
.scaleLinear()
.domain([yMin, yMax])
.range([height1, 0])
Insert cell
x = d3
.scaleLinear()
.domain([xMin, xMax])
.range([0, width])
Insert cell
x2 = d3
.scaleLinear()
.domain([xMin, xMax])
.range([0, width])
Insert cell
width
Insert cell
y2 = d3
.scaleLinear()
.domain([yMin, yMax])
.range([height2, 50])
Insert cell
xAxis = d3.axisBottom(x).tickFormat(x => `${x / 1000000}MB`)
Insert cell
yAxis = d3.axisLeft(y)
Insert cell
xAxis2 = d3.axisBottom(x2).tickFormat(x => `${x / 1000000}MB`)
Insert cell
yAxis2 = d3.axisLeft(y2)
Insert cell
margin = ({ top: 20, bottom: 120, left: 40, right: 20 })
Insert cell
margin1 = ({ top: 300, bottom: 40, left: 40, right: 20 })
Insert cell
height1 = 300
Insert cell
height2 = 80
Insert cell
Insert cell
Insert cell
Insert cell
filteredDataMA = {
let filteredDataMA = movingAverage(filteredData.map(d => d[Variable]), mavg); // maybe user can change input
for (let i = 0; i < filteredData.length; i++) {
filteredData[i].MA = filteredDataMA[i];
}
return filteredData;
}
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