Mercurial > hg > numerics
changeset 155:2a124febcd49
prepping for labels
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 12 May 2015 16:04:05 -0700 |
parents | 134bdb520040 |
children | 69940819bc8a |
files | numerics/templates/bar.d3.html |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/numerics/templates/bar.d3.html Tue May 12 15:51:59 2015 -0700 +++ b/numerics/templates/bar.d3.html Tue May 12 16:04:05 2015 -0700 @@ -21,6 +21,7 @@ <svg class="svgchart"></svg> <script> var data = {{data}}; + var labels = {}; var width = 420, barHeight = 20; var x = d3.scale.linear() @@ -40,7 +41,14 @@ .attr("x", function(d) { return x(d) - 3; }) .attr("y", barHeight / 2) .attr("dy", ".35em") - .text(function(d) { return d; }); + .text(function(d) { + var label = labels[String(d)]; + if (label == undefined) { + return d; + } else { + return label + " : " + d; + } + }); </script> </body> </html>