Coder Social home page Coder Social logo

Comments (8)

ngyewch avatar ngyewch commented on June 15, 2024

Hmm, that's strange. The last part of the demo tests angular-rickshaw against changes in series data, is it similar to what you're doing?

Maybe if you have a code snippet?

from angular-rickshaw.

panuhorsmalahti avatar panuhorsmalahti commented on June 15, 2024

I've created a wrapper directive on top of angular-rickshaw. I'm refreshing the data by reconstructing the rickshaw-series object (although the only truly changing values are in the .data arrays.

My template is simply

rickshaw(rickshaw-options="options", rickshaw-series="series", rickshaw-features="features")

And I'm updating the series with

scope.series = newSeriesObject();

It's not a basic scope.$apply issue, as the apply does nothing (and is not necessary according to my debugging).

from angular-rickshaw.

ngyewch avatar ngyewch commented on June 15, 2024

Could you try it without your wrapper directive? The problem may be caused by your wrapper.
The way the directive detects changes in the data did change from 0.5.0 to 0.6.0.

By default, it only watches for changes in the first series.

from angular-rickshaw.

panuhorsmalahti avatar panuhorsmalahti commented on June 15, 2024

I'm now fairly certain the bug is caused by this:
https://github.com/ngyewch/angular-rickshaw/blob/master/rickshaw.js#L139

The watchers are created to watch particular arrays when the directive is created. However, when the arrays are re-created or changed, the watchers are not updated. Therefore, they will continue to watch the old arrays which never change.

I implemented a workaround in my directive which reuses the same arrays which solves the issue.

One fix would be to revert the 'efficient' watcher change. I don't think it's majorly more efficient as the series objects are not that much larger than the data arrays.

from angular-rickshaw.

panuhorsmalahti avatar panuhorsmalahti commented on June 15, 2024

Another solution would be to create a "updateWatchers" type of function, which would recreate the watchers according to the new series object.

from angular-rickshaw.

ngyewch avatar ngyewch commented on June 15, 2024

Yeah, I think I'll revert it back to watch the entire object rather than just the series array.

from angular-rickshaw.

ngyewch avatar ngyewch commented on June 15, 2024

I've released 0.10.0 to address this issue. Hope this works for you.

from angular-rickshaw.

panuhorsmalahti avatar panuhorsmalahti commented on June 15, 2024

Thanks, 0.10.0 fixed the issue! 👍

from angular-rickshaw.

Related Issues (20)

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.