question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chart not rendering animation completely

See original GitHub issue

Expected Behavior

Animation rendering should reach 100%.

Progress measured as progress = Math.floor(animation.animationObject.currentStep * 100 / animation.animationObject.numSteps)

Current Behavior

Animation is not rendered completely and stops at 3%.

Possible Solution

-

Steps to Reproduce (for bugs)

Angular Example

Animation rendering stops at 3%

The component <app-chart> is rendered only after the Chart One tab is selected - you can verify this by checking the logs for ngAfterViewInit event. So, the animation is not happening in the background as soon as the page opens (when on Home tab). Therefore, this is not the reason why the animation is not being seen/rendered. The issue is beyond this.

The chart is rendered and animation starts only after user clicks on the Chart One tab. You can verify this by checking the console logs. Yet, the animation stops at 3% and the user doesn’t see the animation.

Moreover, I’ve set the animation duration as 5000 (for testing), yet it doesn’t animate for even for 1 second. Same behavior even if I don’t set the animation duration to anything (defaults).

I feel there’s something that’s interrupting the animation and abruptly rendering the chart.

Update:

If I render the chart using a setTimeout of 500ms, the animation loads correctly. You can see this behavior in the Chart Two tab. However, I want to avoid this since it leads to a slightly bad user experience.

Context

I am trying to render a chart only after the user clicks on a Bootstrap navigation tab so that the user can see the animation of the chart in that tab.

Environment

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stockiNailcommented, Nov 8, 2019

@abhilash1in If I may add another info on issue, adding the following config into animation object:

          onComplete: function(animation) {
            console.log("complete!");
          }, 

The strange thing is Chart.js invokes the onComplete callback when the progress is at 3% therefore for Chart.js the rendering is completed

0reactions
kurklecommented, Jan 9, 2020

onComplete fires for each chart individually after #6845, fixing the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chart not rendered completely when using JSPDF
I am trying to print charts (JSChart) in a pdf using jsPDF. It seems like the chart image is created while the chart...
Read more >
Chart loading animation stops while chart is rendered - Telerik
Hello in my charts i show up the loading animation via kendo.ui.progress($("#chart"), true); which works fine.
Read more >
How to Re render with animation | CanvasJS Charts
To render the chart each time with animation, you will need to create a new chart with updated options based on the value...
Read more >
API | Chart.js
Use this to stop any current animation. This will pause the chart during any current animation frame. Call .render() to re-animate. ... Copied!...
Read more >
Server Side Rendering - Cross Platform - Apache ECharts
Reducing the FCP time and ensuring the chart is displayed immediately. Embedding charts in the environments such as Markdown, PDF that do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found