dyncoder

Members
  • Content count

    4
  • Joined

  • Last visited

Everything posted by dyncoder

  1. Hello is there an example with php pdo non-deprecated commands. I found the following but it is written with deprecated coding. http://www.fusioncharts.com/dev/using-with-server-side-languages/php/creating-charts-with-data-from-a-database.html mysql_fetch_array — Fetch a result row as an associative array, a numeric ... This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Please let me know, thanks.
  2. Hello I wish to make this work for Angular Guage in Fusionwidget using PHP Wrapper and json format. Can someone please look at this code and tell me where I might mod it for 2d column too angular. I looked at some this dropbox (https://www.dropbox.com/sh/mtegxolyaivxy2d/AAA39PLz0HMGALxPAAZf8FHNa?dl=0) but still need some help. Thanks <html> <meta http-equiv="refresh" content="10" > <head> <title>FusionCharts XT - Column 2D Chart - Data from a database</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <!-- You need to include the following JS file to render the chart. When you make your own charts, make sure that the path to this JS file is correct. Else, you will get JavaScript errors. --> <script src="fusioncharts/js/fusioncharts.js"></script> </head> <body> <?php try { # MySQL with PDO_MYSQL $mysql_host = 'host'; $mysql_database = 'factordb'; $mysql_username = 'user'; $mysql_password = 'pass'; $conn = new PDO("mysql:host=$mysql_host; dbname=$mysql_database", $mysql_username, $mysql_password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->exec("SET CHARACTER SET utf8"); // Sets encoding UTF-8 } catch(PDOException $e) { echo $e->getMessage(); } // Form the SQL query that returns the top 10 most populous countries // Execute the query, or else return the error message. $stm = $conn->prepare("SELECT Factory, Result FROM mysqltable"); $stm->execute(); $results = $stm->fetchAll(PDO::FETCH_ASSOC); include("includes/fusioncharts.php"); $jsnarray = array(); foreach($results as $k => $v){ $jsnarray[] = array('label' => $results[$k]['Factory'], 'value' => $results[$k]['Result']); }; $jsonEncodedData=json_encode($jsnarray); //print_r($jsonEncodedData); new FusionCharts("type of chart", "unique chart id", "width of chart", "height of chart", "div id to render the chart", "type of data", "actual data"); $columnChart = new FusionCharts( "column2d", "ex1" , "600", "400", "chart-1", "json", '{ "chart": { "caption": "Customer Satisfaction Score", "lowerlimit": "0", "upperlimit": "100", "lowerlimitdisplay": "Bad", "upperlimitdisplay": "Good", "palette": "1", "numbersuffix": "%", "tickvaluedistance": "10", "showvalue": "0", "gaugeinnerradius": "0", "bgcolor": "FFFFFF", "pivotfillcolor": "333333", "pivotradius": "8", "pivotfillmix": "333333, 333333", "pivotfilltype": "radial", "pivotfillratio": "0,100", "showtickvalues": "1", "showborder": "0" }, "colorrange": { "color": [ { "minvalue": "0", "maxvalue": "45", "code": "e44a00" }, { "minvalue": "45", "maxvalue": "75", "code": "f8bd19" }, { "minvalue": "75", "maxvalue": "100", "code": "6baa01" } ] }, "dials": { "dial": [ { "value": "92", "rearextension": "15", "radius": "100", "bgcolor": "333333", "bordercolor": "333333", "basewidth": "8" }, "data": ' . $jsonEncodedData . '}'); // Render the chart //print_r($columnChart); $columnChart->render(); ?> <div id="chart-1"><!-- Fusion Charts will render here--></div> </body> </html>
  3. PHP PDO/MySQL non-deprecated example

    I did figure out how to get a 2dcolumn working. Please go here for details ==> http://stackoverflow.com/questions/34487605/php-pdo-convert-array-to-different-format#comment56718566_34487797 My suggestion I offer is to make the php wrapper use the native output from "json_encode" as it seems it needs to be modified in order to work. Thanks
  4. PHP PDO/MySQL non-deprecated example

    I wanted to add, I can get the following array results: Array ( [0] => Array ( [id] => 6 [Name] => John Smith [Pet] => Dog [Visits] => 5 [DateTime] => 11/26 22:24 ) ) using $results = $stm->fetchAll(PDO::FETCH_ASSOC); but unsure how to convert it into the following form for fusion charts: