• Content count

  • Joined

  • Last visited

About mornayb

  • Rank
    Forum Newbie
  1. Prerana, Can I give you a huge high-five!!!!! It works perfectly. Thank you so much for your help and quick reply. Thanks!!
  2. Good day, I am trying to create a heat map / color range based on time values ie. Seconds. I have used the following code sample with great success to display the data but I am struggling to implement the color range within the associative array if values between a certain range. example: if seconds between 0 and 60 then red, if seconds between 60 and 100 then yellow, if seconds between 100 and 120 then green else normal color (bar chart) Can someone please be so kind as to point me in the right direction on how to achieve this with the below code? Code // Form the SQL query that returns the top 10 most populous countries $strQuery = "SELECT Name, Population FROM Country ORDER BY Population DESC LIMIT 10"; // Execute the query, or else return the error message. $result = $dbhandle->query($strQuery) or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); // If the query returns a valid response, prepare the JSON string if ($result) { // The `$arrData` array holds the chart attributes and data $arrData = array( "chart" => array( "caption" => "Top 10 Most Populous Countries", "showValues" => "0", "theme" => "zune" ) ); $arrData["data"] = array(); // Push the data into the array while($row = mysqli_fetch_array($result)) { array_push($arrData["data"], array( "label" => $row["Name"], "value" => $row["Population"] ) ); } /*JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */ $jsonEncodedData = json_encode($arrData); /*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("column2D", "myFirstChart" , 600, 300, "chart-1", "json", $jsonEncodedData); // Render the chart $columnChart->render(); // Close the database connection $dbhandle->close(); } Thank you in advance...