![]() ![]() ![]() Introduction HanengCharts is Java applets that you use with your website by supplying the parameters (the values and labels) through HTML PARAM tags. This allows any technology that can generate HTML to work dynamically with HanengCharts. This whitepaper will give you some sample scripts and explanations on how you can use HanengCharts and PHP to generate charts based on data stored in a database. ![]() ![]() ![]() PHP and MySQL <HTML> <BODY> <CENTER> <APPLET CODE="HanengCharts.class" ARCHIVE="HanengCharts3.jar" WIDTH=460 HEIGHT=260> <PARAM NAME="LicenseKey" VALUE="DEMO-DTKTG2s3R8xNVzNVFxN"> <PARAM NAME="ChartType" VALUE="pie"> <?php $conn = mysql_Connect("localhost", "msqluser", "mysqlpass"); if($conn) { $SQL_string="select * from Chart"; $resultset = mysql_db_query("HanengCharts", $SQL_string, $conn); if($resultset) { while($th_row=mysql_fetch_array($resultset)) { echo "<PARAM NAME=\"".$th_row["ParameterName"]."\" VALUE=\"".$th_row["Value"]."\">\n"; } } } ?> </APPLET> </CENTER> </BODY> </HTML> This assumes that you want to use a MySQL database (It should be easy to change it to work with another database) and it assumes that the database is on the localhost(not really necessary) and that the username/password to access the database is mysqluser/mysqlpass. It further assumes that the data is stored in the database "HanengCharts" in the table "Chart" and that "Chart" has the fields "ParameterName" and "Value":
The result will look like this: |