Browse Source

Fixes #1192

Added onshow and onhide functions on tooltip
pull/1193/head
GermainBergeron 9 years ago
parent
commit
ce96ac07da
  1. 4
      src/api.tooltip.js
  2. 2
      src/config.js

4
src/api.tooltip.js

@ -28,8 +28,12 @@ c3_chart_fn.tooltip.show = function (args) {
// emulate mouse events to show
$$.dispatchEvent('mouseover', index, mouse);
$$.dispatchEvent('mousemove', index, mouse);
config.tooltip_onshow.call($$, dataToShow);
};
c3_chart_fn.tooltip.hide = function () {
// TODO: get target data by checking the state of focus
this.internal.dispatchEvent('mouseout', 0);
config.tooltip_onhide.call(this);
};

2
src/config.js

@ -192,6 +192,8 @@ c3_chart_internal_fn.getDefaultConfig = function () {
tooltip_init_show: false,
tooltip_init_x: 0,
tooltip_init_position: {top: '0px', left: '50px'},
tooltip_onshow: function () {},
tooltip_onhide: function () {},
// title
title_text: undefined,
title_padding: {

Loading…
Cancel
Save