如何在PHP中导出fusionchart

时间:2015-06-30 21:20:46

标签: php fusioncharts

我想将 fusionchart 导出到图片或pdf,我应该添加什么?不使用第三方

<?php

*//koneksi database*
include "config/koneksi.php";
error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED));
include "config/koneksi.php";
include("config/class/FusionCharts_Gen.php");
$pencarian=$_POST['pencarian'];
$bulan=$_POST['bulan'];
$barang_aset=$_POST['barang_aset'];


?>
<html>
  <head>
    <title>First Chart Using FusionCharts PHP Class</title>
    <script language='javascript' src='assets/js/FusionCharts.js'></script>
  </head>
  <body>

  <?php
  

#包括FusionCharts PHP类         #为Column 3D chart

创建对象
  $FC = new FusionCharts("column3d","900","450");

  # Setting Relative Path of chart swf file.
  $FC->setSwfPath("Charts/");

  # Store chart attributes in a variable
  $strParam="caption=Grafik Jumlah Inventaris dan Aset Berdasarkan Kategori";

  # Set chart attributes
  $FC->setChartParams($strParam);

  $kategori = mysql_query("SELECT id_kategori, nama_kategori FROM kategori");
  //$tracking = mysql_query("SELECT Nama_Karyawan FROM master_karyawan WHERE Kode_Nama_Cabang='SRJ' AND Category_Tracking='sales'");
while ($r_kat = mysql_fetch_array($kategori)){

    $id_kat = $r_kat['id_kategori'];
    $kat = $r_kat['nama_kategori'];

    $counter1 = 0;`enter code here`

**What do I need to add to add exportEnabled in this fusionchart**

             //$total = mysql_num_rows(mysql_query("SELECT IdKat,TglTerjual FROM penjualan_buku WHERE IdKat='$kat' AND LEFT(TglTerjual,4)='2012' AND  MID(TglTerjual,6,2)='02'"));

             $total = mysql_query("SELECT id_kategori, nama_barang FROM barang WHERE id_kategori='$id_kat' and nama_barang like '%$_POST[barang_aset]%'and MONTH(tanggal_status) like '%$_POST[bulan]%' and status like '%$_POST[pencarian]%' ");

             $counter1++;


    //$persentase = ($total!=0 || $review !=0)?($review / $total) *100:0;
    $total = mysql_num_rows($total);


  # add chart values and category names
  $FC->addChartData("$total","name=<a href='jmlaset.php?id=$id_kat'>$kat</a>");

}
    # Render Chart
    $FC->renderChart();
  ?>

  </body>
</html>

如何在此 fusionchart 中添加导出功能?

1 个答案:

答案 0 :(得分:0)

您的FusionCharts的php包装器类未使用最新的包装器类进行验证,请参阅link

您还可以通过将属性exportEnabled设置为1,通过FusionCharts导出服务器导出图表。这将使用他们的导出服务器,并将在您的最后下载图像。

如果您想创建自己的导出服务器,可以使用FusionCharts&#39;可分发的出口处理程序您可以从此link获取有用信息,但它使用两个第三方api ImageMagick和InkScape将SVG转换为所需的图像格式。您需要在最后安装此依赖项。