diff --git a/dashboard/src/components/GraphItem.vue b/dashboard/src/components/GraphItem.vue index bf5534bd9..17ae256db 100644 --- a/dashboard/src/components/GraphItem.vue +++ b/dashboard/src/components/GraphItem.vue @@ -40,14 +40,22 @@ function renderTooltip(context) { return; } - const { title, body, labelColors } = tooltip; // these were computed in the "callback" in tooltip configuration + // datapoints are in sync with the indexing of body + const { title, body, labelColors, dataPoints } = tooltip; // these were computed in the "callback" in tooltip configuration if (body) { const titleLines = title || []; const bodyLines = body.map(item => item.lines); let innerHtml = `
${titleLines[0]}
`; - bodyLines.forEach(function(body, i) { + // first amend the value so we know the dataPoints index, then sort and render + bodyLines.forEach((body, i) => { + body.value = dataPoints[i].parsed?.y || 0; + }); + bodyLines.sort((a, b) => { + return b.value - a.value; + }); + bodyLines.forEach((body, i) => { const colors = labelColors[i]; innerHtml += `
${body}
`; });