Coder Social home page Coder Social logo

highcharts-tooltip-delay's People

Contributors

phrxst avatar prettycode avatar rudovjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

highcharts-tooltip-delay's Issues

It shows tooltips after mouse has left

Instead of "if (point === chart.hoverPoint || $.inArray(chart.hoverPoint, point) )"
there should be "if (point === chart.hoverPoint || $.inArray(chart.hoverPoint, point) > -1)"

Please add a package.json to your repo

Hi

I am looking forward to use this great plugin for my app. The only thing that stops me is that I am using npm thus I am not able to start using this until there is no package.json file in your repo.
Could you please add package.json with minimum info?

Best regards,
Andrey

MIT License

Hi, I'd like to use this plugin in a closed source app, but I can't do so with the current GPL license. Would you consider switching to a more permissive license, like MIT?

Thanks!

Add an "initialDelay" option

IMHO, the delay is more useful for the initial show such that it is not triggered inadvertently. If the tooltip is already visible, the subsequent hovers should update it with no delay. Having a separate option called initialDelay will be helpful in this regard.

Do not show tooltip if mouseout before delay ends

It seems a tooltip delay is useful in cases where there are many series on a chart; in such scenarios, I'd like to see an option to prevent display of the tooltip if the user has moused out before the delay is completed - in this way, you can mouse around on the chart without a tooltip following you everywhere, unless you explicitly wait around above a Point.

Fix for multi-series tooltip

For charts that have multiple series, the tooltip delay method inadvertently cancels the timer for potentially valid events. This is because timerId is a single value when it needs to hold a separate value for each series. This required a mild refactor:

(function (H) {

    var timerId = {};

    H.wrap(H.Tooltip.prototype, 'refresh', function (proceed) {

        var seriesName = arguments[1].series.name;

        var delayForDisplay = this.chart.options.tooltip.delayForDisplay ? this.chart.options.tooltip.delayForDisplay : 1000;

        if (timerId[seriesName]) {
            clearTimeout(timerId[seriesName]);
            delete timerId[seriesName];
        }

        timerId[seriesName] = window.setTimeout(function () {
            var point = this.refreshArguments[0];

            if (point === this.chart.hoverPoint || $.inArray(this.chart.hoverPoint, point) > -1) {
                proceed.apply(this.tooltip, this.refreshArguments);
            }

        }.bind({
                refreshArguments: Array.prototype.slice.call(arguments, 1),
                chart: this.chart,
                tooltip: this
        }), delayForDisplay);

    });

}(Highcharts));

timerId has become an object, with the timer for each series stored as the series name key. This allows each series' previous hover points to be canceled without affecting other series.

Additionally, because the setTimeout callback may be called multiple times (once for each series), I set their context instead of relying exclusively on closures.

Module connection problem

Hey. I use npm and vue-js. I connected your plugin like this:

import Vue from 'vue';
import HighchartsVue from 'highcharts-vue';
import Highcharts from 'highcharts/highcharts';
import HighchartTooltipDelay from 'highcharts-tooltip-delay';

HighchartTooltipDelay(Highcharts);

Vue.use(HighchartsVue, { highcharts: Highcharts });

// init vue ...

But I get the error: IMG HERE

tooltip-delay.dist.js:47 Uncaught ReferenceError: Highcharts is not defined
    at Object.../node_modules/highcharts-tooltip-delay/tooltip-delay.dist.js ...

Living example here

Connecting other plugins in the same way works fine!
What am I doing wrong? Thanks in advance!

Issue with delay if shared = true in tooltip

There seems to be an issue with the delay if the shared property is set to true in a combined column and spline chart. The behavior that I'm seeing is that the delay is ignored and the tooltip displays instantly.
tooltip: {
shared: true,
delayForDisplay: 1000,
}

Default of 1000 is never used.

Here's what the code looks like:

if (delayForDisplay) {
    window.setTimeout(function () {
        ...
    }, delayForDisplay || 1000);
}
...

Because if(delayForDisplay) only executes if delayForDisplay is truthy, delayForDisplay || 1000 will never || to 1000.

Due to es6 syntax, uglify failures in project.

So i am trying to do a npm install which now pulls the new version 1.2.0, the build fails as i cant uglify the es6 syntax in the new code. Also if you could publish your work on npm that would be great, as with the package.json i can download it through git repo, but as its not versioned i am forced to get the latest always

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.