Archive

Posts Tagged ‘sample’

Fusion Charts (PHP – FLASH)

August 29th, 2008 Jigish Thakar 3 comments

To show the graph/charts on the bases of some values can be done with Fusion Chart. Basically this charts are made using Adobe Flex Tool. Where we generate XLM string with predefined nodes as per the library. And then we just need to pass it to the function. And that will generate the flash based dynamic chart for you.

For all this we just need to include two files and in the end we need to pass XML string and the name of SWF file i.e. chart.

Sample code is as given below:

<html>

<head>

<SCRIPT LANGUAGE=”Javascript” SRC=”../javascript/FusionCharts.js”></SCRIPT>

</head>

<body>

<?php

include(”FusionCharts.php”);

$strXML = “<graph yAxisName=’Qunatity’ decimalPrecision=’0′ formatNumberScale=’1′>”;

$j == 0;

while($row = mysql_fetch_array($rs))

{

$j++;

$strXML .= “<set name=’”.$row['Comapny_Name'].”-”.$row['Pipe_Type'].”-”.$row['Pipe_Size'].”‘ value=’”.$row['Stock'].”‘ color=’”.$color[$j].”‘ />”;

}

$strXML .= “</graph>”;

echo renderChart(”FCF_Bar2D.swf”, “”, $strXML, “myNext”, 600, $num*30 , false, false);

?>

</body>

</html>

and the link to the web site is

http://www.fusioncharts.com/

HTML to PDF (using DOMPDF) – PHP

August 28th, 2008 Jigish Thakar 13 comments

After using the FPDF library, I came to know that making PDF using the same is so time consuming. And some time it is not possible to develop the report as per the users requirement because of its limitation. Then I found the DOMPDF library in which we just need to pass the HTML code as string to the its class and the PDF will be generated. Even thought it has some limitations but for some level this is the best way of generating PDF through PHP.

The link and the example for this is as given below:

http://www.digitaljunkies.ca/dompdf/

 

<?php

require_once("dompdf_config.inc.php");

$html =  '<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

?>

so guys take the advantage of such a nice efforts…

..