aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2015-04-02 19:24:45 +0200
committerKristian Lyngstol <kristian@bohemians.org>2015-04-02 19:24:45 +0200
commit0d8bba263dc195147d6fdb09662e7926f0a58b3e (patch)
tree4c570b4376c323e585120e7695b8715be7aa8881 /web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js
parente4354b47bd8891c5b1ee591fdf74b3ca67eee461 (diff)
Bump lots of changes
Diffstat (limited to 'web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js')
-rw-r--r--web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js b/web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js
new file mode 100644
index 0000000..045a52e
--- /dev/null
+++ b/web/nms.gathering.org/speedometer/c3-master/src/api.tooltip.js
@@ -0,0 +1,35 @@
+c3_chart_fn.tooltip = function () {};
+c3_chart_fn.tooltip.show = function (args) {
+ var $$ = this.internal, index, mouse;
+
+ // determine mouse position on the chart
+ if (args.mouse) {
+ mouse = args.mouse;
+ }
+
+ // determine focus data
+ if (args.data) {
+ if ($$.isMultipleX()) {
+ // if multiple xs, target point will be determined by mouse
+ mouse = [$$.x(args.data.x), $$.getYScale(args.data.id)(args.data.value)];
+ index = null;
+ } else {
+ // TODO: when tooltip_grouped = false
+ index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x);
+ }
+ }
+ else if (typeof args.x !== 'undefined') {
+ index = $$.getIndexByX(args.x);
+ }
+ else if (typeof args.index !== 'undefined') {
+ index = args.index;
+ }
+
+ // emulate mouse events to show
+ $$.dispatchEvent('mouseover', index, mouse);
+ $$.dispatchEvent('mousemove', index, mouse);
+};
+c3_chart_fn.tooltip.hide = function () {
+ // TODO: get target data by checking the state of focus
+ this.internal.dispatchEvent('mouseout', 0);
+};