Topic: Can i disallow MDB Chart delay at beginning ?

Bambou free asked 6 years ago


Hello everybody, I'm currently using MDB Line Chart and it's working fine, the thing is I want to export that chart to PDF.

In order to do that I converted it to image before exporting. I'm using Barryvdh/dompdf to convert a HTML page to PDF. The issue is that when I load my HTML page, MDB Line Chart is loading 1s before showing up, so when I try to convert it directly I have a blank image.

I'm doing this :

var canvas = $('#myChart');
var dataURL = canvas.get(0).toDataURL();
var img = $("<img style='width:100%;height:auto;'></img>");
img.attr("src", dataURL);
canvas.replaceWith(img);

But if I add a setTimeout, the Line Chart is showing as an image but the chart does not have time to become an image and it's blank in the PDF.How can I do to load the Chart at the beginning ?

Thanks in advance !


Jakub Strebeyko staff answered 6 years ago


Hi there Bambou, Welcome to the Support Board! Glad to have you around. So, the short answer is yes, and the long one is: can you see the options object being passed in the docs? It can also regard animation. You can either have it with duration: 0, like so:
options: {
    animation: {
        duration: 0
    }
}
or disable it entirely, using:
options: {
    animation: false
}
Hope it helps! With Best Regards, Kuba

Bambou free commented 6 years ago

Thanks a lot ! I still have another issue but you responded to my question !


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags