Skip to content
Snippets Groups Projects
Commit f77dcf9e authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix line/area/bar with no goal

parent 47b4c579
No related branches found
No related tags found
No related merge requests found
......@@ -499,20 +499,22 @@ function lineAndBarOnRender(chart, settings, onGoalHover, isSplitAxis) {
// add the label
let goalLine = chart.selectAll(".goal .line")[0][0];
let { x, y, width } = goalLine.getBBox();
const labelOnRight = !isSplitAxis;
chart.selectAll(".goal .stack._0")
.append("text")
.text("Goal")
.attr({
x: labelOnRight ? x + width : x,
y: y - 5,
"text-anchor": labelOnRight ? "end" : "start",
"font-weight": "bold",
fill: "rgb(157,160,164)",
})
.on("mouseenter", function() { onGoalHover(this); })
.on("mouseleave", function() { onGoalHover(null); })
if (goalLine) {
let { x, y, width } = goalLine.getBBox();
const labelOnRight = !isSplitAxis;
chart.selectAll(".goal .stack._0")
.append("text")
.text("Goal")
.attr({
x: labelOnRight ? x + width : x,
y: y - 5,
"text-anchor": labelOnRight ? "end" : "start",
"font-weight": "bold",
fill: "rgb(157,160,164)",
})
.on("mouseenter", function() { onGoalHover(this); })
.on("mouseleave", function() { onGoalHover(null); })
}
}
// run these first so the rest of the margin computations take it into account
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment