makeChart = async (graphConfig) => {
if (!graphConfig.dataset.includes(" from ")) return d3.create("svg");
const [sheet, url] = graphConfig.dataset.split(" from ");
const raw = await read(url, sheet);
const [x, y] = raw.columns;
const data = raw.map((m) => ({ [x]: d3.utcParse("%Y")(m[x]), [y]: +m[y] }));
return chart({
data,
x,
y,
width, height,
numberFormat: (d) => d3.format("d")(d) + (graphConfig.format === "percent" ? "%" : ""),
...graphConfig
});
}