morrisjs / morris.js

Pretty time-series line graphs
http://morrisjs.github.com/morris.js/
6.91k stars 1.23k forks source link

Show hover legend (tooltip) programmatically #715

Closed cagi11 closed 7 years ago

cagi11 commented 7 years ago

Hi, is there a way to show hover legend (tooltips) programmatically, something like chart.showHover(row_index); Thanks in advance.

cagi11 commented 7 years ago

As I only need this for bar charts I added this to morris.js Bar.prototype.myShowHoverLegendForRow = function(index) { if (index < 0 || index > this.data.length - 1) { return null; } return (_ref = this.hover).update.apply(_ref, this.hoverContentForRow(index)); } also You may need this to close(hide) legend: Bar.prototype.myHideHoverLegend = function() { return this.hover.hide(); }