Make heatmap hover box more informative.

Closes #143.
This commit is contained in:
D. Berge
2021-09-20 00:17:35 +02:00
parent 09b45d5d65
commit 894877750e

View File

@@ -145,15 +145,16 @@ export default {
} }
}; };
const hovertemplate = { const hovertemplate = {
// Mode Filltime: "SP%{x}<br>%{y}<br>%{z} ms",
Mode: "%{x}", Volume: "SP%{x}<br>%{y}<br>%{z} in³",
// Detect Pressure: "SP%{x}<br>%{y}<br>%{z} psi",
Detect: "%{x}", Depth: "SP%{x}<br>%{y}<br>%{z} m",
// Autofire Delay: "SP%{x}<br>%{y}<br>%{z} ms",
Autofire: Firetime: "SP%{x}<br>%{y}<br>%{z} ms",
"x: %{x}<br>" + Aimpoint: "SP%{x}<br>%{y}<br>%{z} ms",
"y: %{y}<br>" + Autofire: "SP%{x}<br>%{y}<br>%{text}",
"z: %{meta.text[%{z}]}" Detect: "SP%{x}<br>%{y}<br>%{text}",
Mode: "SP%{x}<br>%{y}<br>%{text}"
}; };
const guns = [...new Set(data.map( s => s.meta.guns.map( g => g[1] ) ).flat())]; const guns = [...new Set(data.map( s => s.meta.guns.map( g => g[1] ) ).flat())];
const z = {}; const z = {};
@@ -193,7 +194,9 @@ export default {
z: z[aspect], z: z[aspect],
xaxis: "x", xaxis: "x",
yaxis: "y" + (idx > 0 ? idx+1 : ""), yaxis: "y" + (idx > 0 ? idx+1 : ""),
text: meta[aspect]?.text ? z[aspect].map( row => row.map( v => meta[aspect].text[v] )) : undefined text: meta[aspect]?.text ? z[aspect].map( row => row.map( v => meta[aspect].text[v] )) : undefined,
hovertemplate: hovertemplate[aspect],
meta: meta[aspect]
} }
}); });
} }