Это альтернативное решение, использующее печать напрямую. Он основан на функции chart.print(), но он работает с несколькими диаграммами.
Смотрите демо здесь: http://jsfiddle.net/jim31415/q5Rzu/150/
//--------------------------------------------------------------------
$("#print").click(function() {
printCharts([chart1, chart2, chart3]);
});
//--------------------------------------------------------------------
function printCharts(charts) {
var origDisplay = [],
origParent = [],
body = document.body,
childNodes = body.childNodes;
// hide all body content
Highcharts.each(childNodes, function (node, i) {
if (node.nodeType === 1) {
origDisplay[i] = node.style.display;
node.style.display = "none";
}
});
// put the charts back in
$.each(charts, function (i, chart) {
origParent[i] = chart.container.parentNode;
body.appendChild(chart.container);
});
// print
window.print();
// allow the browser to prepare before reverting
setTimeout(function() {
// put the charts back in
$.each(charts, function (i, chart) {
origParent[i].appendChild(chart.container);
});
// restore all body content
Highcharts.each(childNodes, function (node, i) {
if (node.nodeType === 1) {
node.style.display = origDisplay[i];
}
});
}, 500);
}
});
Я загляну в него, но он хорошо выглядит из того, что я вижу в jsFiddle! –
Highcharts удалили файлы, вы можете использовать их вместо первой ссылки лучше http://jsfiddle.net/q5Rzu/147/ – fcortes
Можете ли вы мне помочь? Я хочу напечатать 5 диаграмм за раз. Но я хочу дать титру в верхней части первой страницы. Как это сделать ? –