2017-04-24 13 views
1

印刷可能なレポートにエクスポートしたい約100のグラフがあります。それはInternet Explorerで100のチャートを持つのが遅いです。このための回避策はありますか?ハイチャートをレポート用の画像に置き換えますか?

+0

は、それだけで100のチャートやテキストで100枚のチャートですか?各グラフを単一のイメージとしてエクスポートする場合は、独自のエクスポートサーバー(https://github.com/highcharts/node-export-server)を実行する場合はバッチエクスポートを使用できます。テキストとインターリーブしたい場合は、すべてのアイテムを含むページを生成してブラウザ内からPDFに書き出すことができます(ここではIEは遅くなりますが、各チャートのデータ量によってブラウザが遅くなる可能性があります)。 – wergeld

答えて

0

ブラウザで実際にレンダリングすることなく、すべてのチャートをエクスポートするために、エクスポート要求をサーバーに送信できます。

const options = { 
    chart: {}, 
    xAxis: { 
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
     'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' 
    ] 
    }, 
    series: [{ 
    data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], 
    type: 'column' 
    }] 
} 
const data = { 
    options: JSON.stringify(options), 
    filename: 'test.png', 
    type: 'image/png', 
    async: true 
} 
const exportUrl = 'https://export.highcharts.com/' 
$.post(exportUrl, data, function(data) { 
    const imageUrl = exportUrl + data 
    const urlCreator = window.URL || window.webkitURL 
    document.querySelector("#image").src = imageUrl 
}) 

// You can uncomment in order to render chart 
// const chart = Highcharts.chart('container', options) 

ライブ例: https://jsfiddle.net/28098mfj/

関連する問題