cyberdutch
cyberdutch

Reputation: 31

Chart.js animations ignoring global default configuration

https://gist.github.com/cyberdutch/1444c4b73b26e070643c765cda006143

The link above is the complete code that I use for my web page.

The chart pops up fine so far when the page is loaded. Now I'm trying to slow down the animation.

Adding the following code does not give any errors (it's already added to the example), but it doesn't do any slowing down either:

Chart.defaults.global.animation = {
    duration: 1000
};

How can I change the animation speed? It looks as if nothing changes, whatever number I use. Are the global defaults ignored or overwritten somewhere else?

Upvotes: 2

Views: 572

Answers (1)

cyberdutch
cyberdutch

Reputation: 31

Solved: The problem was in the definition of the canvas. Once I changed the following code:

<canvas id="myChart"></canvas>

into the more specific:

<canvas id="myChart" width="400" height="190"></canvas>

animation has been working without a flaw :-)

Upvotes: 1

Related Questions