4OATQEBXRS3ZVQK2APYX2G3OJRPZBJUL4U7NNH6BZTNJGXCGLWHQC
// const ctx = heatmap.getContext("2d");
const root = new Crate("cargo-depgraph");
split(root.dependencies, heatmap)
const scatter = document.getElementById("scatter")
const SCALE_FACTOR = 100;
const RADIUS = 5;
let longest_duration = 0;
let most_unlocked = 0;
for (const name of NODES) {
const crate = new Crate(name);
longest_duration = Math.max(longest_duration, crate.sum_duration());
most_unlocked = Math.max(most_unlocked, crate.total_unlocked)
}
console.assert(longest_duration > 0);
function createGraphNode(crate) {
const node = document.createElement("div");
node.classList.add("graph-node");
// for (const item of UNIT_DATA) {
// ctx.beginPath();
// ctx.arc(item.duration * 100, (item.unlocked_units,length + item.unlocked_rmeta_units.length) * 100, 5, 0, 2 * Math.PI);
// ctx.stroke();
// }
// X position
const duration = crate.sum_duration();
// Half margin on either side, so divide by 2
const marginX = `${(duration / longest_duration) * 100}%`;
node.style.left = marginX;
const root = new Crate("cargo-depgraph");
// Y position
const unlocked = crate.total_unlocked;
const marginY = `${(unlocked / most_unlocked) * 100}%`;
node.style.bottom = marginY;
// Styling
node.title = crate.name;
node.style.width = `10px`
node.style.height = "10px";