diff --git a/app/main/static/js/charges.js b/app/main/static/js/charges.js index acd66a2..91f4af9 100644 --- a/app/main/static/js/charges.js +++ b/app/main/static/js/charges.js @@ -75,6 +75,15 @@ function build_chart(div_selector, data_url, project_name, category) { var mouseover = function (e, d) { var category_name = d3.select(this.parentNode).datum().key var category_charge = d.data[category_name] + show_tooltip(e, category_name, category_charge) + } + + var mouseovergrouped = function (e, d) { + var category_name = d.key + var category_charge = d.value + show_tooltip(e, category_name, category_charge) + } + var show_tooltip = function (e, category_name, category_charge) { tooltip .transition() .duration(200) @@ -165,7 +174,10 @@ function build_chart(div_selector, data_url, project_name, category) { .attr("y", d => yScale(d.value)) .attr("width", xCategories.bandwidth()) .attr("height", d => height - yScale(d.value)) - .attr("fill", d => colorScale(d.key)); + .attr("fill", d => colorScale(d.key)) + .on("mouseover", mouseovergrouped) + .on("mousemove", mousemove) + .on("mouseleave", mouseleave); } -- libgit2 0.21.2