Alfie

Members
  • Content count

    1
  • Joined

  • Last visited

About Alfie

  • Rank
    Forum Newbie
  1. Hi all FusionCharts folks, I'm trying to populate GANTT chart by database (PHP+MySQL). I was able to implement my own script based on the general method based on the conceptual sequence: 1) Execute queries on database 2) If results is not empty... 3)...proceed with "array_push" to concatenate data to be displayed by the chart. The code below implements the above sequence: // Execute the query, or else return the error message. $result_CATEGORIES = mysqli_query($dbhandle, $strQuery_CATEGORIES); //prepare categories $arrData["categories"] = array(); $category = array(); // Push the data into the category array while($row = mysqli_fetch_array($result_CATEGORIES)) { array_push($category, array("label"=>$row["abbr_mese"], "start"=>$row["frm_inizio_mese"], "end"=>$row["frm_fine_mese"])); } echo "<pre>"; echo "ARRAY CATEGORIES CONTENTS"."<p>"; echo print_r ($category); echo "</pre>"; array_push($arrData["categories"], array("category"=>$category)); After repeated excecution of the above code for all the data-section required by the GANTT chart the final assembled JSONencoded string is the following: {"chart":{"renderAt:":"chart-1","dateformat":"mm\/dd\/yyyy","caption":"Commesse Associate al Collaboratore","subCaption":"Assistenza al Planning","theme":"fusion"},"categories":[{"category":[{"label":"GEN","start":"01\/01\/2019","end":"01\/31\/2019"},{"label":"FEB","start":"02\/01\/2019","end":"02\/28\/2019"},{"label":"MAR","start":"03\/01\/2019","end":"03\/31\/2019"},{"label":"APR","start":"04\/01\/2019","end":"04\/30\/2019"},{"label":"MAG","start":"05\/01\/2019","end":"05\/31\/2019"},{"label":"GIU","start":"06\/01\/2019","end":"06\/30\/2019"},{"label":"LUG","start":"07\/01\/2019","end":"07\/31\/2019"},{"label":"AGO","start":"08\/01\/2019","end":"08\/31\/2019"},{"label":"SET","start":"09\/01\/2019","end":"09\/30\/2019"},{"label":"OTT","start":"10\/01\/2019","end":"10\/31\/2019"},{"label":"NOV","start":"11\/01\/2019","end":"11\/30\/2019"},{"label":"DIC","start":"12\/01\/2019","end":"12\/31\/2019"}]}],"processes":[{"process":[{"headerText":"SIL"},{"headerText":"BIOM"},{"headerText":"BIOM"}]}],"tasks":[{"task":[{"start":"01\/15\/2019","end":"01\/28\/2019"},{"start":"02\/07\/2019","end":"03\/21\/2019"},{"start":"02\/20\/2019","end":"05\/11\/2019"}]}]} I checked against it and it is (at least as per its syntax) perfectly valid JSON Here it is the same JSON string nicely formatted: { "chart": { "renderAt:": "chart-1", "dateformat": "mm\/dd\/yyyy", "caption": "Commesse Associate al Collaboratore", "subCaption": "Assistenza al Planning", "theme": "fusion" }, "categories": [{ "category": [{ "label": "GEN", "start": "01\/01\/2019", "end": "01\/31\/2019" }, { "label": "FEB", "start": "02\/01\/2019", "end": "02\/28\/2019" }, { "label": "MAR", "start": "03\/01\/2019", "end": "03\/31\/2019" }, { "label": "APR", "start": "04\/01\/2019", "end": "04\/30\/2019" }, { "label": "MAG", "start": "05\/01\/2019", "end": "05\/31\/2019" }, { "label": "GIU", "start": "06\/01\/2019", "end": "06\/30\/2019" }, { "label": "LUG", "start": "07\/01\/2019", "end": "07\/31\/2019" }, { "label": "AGO", "start": "08\/01\/2019", "end": "08\/31\/2019" }, { "label": "SET", "start": "09\/01\/2019", "end": "09\/30\/2019" }, { "label": "OTT", "start": "10\/01\/2019", "end": "10\/31\/2019" }, { "label": "NOV", "start": "11\/01\/2019", "end": "11\/30\/2019" }, { "label": "DIC", "start": "12\/01\/2019", "end": "12\/31\/2019" }] }], "processes": [{ "process": [{ "headerText": "SIL" }, { "headerText": "BIOM" }, { "headerText": "BIOM" }] }], "tasks": [{ "task": [{ "start": "01\/15\/2019", "end": "01\/28\/2019" }, { "start": "02\/07\/2019", "end": "03\/21\/2019" }, { "start": "02\/20\/2019", "end": "05\/11\/2019" }] }] } Nonetheless, fed by the above JSON encoded string, the rendering of the chart keeps returning the message "No Data To Display". I did my investigations and discovered that stripping away from the JSONencoded string the first "[" and the last "]" from the sections "processes" and "tasks" the chart renders as a breeze with proper data and labels in place. It looks like the chart doesn't want these sections (which of course follows the main one "categories") marked as an array. May be the problem is not in the terms I have just stated but I'm looking for a solution. Thank you in advance, I greatly appreciate FC, any help is more than wellcome!