angular-chart.js icon indicating copy to clipboard operation
angular-chart.js copied to clipboard

Updating labels without redrawing the whole chart

Open stibay opened this issue 8 years ago • 11 comments

I am currently testing this with a line chart. When im adding or updating data the chart updates dynamicly. But if I want to update the label series aswell by either adding and splicing or just updating the array the whole chart is beeing redrawn. Is it possible to fix this so you can avoid the "bouncing" effect every time the chart updates?

stibay avatar Dec 09 '15 10:12 stibay

No unfortunately Chart.js only supports update of the data, so when labels etc. change we have to delete and re-create the chart. If you want to remove the bouncing effect, you can disable animations.

jtblin avatar Dec 10 '15 03:12 jtblin

This worked perfect when I tested it the origianl chart.js though. Didn't thought the angular version would be slightly "worse" than jquery? :O

stibay avatar Dec 10 '15 07:12 stibay

I might be wrong but I'm pretty sure I tried and it didn't work hence it is like this today. If it isn't the case feel free to submit a PR instead of trolling.

On Thu, Dec 10, 2015 at 6:53 PM, stibay [email protected] wrote:

This worked perfect when I tested it the origianl chart.js though. Didn't thought the angular version would be slightly "worse" than jquery? :O

— Reply to this email directly or view it on GitHub https://github.com/jtblin/angular-chart.js/issues/266#issuecomment-163527101 .

jtblin avatar Dec 10 '15 07:12 jtblin

Don't get what you mean by trolling? Created this plunkr to try to illustrate the issue. http://plnkr.co/edit/jmPNTqlK2N0B6MmUDDMO?p=preview

stibay avatar Dec 10 '15 10:12 stibay

Didn't thought the angular version would be slightly "worse" than jquery? :O

Snarky comments == trolling to me. Bu maybe you don't even realise...

Moreover as I said before, just updating the labels is not possible in Chart.js as per https://github.com/nnnick/Chart.js/issues/593. Maybe it will be possible in 2.0 but it's unsure yet. So you really don't know what you're talking about.

It's this kind of comments and attitude that makes open source depressing sometimes.

jtblin avatar Dec 10 '15 20:12 jtblin

Was definetly not ment as beeing snarky/trolling and I apologize if you took it offensive. I was more sure I was doing something wrong since everything else with updating and viewing the chart worked a lot better than the Jquery version. Even showed it off to a couple of colleagues and friends ;)

This is not even that big of an issue since our chart will not update very frequently so you will rarely notice this at all, but me beeing a perfectionist I probably responded abit too quick and I just translated from "spoken Norwegian" to English which wasn't offensive ment. I see now how it could be percieved as abit offensive and I sincerely apologizefor that.

Keep up the awesome work ;)

stibay avatar Dec 11 '15 07:12 stibay

Ok no worries. English isn't my first language either so there's that as well. As I said originally, you can disable the bouncing effect by setting the animation option to false.

Cheers :)

jtblin avatar Dec 11 '15 09:12 jtblin

excuse, I have the same problem, except set animate: {duration: 0}, can it be updated but not seems to redraw the whole chart resolve in angular-chart? I see sample in chart.js can do that, what cause the result different? seems angular-chart base on chart.js...Ummmm

imdoge avatar Aug 16 '16 07:08 imdoge

All chart.js options can be set via angular-chart. See this example to disable animation.

animation: {
  duration: 0
},

jtblin avatar Aug 16 '16 11:08 jtblin

@jtblin it looks like 2.x of chart.js now allows changing labels on the fly, am I reading the last comment on https://github.com/chartjs/Chart.js/issues/593 right?

mlubavin avatar Dec 12 '16 17:12 mlubavin

Are there any updates on this topic? Is it now possible with 2.x?

Iqwertz avatar Apr 29 '20 22:04 Iqwertz