Browse Source

Merge branch 'GermainBergeron-tooltip_show_hide_events'

pull/1207/head
Masayuki Tanaka 10 years ago
parent
commit
22def37867
  1. 6
      c3.js
  2. 4
      c3.min.js
  3. 4
      src/api.tooltip.js
  4. 2
      src/config.js

6
c3.js

@ -1257,6 +1257,8 @@
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: {
@ -6856,10 +6858,14 @@
// emulate mouse events to show
$$.dispatchEvent('mouseover', index, mouse);
$$.dispatchEvent('mousemove', index, mouse);
this.config.tooltip_onshow.call($$, args.data);
};
c3_chart_fn.tooltip.hide = function () {
// TODO: get target data by checking the state of focus
this.internal.dispatchEvent('mouseout', 0);
this.config.tooltip_onhide.call(this);
};
// Features:

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

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);
this.config.tooltip_onshow.call($$, args.data);
};
c3_chart_fn.tooltip.hide = function () {
// TODO: get target data by checking the state of focus
this.internal.dispatchEvent('mouseout', 0);
this.config.tooltip_onhide.call(this);
};

2
src/config.js

@ -203,6 +203,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