Public
Edited
Mar 26, 2024
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
waffleIron(d, {
squareSize: 5,
squareBuffer: 1,
color: data(year).map((d) => Object.values(d)[1]),
animation: false,
xAxis: 5,
xAxisEnabled: false,
waffleBufferRow: 5,
waffleBufferCol: 5,
marginXaxisTop: 10,
sumWaffleAxis: false,
scaling: 1,
scaleHundredTo: 50,
suffix: "GWh",
ticks: 5,
fontSize: 12,
cornerRadius: 0
})
Insert cell
Insert cell
opennem
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
data1
X
date
Y
Coal (Brown) - GWh
Color
Coal (Brown) - GWh
Size
Facet X
Facet Y
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
waffleIron([100])
Insert cell
Insert cell
waffleIron([90, 10, 20, 30, 100], {
animation: true,
delay: 0.4,
squareSize: 15
})
Insert cell
Insert cell
waffleIron([100, 100, 1000], { animation: true, xAxis: true, squareSize: 5 })
Insert cell
Insert cell
waffleIron([50, 30, 1], {
color: ["#a543ae", "#000", "#00bb"],
bgcolor: "#af1", //beautiful,
squareSize: 8,
waffleStacks: 2, // how many columns of waffles
squareBuffer: 10, //space between squares
waffleBufferRow: 45, //space between waffles
waffleBufferCol: 40, //space between waffles
numberOfRows: 5, //# of rows in a waffle
numberOfColumns: 5, //# of columns in a waffle
delay: 50,
xaxis: true
})
Insert cell
waffleIron([31, 48, 7], {
bgcolor: "#fff", //set to white for no bg colour
numberOfRows: 5, //# of rows in a waffle
scaleHundredto: 79, //if you want to break the space-time continuum a value of 79 will now fill 100% of a waffle
squareSize: 2,
squareBuffer: 7,
delay: 1,
xAxis: true,
scaling: 100,
suffix: "MW"
})
Insert cell
Insert cell
Insert cell
opennem = FileAttachment("19981201 OpenNEM.csv").csv({ typed: true })
Insert cell
function data(year) {
var yearly = opennem.filter((d) => d3.timeFormat("%Y")(d.date) == year);
var tmp = [];
var ret = [];
var cols = Object.keys(yearly[0]);

cols.forEach((x, i) =>
tmp.push({
[x.split(" ", 1)]: d3.sum(yearly.map((d) => d[x])),
color: colors[x.split(" ", 1)]
})
);

return tmp.slice(3, 17);
}
Insert cell
Insert cell
years = d3.range(1999, 2023)
Insert cell
colors = Object.assign({
Coal: "#ABDDF3",
Bioenergy: "#FE6A97",
Distillate: "#E9B4E6",
Gas: "#B536AF",
Battery: "#12ffaa",
Hydro: "#384651",
Wind: "#F6B27B",
Solar: "#A90235"
})
Insert cell
f = d3.format(".1f")
Insert cell
Insert cell
Insert cell
import { Swatches } from "@d3/color-legend"
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more