Open jrr opened 8 years ago
same issue on my end with the //www.gstatic.com/charts/loader.js
Same issue to me. Is there any solution for this?
Same problem here... :(
Same issue. Any progress or ideas about why this is happening?
any news?
Same problem :-/
wkhtmltopdf 0.12.4, same issue. (Can't use 0.13.x because there aren't any statically linked libs yet.)
I made a small debugging of this problem and seems callback drawChart is not executed. The same is when open the page on the QtWeb browser which are used by wkhtmltopdf. Possible this problem is because the QtWeb doesn't support Local Storage.
Have the same problem :(
I found a workarround: replace the callback to setTimeout call function, like this: //google.charts.setOnLoadCallback(drawChart);// commented line
//setTimeout to call the drawChart() setTimeout(function(){ drawChart(); }, 500);
@michaelmafort solution help me! Run in Symfony 3.4 with wkhtmltopdf 0.12.4.
Same thing here:
google.charts.load("current", {packages:["corechart", "timeline", "bar"]}); google.charts.setOnLoadCallback(drawCharts);
For some reason drawCharts
is never launched by the QT engine, while it is when using a standard Javascript timer (verified both with wkhtmltopdf and QTWeb).
Is there any reason why these google function is not recognized by QT?
Could google.load
be used instead of google.charts.load
?
Wow that was goofy; no clue on the inner workings, but this worked me based on the types of charts I'm drawing:
/**
* init
*
* @access public
* @return void
*/
function init() {
google.charts.load('current', {'packages': ['corechart', 'calendar']});
var interval = setInterval(function() {
if (
google.visualization !== undefined
&& google.visualization.DataTable !== undefined
&& google.visualization.PieChart !== undefined
&& google.visualization.BarChart !== undefined
) {
clearInterval(interval);
for (var index in queue) {
queue[index]();
}
window.status = 'ready';
}
}, 100);
}
Where the variable queue
is an array of the functions I want to execute once everything is ready :)
Any progress on this? This is incredibly annoying.
I haven't used wkhtmltopdf in ages, so I'm unsubscribing from this thread. I'll leave it open so others may use it.
Next time I need to generate PDFs, I plan to first try headless chrome.
Yea, spent the past week getting a new Node docker container added to our stack with headless Chrome, express, and puppetter. The end result of PDF's is far better than wkhtmltopdf. Unfortunately it adds another server to our stack.
Google Charts are not good at all. I've serval issues with google charts. I'm using D3 library https://d3js.org v5.9.2.
Everything is ok.
You can find examples how to do it. I used that example https://wizardace.com/d3-piechart/
So I think the magic sauce is replacing current
with version 44
.
ie: google.charts.load('44', {'packages':['corechart']});
45
doesn't appear to work, so anything later is likely broken too. Stick to 44
and you should be good.
So I think the magic sauce is replacing
current
with version44
.ie:
google.charts.load('44', {'packages':['corechart']});
45
doesn't appear to work, so anything later is likely broken too. Stick to44
and you should be good.
thanks @akaspick its worked when i replace the current with '44'
this is my code
function init() {
google.charts.load('44', {
packages: ['corechart', 'line']
});
var interval = setInterval(function() {
console.log('not-ready-yet');
if (
google.visualization !== undefined
&& google.visualization.DataTable !== undefined
&& google.visualization.PieChart !== undefined
){
clearInterval(interval);
console.log('ready');
window.status = 'ready';
drawChart();
}
}, 100);
}
based on this solution https://stackoverflow.com/a/63190035 by using --window-status ready
tested using wkhtmltopdf 0.12.6 (with patched qt)
wkthmltopdf seems to hang forever when loading Google Charts via the currently recommended loader.js method.
It works just fine with the old "jsapi" interface.
Simple testcases below, based on Google's Quick Start
Output:
(hangs indefinitely)
related: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1964
old.html:
new.html: