Home forums Using CanvasJS Problem disabling all data series

This topic contains 2 replies, has 2 voices, and was last updated by  blacktek 1 month, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19800

    blacktek
    Member

    Hello,
    I’ve written a simple function to hide all data series on a graph (after a click on a link); this is what it does:

    for(var key in chart.options.data) {
    if (chart.options.data[key].visible)
    chart.options.data[key].visible = false;
    }

    the problem is that it’s very very slow and I don’t understand why (it take 5-6 seconds, much more then disabling the single lines individually by clicking on them). Moreover very often I get this error after hiding the lines:

    Uncaught TypeError: Cannot set property ‘dataSeries’ of null
    at Y._updateToolTip (jquery.canvasjs.min.js:807)
    at Y.mouseMoveHandler (jquery.canvasjs.min.js:801)
    at q._plotAreaMouseMove (jquery.canvasjs.min.js:249)
    at q._mouseEventHandler (jquery.canvasjs.min.js:239)
    at HTMLCanvasElement.<anonymous> (jquery.canvasjs.min.js:114)
    Y._updateToolTip @ jquery.canvasjs.min.js:807
    Y.mouseMoveHandler @ jquery.canvasjs.min.js:801
    q._plotAreaMouseMove @ jquery.canvasjs.min.js:249
    q._mouseEventHandler @ jquery.canvasjs.min.js:239
    (anonymous) @ jquery.canvasjs.min.js:114

    Please note that I’ve a function adding every few seconds new points to the dataseries using jquery and then calling the render method chart.render();

    Any idea?

    tnx!

    #19807

    Indranil Deo
    Member

    @blacktek,

    Can you please create a jsfiddle reproducing the issue so that we can look into the code and help you out.

    ___________
    Indranil Deo,
    Team CanvasJS

    #19813

    blacktek
    Member

    @Deo,
    it’s not that easy because this is a big project with tens of lines to plot, external jquery scripts and so on; if possible I could try to provide more data if you request. Eg this morning I’ve made other 2 tests and they don’t give errors, but in any case were very slow, more then 22 seconds.
    Doing a profiling i see that 21.5 seconds on 22.5 the script was idle; disabling the jquery calls doesn’t change this behaviour.
    On of the test during profiling never completed, remained idle fot 80 seconds without disabling lines

    I’ll try to create a jsfiddle, but perhaps will not be that easy.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.