javascript - I'm having trouble with formatting when using tooltips (or labels?) in D3.js -
i’m totally noob-tastic (i.e. have little programming background , trying hack dashboard using borrowed code) eager learn more!
i’m hung hope small issue. i’m using version of bostock’s calendar example...
...and have managed close desired outcome i’m having trouble tooltip(?), second .attr under rect.filter below.
d3.csv("bugeseradata.csv", function(error, csv) { csv.foreach(function(d) { d.daily_total = parseint(d.daily_total); }); var daily_total_max = d3.max(csv, function(d) { return d.daily_total; }); var data = d3.nest() .key(function(d) { return d.date1; }) .rollup(function(d) { return math.sqrt(d[0].daily_total / daily_total_max); }) .map(csv); rect.filter(function(d) { return d in data; }) .attr("fill", function(d) { return color(data[d]); }) .attr("data-title", function(d) { return 'rwf ' +d }); $("rect").tooltip({container: 'body', html: true, placement:'top'}); });
the data has been imported .csv , has 2 “columns” (i'm using excel), titled 'date1' , 'daily_total' respectively.
when mouse on particular day want to return “rwf” + value second column (the amount or daily_total).
currently, “rwf” shows when use d.daily_total (the second column) result returning “rwf undefined”. if use “rwf” + d “rwf” date (the value first column).
would please me understand correct way achieve this?
this data local government revenue collection , want able show collection amounts day @ glance. want actual collection amounts (not date) show upon mouseover.
thank you!
the variable "data" contains csv data in form of json data. take here how works.
http://bl.ocks.org/phoebebright/raw/3176159
try
'rwf ' + data[d]
instead of
'rwf ' + d
Comments
Post a Comment