简体   繁体   English

如何将多个融合图导出到单独的图像文件

[英]How to Export multiple fusion charts to separate image files

On page I have several charts. 在页面上,我有几个图表。 They are build with Fusion Chart library. 它们是使用Fusion Chart库构建的。

There are three different charts.I need to export them all as separate PNG files. 有三种不同的图表,我需要将它们全部导出为单独的PNG文件。 So I add button, on click on which I need to have separate png-files.But the current code returns separate images but the same chart. 因此我添加了一个按钮,单击时需要有单独的png文件,但是当前代码返回的是单独的图像,但图表相同。 What can we do ? 我们能做些什么 ?

export method : 出口方式:

 function export_chart() {
        var format = document.getElementById("format").value;
        revenueChart0.exportChart({
            "exportFormat": format
        });
         revenueChart1.exportChart({
            "exportFormat": format
        });
         revenueChart2.exportChart({
            "exportFormat": format
        });
    }

Example: https://jsfiddle.net/73xgmacm/249/ 示例: https//jsfiddle.net/73xgmacm/249/

In order to export the chart in multiple files on one button click please use batchExport functionality to achieve this, here is a code snippet 为了通过一个按钮将图表导出为多个文件,请使用batchExport功能来实现这一点,这是一个代码片段

batchExportConfig1 = function() {
  FusionCharts.batchExport({
    "charts": [{
      "id": "chart-1",
    }],
    "exportFileName": "chart1",
    "exportFormat": "jpg"
  })
  FusionCharts.batchExport({
    "charts": [{
      "id": "chart-2",
    }],
    "exportFileName": "chart2",
    "exportFormat": "jpg"
  })
  FusionCharts.batchExport({
    "charts": [{
      "id": "chart-3",
    }],
    "exportFileName": "chart3",
    "exportFormat": "jpg"
  })
  FusionCharts.batchExport({
    "charts": [{
      "id": "chart-4",
    }],
    "exportFileName": "chart4",
    "exportFormat": "jpg"
  })
}

Here is a sample fiddle - http://jsfiddle.net/khjt8c7m/ 这是一个样本提琴-http: //jsfiddle.net/khjt8c7m/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM