I have an issue while downloading charts drawn in dhtmlx. i have followed the post : [url]Download chart as JPEG or PDF - Suite 5.0 - DHTMLX and have done the exact same things suggested in the post, however i can see the chart without labels. I can only see color and lines. Please help.
Unfortunately, this is expected. Text labels is a separate layer, and you can’t export it with the above API
You can check the html2canvas project, it can be used to get a png file for any HTML document|widget
html2canvas.hertzen.com/
I tried that… my code is somewhat like this:
var canvas = Mychart.getCanvas().canvas;
var html2obj = html2canvas(canvas);
var queue = html2obj.parse();
var canvas1 = html2obj.render(queue);
var img = canvas1.toDataURL();
window.open(img);
but still i cannot see text. its just colours and lines, like in the attachement
Please, try t use html2canvas to your chart but not to a ready generated canvas of a chart.
Change line that gets an object to export, like next
var html2obj = html2canvas(Mychart.$view);
ok, I’ve tried doing that @Stanislav and now my code looks like this:
var html2obj = html2canvas(Mychart.$view);
var queue = html2obj.parse();
var canvas1 = html2obj.render(queue);
var img = canvas1.toDataURL();
window.open(img);
but it shows an error like this :
, which is coming in html2canvas function, part of code is as below:
window.html2canvas = function (elements, opts) {
elements = (elements.length) ? elements : [elements];
var queue,
What do i do now?
The following code exports the barchart correctly on the page:
html2canvas(myBarCHart.$view, {
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
and on the new page:
html2canvas(myBarCHart.$view, {
onrendered: function(canvas) {
var img = canvas.toDataURL();
window.open(img);
}
});