Public
Edited
Oct 24, 2024
Insert cell
Insert cell
chart = {
const chartHolder = d3.select(document.createElement("div"));

const myChart = d3Ez.chart.roseChart()
.colors(colors)
.width(width)
.height(width);

chartHolder.datum(data).call(myChart);

return chartHolder.node();
}
Insert cell
climate_daily_bc_2014-2023.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
getAverDataPerMonth = function () {
var data = weathInfo23;
const parsedData = data.map(d => ({
month: d.Month, // Assuming your CSV has a column named 'month'
temperature: d.MeanTemp,
precip: +d.TotalPrecip,
gust: +d.MaxGust
}));
//const filteredData = parsedData.filter(d => !isNaN(d.temperature) && !isNaN(d.precipitation));
// Group by month and calculate average temperatures
const monthlyInfo = d3.group(parsedData, d => d.month);
const averages = Array.from(monthlyInfo, ([month, values]) => {
const tempAver = Math.round(d3.mean(values, d => d.temperature));
const rainlyDays = Math.round(values.filter(d => d.precip>2).length/10);
const gustDays = Math.round(values.filter(d => !isNaN(d.gust)).length/10);
return {
key: month,
values: [
{ key: 'tempAver', value: tempAver },
{ key: 'rainlyDays', value: rainlyDays },
{ key: 'gustDays', value: gustDays }
]
};
});
return averages
}
Insert cell
Insert cell
// // Assuming `aggregatedData` is your dataset
// md`### Aggregated Data
// \`\`\`json
// ${JSON.stringify(data, null, 2)}
// \`\`\``

Insert cell
colors = ["#fbb4ae","#ccebc5","#b3cde3","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]
Insert cell
d3 = require('d3')
Insert cell
d3Ez = require("d3-ez@4.0.6")
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