Commits

Simon Cross committed 82f4787

Alternative height calculation.

Comments (0)

Files changed (1)

                 var shape = d3.select(this);
                 var content = d.aggField[0];
 
-                var height = parseFloat(shape.attr("height"));
+                var full_height = y._scale(0.0) - y._scale(1.0);
+                var height = d.yValue * full_height;
                 var width = parseFloat(shape.attr("width"));
 
+                if (height <= 16) {
+                    return;
+                }
+
                 svg.append("text")
                     .attr("class", "fire-plot-text")
                     // position centre
-                    .attr("x", parseFloat(shape.attr("x")) + width * 1.1)
-                    .attr("y", parseFloat(shape.attr("y")) + height - 10)
+                    .attr("x", parseFloat(shape.attr("x")) + (width * 1.1))
+                    .attr("y", parseFloat(shape.attr("y")) - (height * 0.5))
                     // centre align
                     .style("text-anchor", "left")
                     .style("font-size", "1.5em")