Merge pull request #13 from br00k/blip-hover
authorBruno Trecenti <bruno.lopestrecenti@gmail.com>
Mon, 24 Aug 2015 13:46:32 +0000 (10:46 -0300)
committerBruno Trecenti <bruno.lopestrecenti@gmail.com>
Mon, 24 Aug 2015 13:46:32 +0000 (10:46 -0300)
Add tooltips to Blips

src/graphing/radar.js

index 4265b2a..46c43ae 100644 (file)
@@ -1,4 +1,4 @@
-tr.graphing.Radar = function (size, radar) {
+tr.graphing.Radar = function (size, radar, toolTipDescription) {
   var self, fib, svg;
 
   fib = new tr.util.Fib();
@@ -132,6 +132,10 @@ tr.graphing.Radar = function (size, radar) {
           .attr('class', 'blip-text')
           .attr('text-anchor', 'middle')
           .text(blip.number())
+          .append("svg:title")
+          .text(blip.name() + ((toolTipDescription && blip.description()) 
+              ? ': ' + blip.description().replace(/(<([^>]+)>)/ig, '') 
+              : '' ))
       });
     });
   };