MSyed has uploaded a new change for review. https://gerrit.wikimedia.org/r/150029
Change subject: Changed tooltip to show tooltip on hover of entire bar ...................................................................... Changed tooltip to show tooltip on hover of entire bar Change-Id: Ib493a5e8f73e81dda4a761dc9661b06b7748d941 --- M source/javascripts/privacy.js 1 file changed, 20 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/TransparencyReport refs/changes/29/150029/1 diff --git a/source/javascripts/privacy.js b/source/javascripts/privacy.js index 5b58258..7150dd2 100644 --- a/source/javascripts/privacy.js +++ b/source/javascripts/privacy.js @@ -239,8 +239,9 @@ .attr( 'x', 0 ); } } - +var thisdata; function makeBars( graph, data, xScale, yScale, ds, dispatch, className ) { + var stacked_data = []; data.forEach( function ( d ) { stacked_data.push( { @@ -255,6 +256,9 @@ value: d.value[1], x: 0 } ); + + thisdata=stacked_data; + } ); var bar = graph.selectAll( 'rect.' + className ).data( stacked_data ) @@ -273,8 +277,21 @@ return tooltip.style( 'display', 'block' ); } ) .on( 'mousemove', function ( d ) { + var numDisclosed, numTotal; + thisdata.forEach(function(thisd, thisi){ + if (thisd.key==d.key) { + if (thisd.disclosed == true) { + numDisclosed = thisd.value; + } + else { + numTotal = thisd.value; + } + + } + }) + return tooltip - .html( '<b>' + d.key + '</b><br>' + d.value ) + .html( '<b>' + d.key + '</b><br>' + numTotal + '</b><br>' + numDisclosed ) .style( 'top', ( d3.event.pageY - 25 ) + 'px' ) .style( 'left', ( d3.event.pageX + 25 ) + 'px' ); } ) @@ -303,6 +320,7 @@ makeBars( graph, data, xScale, yScale, ds, dispatch, 'blue_bars' ); makeLabels( graph, data, xScale, yScale, ds, dispatch, 'blue_bars' ); + dispatch.on( 'filter.' + element, function () { var new_data = ds.groupBy( groupBy, true ); makeBars( graph, new_data, xScale, yScale, ds, dispatch, 'blue_bars' ); -- To view, visit https://gerrit.wikimedia.org/r/150029 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib493a5e8f73e81dda4a761dc9661b06b7748d941 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/TransparencyReport Gerrit-Branch: master Gerrit-Owner: MSyed <ms...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits