perf: add point values
For golang/go#48803.
Change-Id: I1d683fd33f12d2cfcc2050aad180ef4ab6431d98
Reviewed-on: https://go-review.googlesource.com/c/build/+/412996
Reviewed-by: Michael Knyszek <mknyszek@google.com>
diff --git a/third_party/bandchart/bandchart.js b/third_party/bandchart/bandchart.js
index 93fb0b3..0f89cd4 100644
--- a/third_party/bandchart/bandchart.js
+++ b/third_party/bandchart/bandchart.js
@@ -288,6 +288,30 @@
}).format(X[i])
+ ")")
)
+ .call(g => g.append('text')
+ // Point center, low, high values.
+ // Bottom-right corner, next to "Commits".
+ .attr("x", xRange[1])
+ .attr("y", yRange[0] + (yRange[0]-yRange[1])*0.12)
+ .attr("pointer-events", "none")
+ .attr("fill", "currentColor")
+ .attr("text-anchor", "end")
+ .attr("font-family", "sans-serif")
+ .attr("font-size", 12)
+ .text(Intl.NumberFormat([], {
+ style: 'percent',
+ signDisplay: 'always',
+ minimumFractionDigits: 2,
+ }).format(Y[i]) + " (" + Intl.NumberFormat([], {
+ style: 'percent',
+ signDisplay: 'always',
+ minimumFractionDigits: 2,
+ }).format(Y1[i]) + ", " + Intl.NumberFormat([], {
+ style: 'percent',
+ signDisplay: 'always',
+ minimumFractionDigits: 2,
+ }).format(Y2[i]) + ")")
+ )
})
.on("mouseout", () => svg.selectAll('.tooltip').remove());