• Content count

  • Joined

  • Last visited

About ndaumalle

  • Rank
    Forum Newbie
  1. Hello, We are currently using FusionCharts in our php web application, it works well and we really like it. But we need to save the charts as images as they are rendered in the page to later on create a pdf with these images. We are using the php-wrapper to render the charts and i am trying to use the php-export-handler lib provided with the fusioncharts package. I use this script to export a chart to image: <script type="text/javascript"> function ExportMyChart() { var chartObject = FusionCharts('chartResumenCompletoID'); if( chartObject.hasRendered() ) chartObject.exportChart(); } </script> My PHP code is as: $arrDataResumenCompleto = array( "chart" => array( "caption" => "", "theme" => "fint", "paletteColors" => "#989830", "yAxisName" => "Porcentaje Logro (%)", "xAxisName" => "", "yAxisMaxValue" => "100", "yAxisMinValue" => "0", "plotSpacePercent" => "40", "numberSuffix" => "%", "labelDisplay" => "auto", "useEllipsesWhenOverflow" => "0", "xAxisNameFontSize" => "13", "yAxisNameFontSize" => "13", "exportEnabled" => "1", "exportAtClient" => "0", "exportHandler" => WP_PLUGIN_URL . '/wp-aprendo/lib/fusioncharts/export-handlers/php-export-handler/FCExporter.php', "exportAction" => "save", "exportShowMenuItem"=>'0', "exportFormat" => "png", "animation" => "0" ), "data" => array() ); /** *More code to fill the data array with values. */ <div class="apChart" id="<?php echo "chartResumenCompleto"; ?>"></div> <input type="button" value="Export My Chart" onclick="ExportMyChart()" /> /* JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */ $jsonEncodedData = json_encode($arrDataResumenCompleto); /* Create an object for the column chart using the FusionCharts PHP class constructor. Syntax for the constructor is ` FusionCharts("type of chart", "unique chart id", width of the chart, height of the chart, "div id to render the chart", "data format", "data source")`. Because we are using JSON data to render the chart, the data format will be `json`. The variable `$jsonEncodeData` holds all the JSON data for the chart, and will be passed as the value for the data source parameter of the constructor. */ $columnChart = new FusionCharts("bar2d", "chartResumenCompletoID", "100%", "300", "chartResumenCompleto", "json", $jsonEncodedData); // Render the chart $columnChart->render(); The chart is well rendered. My first problem, when i click on the button to export, is that I see in firebug the following message: &DOMId=&height=0&width=0&fileName=&statusMessage= Export Resource not found.&statusCode=0 After digging in the code of FCExporter.php, we see that $exporterResource = "FCExporter_IMAGE-DATA2PNG.php". We don't know why. After hardcoding in FCExporter.php $exporterResource = "FCExporter_RLE2IMG.php" for purposes of testing. It saves an image in server with only light blue background. Can you please help us with this? It is really urgent... Greetings, Nicolas Daumalle.