amit.agnihotri

Members
  • Content count

    2
  • Joined

  • Last visited

About amit.agnihotri

  • Rank
    Forum Newbie
  1. 2D Column stack - limited to 7

    how do i edit the above question? The problem was to do with the a bit of coding. It finally worked!!!
  2. 2D Column stack - limited to 7

    Hello there, I'm using MySQL/PHP with PHPWrapper to make use of the FusionCharts. I've been able to get the data to get it rendered as 2D column stacks but are stuck at 7 despite having any limits attached to it. I'm using it to display the count of records for each month starting Apr, till Nov but the first stack starts from May when I Group the data by month in ASC. The interesting bit is that when i change this to DESC, i see the data from OCt- Apr (7 records) and the Nov data goes missing. I have not kept any limits defined that may be stopping this but yet i can get this to work. My data set type in MySQL are; acqid - INT acq_month - DATE fusioncharts.php & its associated JS are properly called upon in the file. Can anyone help? Thanks!!! Following is the code that I'm using; <?php // Form the SQL query that returns the top 10 most populous countries $strQuery = "SELECT count(acqid), acq_month FROM newacq GROUP BY MONTH(acq_month) ASC limit 13"; // Execute the query, or else return the error message. $result = $conn->query($strQuery) or exit("Error code ({$conn->errno}): {$conn->error}"); $arr=mysqli_fetch_array($result); //while($arr=mysqli_fetch_array($result)) { // print_r($arr); //} // 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" => "New Acq", "showValues" => "1", "theme" => "zune" ) ); $arrData["data"] = array(); // Push the data into the array while($row = mysqli_fetch_array($result)) { array_push($arrData["data"], array( "label" => date("M-Y", strtotime($row["acq_month"])), "value" => $row["count(acqid)"], ) ); } /*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" , 820, 300, "chart-1", "json", $jsonEncodedData); // Render the chart $columnChart->render(); // Close the database connection $conn->close(); } ?> <div id="chart-1"><!-- Fusion Charts will render here--></div> With ASC this is how it appears; And with DESC this is how it appears; EDIT - When i tried fetching the details carried out in the ARRAY using [print_r], I got the following message; Array ( [0] => 208 [count(acqid)] => 208 [1] => 2017-04-01 [acq_month] => 2017-04-01 ) Array ( [0] => 241 [count(acqid)] => 241 [1] => 2017-05-01 [acq_month] => 2017-05-01 ) Array ( [0] => 243 [count(acqid)] => 243 [1] => 2017-06-01 [acq_month] => 2017-06-01 ) Array ( [0] => 269 [count(acqid)] => 269 [1] => 2017-07-01 [acq_month] => 2017-07-01 ) Array ( [0] => 373 [count(acqid)] => 373 [1] => 2017-08-01 [acq_month] => 2017-08-01 ) Array ( [0] => 370 [count(acqid)] => 370 [1] => 2017-09-01 [acq_month] => 2017-09-01 ) Array ( [0] => 283 [count(acqid)] => 283 [1] => 2017-10-01 [acq_month] => 2017-10-01 ) Array ( [0] => 312 [count(acqid)] => 312 [1] => 2017-11-01 [acq_month] => 2017-11-01 ) It does show the information carried out for April & Nov including. If it helps!