Added hovering support to the pie charts in the HTML output.

The name of the author is now highlighted in the table whenever a pie
piece in the pie chart is hovered over. Currently, it does not work the
other way around (because of a limitation in the flot library).
This commit is contained in:
Adam Waldenberg 2013-06-18 03:09:59 +02:00
parent 6b2f26ed04
commit 2bfb3cfa67
3 changed files with 25 additions and 0 deletions

View file

@ -200,6 +200,8 @@ class BlameOutput(Outputable):
blame_xml += " label: \"Minor Authors\""
blame_xml += " }"
blame_xml += " }"
blame_xml += " }, grid: {"
blame_xml += " hoverable: true"
blame_xml += " }"
blame_xml += " });"
blame_xml += "</script></div></div>"

View file

@ -210,6 +210,8 @@ class ChangesOutput(Outputable):
changes_xml += " label: \"Minor Authors\""
changes_xml += " }"
changes_xml += " }"
changes_xml += " }, grid: {"
changes_xml += " hoverable: true"
changes_xml += " }"
changes_xml += " });"
changes_xml += "</script>"

View file

@ -94,6 +94,24 @@
$("div#timeline table.git tbody tr:visible").each(colorRows);
}});
}}
$("#blame_chart, #changes_chart").bind("plothover", function(event, pos, obj) {{
if (obj) {{
var selection = "table tbody tr td:contains(\"" + obj.series.label + "\")";
var element = $(this).parent().find(selection);
if (element) {{
if (this.hoveredElement && this.hoveredElement.html() != element.parent().html()) {{
this.hoveredElement.removeClass("piehover");
}}
element.parent().addClass("piehover");
this.hoveredElement = element.parent();
}}
}} else if (this.hoveredElement) {{
this.hoveredElement.removeClass("piehover");
}}
}});
}});
</script>
<style type="text/css">
@ -176,6 +194,9 @@
table.git tr.odd {{
background-color: #dbdbdb;
}}
table.git tr.piehover {{
background-color: #dddece;
}}
div.chart {{
position: absolute;
top: 5px;