Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive examples #1461

Closed
missingdays opened this issue Nov 8, 2015 · 2 comments
Closed

Interactive examples #1461

missingdays opened this issue Nov 8, 2015 · 2 comments

Comments

@missingdays
Copy link

When I'm trying to edit examples on c3js.org, they redraw after each letter I type. So is I type "chart.load({columns:[['data1', 10, 20, 30]]});" it will redraw chart like 30 times, though I don't want it to be redrawed after I typed "c", then "h" and so forth.
Can you please add timeout for redrawing examples? Like if user didn't type anything for 200 milliseconds, then redraw.
Thanks!

@aendra-rininsland
Copy link
Member

@missingdays Yeah, totally agree. We need to put the change handler into some sort of debouncing function, possibly something like:

function debounce(func, wait, immediate) {
    var timeout;
    return function() {
        var context = this, args = arguments;
        var later = function() {
            timeout = null;
            if (!immediate) func.apply(context, args);
        };
        var callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) func.apply(context, args);
    };
}

Source: https://davidwalsh.name/function-debounce

This is more relevant to masayuki0812/c3js.org though (the documentation repo), so closing and moving discussion there.

@missingdays
Copy link
Author

Agreed, didn't notice there is another repo for c3js.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants