Search the Community
Showing results for tags 'PhP'.
Found 36 results
-
Hi I do not know if this is the right part of the forum but i hope someone can help me out. I have a website that uses Fusionchart Free V2 and as the EOL of flash is coming up i am wondering if it is possible to change the charts from using flash to JS? currently all charts are using .swf files and i do not know how to switch it over to JS If that is even possible. Here is a pastebin of the code from my php that's file using fusioncharts. Pastebin: https://pastebin.com/469BpG3G
- 1 reply
-
- fusioncharts
- flash
-
(and 1 more)
Tagged with:
-
Hi there I've been diving into forum and docs, but I think I'm going in the wrong direction. I'm trying to show a multi-series line chart. Only 3 data in the query: date, device and data. The format in query is like that: devicename (string) | date (datetime)| data (float) What I want is to show a line for every device and see data along the time. I've seen several examples with xml, but none with json. Could anyone show me an example of something similar? I know there must be lots of them, but I cannot find even one. My main problem is arrange the json. I have no experience with it but I think I coud use an example as a guide. Thanks for all!
-
Hello, I have a file named menu.php and when I include it inside body tag before the chart include my chart gets weird.
- 6 replies
-
- include
- fusionchart
-
(and 1 more)
Tagged with:
-
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!
-
Hello everyone, I'm developing an APP that makes graphics based in data from MySQL, my problem is that when I bring the data at 100% zoom in chrome, in line charts the plottooltext is not showing, when zoom out, the plottooltext works 1st image, 100% zoom 2nd image, 50% zoom both in Google Chrome any hopes on this to work?
-
- chrome
- fusioncharts
-
(and 3 more)
Tagged with:
-
Hi I’m relatively new to Fusion Charts but have been enjoying trying things out with the PHP wrapper. I want to pull data from a local MySQL database using a suitable query and display it in a line plot. As a first attempt I followed the first example on this Fusion Charts page, changed the variables to those in my database, updated the sql query, swapped the bar chart to a line plot and hey presto, everything works! The trouble is, the sql query is hard coded in the PHP. I’m ideally looking to have a web page which has options (drop down menus etc) for the user to select what is plotted based on fields within the MySQL database. The example given showed populations in various countries but the options would allow the user to choose either that or perhaps average number of days people are at work in each country. The other fields would be present in the MySQL database and the user selectable fields would be used to update the query before re-plotting the Fusion Chart. Essentially I just wanted to be able to generate the MySQL query based on user selections before the plot is drawn. I’m not looking for a complete solution here just some guidance on how to go about this. Any help greatly appreciated!
-
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!
-
Hi, I need some help with the data within a linked chart, I'm trying to use a while loop to populate the data within the linked chart, I thought I had it figured out but it doesn't seem to work, any help would be appreciated. Here's the code I have for the while loop. array_push($arrData["linkeddata"], array( "id" => "2016", "linkedchart" => array( "chart" => array( "caption" => "Yearly spend", "xAxisName" => "Year", "yAxisName" => "Spend (In GBP)", "formatNumber" => "1", "yFormatNumber" => "1", "formatNumberScale" => "0", "decimalSeparator" => ".", "thousandSeparator" => ",", "numberPrefix" => "£", "rotateValues" => "0", "placeValuesInside" => "0", "rotateValues" => "1", "decimals" => "2", "valueFont" => "Arial", "valueFontColor" => "#000", "valueFontSize" => "12", "valueFontBold" => "0", "valueFontItalic" => "0", "theme" => "fint"), "data" => array( while ($Spend = $SpendData->fetch(PDO::FETCH_ASSOC)) { array( "label" => $Spend['Year'], "value" => $Spend['SpendValue'] ), } ) ) ));
-
Hi, I am using FusionCharts XT v3.12.2 I am creating my charts via the php wrapper. What I would like to accomplish is automatically downloading the chart after it is rendered on the page without clicking on the FusionCharts export button. Basically I want this to happen without a user needing to perform any action. All suggestions would be greatly appreciated. Thanks for your help.
- 10 replies
-
- php wrapper
- php
-
(and 2 more)
Tagged with:
-
Multi-series PHP chart working, Cannot get format correct to use ajax to refresh
P.A.Trick posted a topic in FusionCharts and PHP
I have a multi-series stacked column chart working with php. The chart gets the data from my localhost database, does a complicated query to perform some mathematics to the data, populates another table, then uses the new table data to render a fusionchart. All of this works if I run the php as a stand alone in my browser by just rendering the chart in the php file. Now I want to wrap this with ajax to make the chart live as the data updates without the need to hit the refresh button in the web browser. There is a tutorial in fusioncharts for an ajax app, but it is for a simple chart, not a stacked chart. I cannot seem to get the "echo $jsonEncodedData" in my php file to render a chart in the ajax app. I know I am completely missing something in the app. app-lightchart_data-testing.js utilization_data.php lightchart_data-testing.php lightchart_data-testing.html- 9 replies
-
- multi-series chart
- ajax
-
(and 1 more)
Tagged with:
-
Hi, I am trying to create a piechart under the following circumstances: My each row in my table contains a gender. I want to be able to sum up the number of males and females and then plot that in a pie chart. The query that I am using SELECT SUM(gender = 'male') AS male, SUM(gender = 'female') AS female FROM markers; presents 2 columns (male and female) with a count below. How is it possible to get this into the array for the chart seeing that the data required should be by row rather than column? Query Results: | male | female | | 23 | 43 | Should be | male | 23 | | female | 43 | Thanks Steve
-
Hello, I have rendered fusion chart using php wrappers. I want to store the chart, to be stored in a variable so that i can print it wherever I need it. Basically I want to do this to print the chart in a html page which will be later converted to pdf. Any information or suggestion on how to perform either of them? Thank You
-
Hello, I have been working with Fusion Charts for quite some time now and the product is great. I am now trying to create a Real Time Line Graph using Fusion Charts with the data to be fetched from MySQL. Following your documentation for the same, I have successfully implemented "Line Chart". However if change the chart type to "realtimeline", the chart does not load. It says "No data to display". The code: if ($resulthum) { // The `$arrData` array holds the chart attributes and data $arrDatahum = array( "chart" => array( "caption" => "Real-time stock price monitor", "subCaption" => "Harry's SuperMart", "xAxisName" => "Time", "yAxisName" => "Stock Price", "numberPrefix" => "$", "refreshinterval" => "5", "yaxisminvalue" => "35", "yaxismaxvalue" => "36", "numdisplaysets" => "10", "labeldisplay" => "rotate", "showValues" => "0", "showRealTimeValue" => "0", "theme" => "fint" ) ); $arrDatahum["data"] = array(); // Push the data into the array while($row = mysqli_fetch_array($resulthum)) { array_push($arrDatahum["data"], array( "label" => $row["timestamp"], "value" => $row["humidity"] ) ); } /*JSON Encode the data to retrieve the string containing the JSON representation of the data in the array. */ $jsonEncodedDatahum = json_encode($arrDatahum); /*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.*/ $columnCharthum = new FusionCharts("realtimeline", "myFirstChart2" , 600, 330, "chart-2", "json", $jsonEncodedDatahum); // Render the chart $columnCharthum->render(); // Close the database connection $dbhandle->close(); If you could please identify the mistake I am making, it would be great. Waiting for a reply soon. Abhijit Nathwani
-
I'm using following FusionChart option to Save the image to Server-Side PHP: [ 'chart' => [ "exportEnabled" => "1", "exportAtClient" => "0", "exportAction" => "save", "exportHandler" => "/fusioncharts/export-handlers/php-export-handler/index.php", "exportFileName" => $chartImagesFileName, 'categories' => [ ['category' => $labels] ], 'dataset' => [ ['seriesname' => '...', 'data' => $reg], ['seriesname' => '...', 'data' => $billed] ] ] Javascript: $(document).on('click', '#download-csv', function(e) { var id = "#" + chartUid + " .fusioncharts-container div:contains('Export As PNG')" ; $( id ).trigger("click"); }); Here, /fusioncharts/export-handlers/php-export-handler/index.php is able to generate image and print the filename. But my problem is, on triggering click, I'm unable to get the filename. How can I resolve this issue in FusionChart?
-
Adding the <axis> as strXML prevents the chart from Rendering. $strXML .="<axis title='item 2014' tickwidth='10' divlinedashed='1'>"; $strXML .="<dataset seriesName='item 2014' >"; if ($result2) { while($ors1 = mysql_fetch_array($result2)) { $strXML .= "<set value='".$ors1['item']."' />"; } } $strXML .= "</dataset>"; $strXML .="</axis>"; $strXML .="<axis title='item 2015' tickwidth='10' divlinedashed='1'>"; $result3 = mysql_query($strQuery15) or die(mysql_error()); $strXML .="<dataset seriesName='item 2015'>"; if ($result3) { while($ors1 = mysql_fetch_array($result3)) { $strXML .= "<set value='".$ors1['item']."' />"; } } $strXML .= "</dataset>"; $strXML .="</axis>"; $strXML .="<axis title='item 2016' numdivlines='10' tickwidth='10' divlinedashed='1'>"; $result4 = mysql_query($strQuery16) or die(mysql_error()); $strXML .="<dataset seriesName='item 2016'>"; if ($result4) { while($ors1 = mysql_fetch_array($result4)) { $strXML .= "<set value='".$ors1['item']."' />"; } } mysql_close($link); $strXML .= "</dataset></axis>";
-
Having trouble parsing XML to create a radar chart - can anyone help?
bergenrothn posted a topic in Using PowerCharts XT
I am trying to pass an xml string into the datasource argument and I keep getting an invalid data message when I load the page. Any help would be appreciated. <head> <title>FusionCharts XT - Column 2D Chart - Data from a database</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <!-- Include the `fusioncharts.js` file. This file is needed to render the chart. Ensure that the path to this JS file is correct. Otherwise, it may lead to JavaScript errors. --> <script src="fusioncharts/fusioncharts.js"></script> </head> <?php include("fusioncharts/fusioncharts.php"); $servername = "localhost"; $username = "*****"; $password = "****"; $dbname = "***"; // Create connection $dbhandle = new mysqli($servername, $username, $password, $dbname); // Check connection if ($dbhandle->connect_error) { die("Connection failed: " . $dbhandle->connect_error); } $dbhandle = new mysqli($servername, $username, $password, $dbname); // Render an error message, to avoid abrupt failure, if the database connection parameters are incorrect if ($dbhandle->connect_error) { exit("There was an error with your connection: ".$dbhandle->connect_error); } // Form the SQL query that returns the top 10 most populous countries $strQuery = "SELECT * FROM scores"; //$retval = mysql_query( $sql, $conn ); // Execute the query, or else return the error message. $result = $dbhandle->query($strQuery) or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); //while($row = mysql_fetch_assoc($result)) { // echo "Category :{$row['category']} <br> ". // "score : {$row['score']} <br> ". // "--------------------------------<br>"; // } $strXML ="'<chart><categories>"; // If the query returns a valid response, prepare the XML string if ($result) { // The `$arrData` array holds the chart attributes and data //$arrData["data"] = array(); // Push the data into the array while($row = mysqli_fetch_array($result)) { $strQuery2 = "select * from desirescores where ID =" . $row['ID']; //echo $strQuery2; $result2 = mysqli_query($dbhandle, $strQuery2) or die(mysqli_error()); $ors2 = mysqli_fetch_array($result2); //Generate <set label='..' value='..'/> //free the resultset $strXML .= "<category label='" . $ors2['category'] . "' />"; mysqli_free_result($result2); } } $strXML .= "</categories><dataset seriesName='Athlete Scores'>"; $strXML .="<set value='35' /><set value='48' /><set value='31' /><set value='40' /><set value='36' /><set value='36' /><set value='36' /><set value='36' /></dataset></chart>'"; echo $strXML; $radarChart = new FusionCharts("radar", "myFirstChart" , 600, 300, "chart-1", "XML", $strXML); $radarChart->render(); $dbhandle->close(); ?> <div id="chart-1"><!-- Fusion Charts will render here--></div> -
Hello, I'm struggling with the tutorial based on php and database. I'm using xampp as web hosting server. The link of the tutorial is as follows: http://www.fusioncharts.com/tutorials/php-mysql-charts/ There are four steps in the tutorial. As far as I have understood, the first three steps ask to create a file name "char_data.php". I have saved the file with the code from tutorial. The complete code is as follows: <?php> <html> <head> <body> <title>My first chart using FusionCharts Suite XT</title> <script type="text/javascript" src="fusioncharts/fusioncharts.js"></script> <script type="text/javascript" src="fusioncharts/themes/fusioncharts.theme.zune.js"></script> USE test; C REATE TABLE top_odi_wicket_takers(player varchar(255),wickets integer, PRIMARY KEY (player) ); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('MA Starc', 34); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('ST Finn', 27); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('Imran Tahir', 25); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('M Morkel', 21); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('TA Boult', 36); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('TG Southee', 28); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('CJ Anderson', 25); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('Wahab Riaz', 25); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('JH Davey', 21); INSERT INTO top_odi_wicket_takers(player, wickets) VALUES('UT Yadav', 22); SELECT * FROM top_odi_wicket_takers; +-------------+---------+ | player | wickets | +-------------+---------+ | CJ Anderson | 25 | | Imran Tahir | 25 | | JH Davey | 21 | | M Morkel | 21 | | MA Starc | 34 | | ST Finn | 27 | | TA Boult | 36 | | TG Southee | 28 | | UT Yadav | 22 | | Wahab Riaz | 25 | +-------------+---------+ 10 rows in set (0.00 sec) With this we have the required data i //address of the server where db is installed $servername = "localhost"; //username to connect to the db //the default value is root $username = "root"; //password to connect to the db //this is the value you would have specified during installation of WAMP stack $password = ""; //name of the db under which the table is created $dbName = "test"; //establishing the connection to the db. $conn = new mysqli($servername, $username, $password, $dbName); //checking if there were any error during the last connection attempt if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //the SQL query to be executed $query = "SELECT * FROM top_odi_wicket_takers"; //storing the result of the executed query $result = $conn->query($query); //initialize the array to store the processed data $jsonArray = array(); //check if there is any data returned by the SQL Query if ($result->num_rows > 0) { //Converting the results into an associative array while($row = $result->fetch_assoc()) { $jsonArrayItem = array(); $jsonArrayItem['label'] = $row['player']; $jsonArrayItem['value'] = $row['wickets']; //append the above created object into the main array. array_push($jsonArray, $jsonArrayItem); } } //Closing the connection to DB $conn->close(); //set the response content type as JSON header('Content-type: application/json'); //output the return value of json encode using the echo function. echo json_encode($jsonArray); //Closing the connection to DB $conn->close(); //set the response content type as JSON header('Content-type: application/json'); //output the return value of json encode using the echo function. echo json_encode($jsonArray); var apiChart = new FusionCharts({ type: 'column2d', renderAt: 'api-chart-container', width: '550', height: '350', dataFormat: 'json', dataSource: { "chart": chartProperties, "data": chartData } }); $(function(){ $("#background-btn").click(function(){ modifyBackground(); }); $("#canvas-btn").click(function(){ modifyCanvas(); }); $("#dataplot-btn").click(function(){ modifyDataplot(); }); apiChart.render(); }); function modifyBackground(){ //to be implemented } function modifyCanvas(){ //to be implemented } function modifyDataplot(){ //to be implemented } <div id="chartContainer">FusionCharts XT will load here!</div> </body> </head> </html> </?php> As i try to run the file "chart_data.php" in local host and I get the following page showing up: The fourth step ask to create another file under name "char_sample.html". The code is as follows: <html> <head> <body> <title>My first chart using FusionCharts Suite XT</title> <script type="text/javascript" src="fusioncharts/js/fusioncharts.js"></script> <script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.fint.js"></script> <!DOCTYPE html> <title>FusionCharts Column 2D Sample</title> </head> <body> <div id="chart-container">FusionCharts will render here</div> <script src="js/jquery-2.1.4.js"></script> <script src="js/fusioncharts.js"></script> <script src="js/fusioncharts.charts.js"></script> <script src="js/themes/fusioncharts.theme.zune.js"></script> <script src="js/app.js"></script> $(function(){ $.ajax({ url: 'http://localhost/chart_data.php' type: 'GET', success : function(data) { chartData = data; var chartProperties = { "caption": "Top 10 wicket takes ODI Cricket in 2015", "xAxisName": "Player", "yAxisName": "Wickets Taken", "rotatevalues": "1", "theme": "zune" }; apiChart = new FusionCharts({ type: 'column2d', renderAt: 'chart-container', width: '550', height: '350', dataFormat: 'json', dataSource: { "chart": chartProperties, "data": chartData } }); apiChart.render(); } }); }); <div id="chartContainer">FusionCharts XT will load here!</div> </body> </head> </html> Running the file in the localhost gives this result: I don't see any chart by running both these files in the localhost. Whereas, I'm supposed to end up having chart. Any help would be great.
-
First value in dataseries duplicating in msline chart PHP JSON
waflfootyfacts posted a topic in FusionCharts and PHP
I am trying to create an msline chart using PHP and JSON to display data from my SQL database using the Fusion Charts Factory Sample database as my guide. In both cases (with Factory Sample data and my own data) the first value in each data series are duplicated as the first and second data point, and the last value does not appear on the chart. My SQL query returns the following datasets $strQueryCategories Game R9,2015 R9,2015 R20,2015 R20,2015 EF,2015 R1,2016 R1,2016 $strQueryData Team Game Total Claremont R9,2015 60 Claremont R20,2015 60 Claremont EF,2015 61 Claremont R1,2016 110 East Perth R9,2015 21 East Perth R20,2015 70 East Perth EF,2015 93 East Perth R1,2016 34 // Form the SQL query $strQueryCategories = "SELECT CONCAT(RoundNo, ',',Season) AS Game FROM MatchDetails WHERE (Team = 'East Perth' OR Opponent = 'East Perth') AND (Team = 'Claremont' OR Opponent = 'Claremont') AND Season > 2014 ORDER BY GameID ASC"; $resultCategories = $dbhandle->query($strQueryCategories)or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); $strQueryData = "SELECT Team, CONCAT(RoundNo, ',',Season) AS Game, Total FROM MatchDetails WHERE (Team = 'East Perth' OR Opponent = 'East Perth') AND (Team = 'Claremont' OR Opponent = 'Claremont') AND Season >2014 ORDER BY Team, GameId ASC"; $resultData = $dbhandle->query($strQueryData)or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); if ($resultData) { $arrData = array( "chart" => array( "caption" => "Head to Head Since Start 2015", "subcaption" => "Scores For & Against", "theme" => "fint" ) ); $arrData["categories"] = array(array("category" => array())); if ($resultCategories) { $controlBreakValue = ""; while ($row = mysqli_fetch_array($resultCategories)) { if ($controlBreakValue != $row["Game"]) { $controlBreakValue = $row["Game"]; array_push( $arrData["categories"][0]["category"], array("label" => $controlBreakValue)); $controlBreakValue == ""; } } } $arrData["dataset"] = array(); $i = 0; if ($resultData) { $controlBreakValue = ""; while ($row = mysqli_fetch_array($resultData)) { if ($controlBreakValue != $row["Team"]) { $controlBreakValue = $row["Team"]; array_push($arrData["dataset"], array("seriesname" => $controlBreakValue, "data" => array(array("value" => $row["Total"])))); $controlBreakValue == ""; $i++; } array_push($arrData["dataset"][$i-1]["data"], array("value" => $row["Total"])); } } } $jsonEncodedData = json_encode($arrData); $dbhandle->close(); echo $jsonEncodedData; ?> <html> <body> <?php $columnChart = new FusionCharts("msline", "myFirstChart" , 850, 300, "chart-1", "json", $jsonEncodedData); $columnChart->render(); ?> <div id="chart-1"><!-- Fusion Charts will render here--></div> </body> </html> Chart output is attached. You can see the first value is duplicated. -
Hello, I have xampp with apache server and mysql. I have downloaded the trial version of fusionchart suite. I don't what to do with these files or where to save them in order to work with xamp and mysql. I have tried copying the sample code of chart and try to run it on my localhost but it say these libraries are not found in httdocs. In your quick start guide, steo 1 says to add libraries to html. i don't know where is html. Please help regarding the issue as I'm new to this thing. Regards Farooq
- 1 reply
-
- libraries installation Xampp
- php
-
(and 1 more)
Tagged with:
-
Uncaught RuntimeException: #03091456 ex1.render() Error >> Unable to find the container DOM element.
rjsherlock posted a topic in FusionCharts and PHP
Here is my code: <?php // This is a simple example on how to draw a chart using FusionCharts and PHP. // We have included includes/fusioncharts.php, which contains functions // to help us easily embed the charts. echo' <html> <script type="text/javascript" src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script> <script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.ocean.js"></script> </html> '; include(dirname(__FILE__) . "/fusioncharts/fusioncharts.php"); // Create the chart - Pie 3D Chart with data given in constructor parameter $columnChart = new FusionCharts("column2d", "ex1" , 600, 400, "chart-1", "json", '{ "chart":{ "caption":"Harry\'s SuperMart", "subCaption":"Top 5 stores in last month by revenue", "numberPrefix":"$", "theme":"ocean" }, "data":[ { "label":"Bakersfield Central", "value":"880000" }, { "label":"Garden Groove harbour", "value":"730000" }, { "label":"Los Angeles Topanga", "value":"590000" }, { "label":"Compton-Rancho Dom", "value":"520000" }, { "label":"Daly City Serramonte", "value":"330000" } ] }'); // Render the chart $columnChart->render(); ?> Here is the error I am getting: Uncaught RuntimeException: #03091456 ex1.render() Error >> Unable to find the container DOM element. I am using the example from the site..... -
Halo, Can Somebody help me for make example multiple series using JSON in PHP Framework Codeigniter with MySQL, Not using XML but JSON. Please can someone to help me.
-
- multiple series
- php
-
(and 3 more)
Tagged with:
-
hi i have problem with MSLine chart. here is my database look like: ------------|--------------------------|----------------------------| id | Generator | Date | -------------------------------------------------------------------| 1 | Plant 1 | 2015-12-01 | ------------------------------------------------------------------- 2 |Plant 2 | 2015-12-02 | ------------------------------------------------------------------- 3 | Plant 1 | 2015-12-03 | ------------------------------------------------------------------- here is mycode: <?php $q = intval($_GET['q']); $strQueryCategories = "select distinct DATE_FORMAT(tblmarketable.date,'%c-%d-%Y') as DatePro from tblmarketable where ae = 'juan' and YEAR(date) = YEAR(NOW()) and MONTH(date) = '".$q."' order by DatePro"; $resultCategories = mysql_query($strQueryCategories) or die(mysql_error()); $strQueryData = "SELECT ref, date, gen, SUM(amount) as amount from tblmarketable where ae = 'juan' and YEAR(date) = YEAR(NOW()) and MONTH(date) = '".$q."' group by gen, ref, date order by gen"; $resultData = mysql_query($strQueryData) or die(mysql_error()); $strXML = "<graph legendPostion='' caption='Marketable Sales' subCaption='By Juan' xAxisName='Group By Reference No: ' yAxisName='Amount' showValues='0' formatNumberScale='0' rotateValues='1' theme='fint'>"; $strXML .= buildCategories ($resultCategories, "DatePro"); $strXML .= buildDatasets ( $resultData, "amount", "gen"); $strXML .= "</graph>"; echo renderChartHTML("Charts/MSLine.swf", "", $strXML, "FactorySum", 600, 300, false, true); mysql_free_result($resultCategories); mysql_free_result($resultData); function buildCategories ( $result, $labelField ) { $strXML = ""; if ($result) { $strXML = "<categories>"; while($ors = mysql_fetch_array($result)) { $strXML .= "<category label='" . $ors[$labelField]. "'/>"; } $strXML .= "</categories>"; } return $strXML; } function buildDatasets ($result, $valueField, $controlBreak ) { $strXML = ""; if ($result) { $controlBreakValue =""; while( $ors = mysql_fetch_array($result) ) { echo" "; if( $controlBreakValue != $ors[$controlBreak] ) { $controlBreakValue = $ors[$controlBreak]; $strXML .= ( $strXML =="" ? "" : "</dataset>") . ( "<dataset seriesName='" . $controlBreakValue . "'>" ) ; } $strXML .= "<set value='" . $ors[$valueField] . "'/>"; } $strXML .= "</dataset>"; } return $strXML; } ?> the PLANT 1 (id 1) is correct in the position date, but the problem is the PLANT 2 date become 2015-12-01 that shows in a graph instead of 2015-12-02 and the PLANT 1 (id 3) date become 2015-12-02 instead of 2015-12-03 anyone can help me? regards.. -
-
Using DB to make multi line chart with different X value
LAIRONS posted a topic in FusionCharts and PHP
So, i have DB like these : +----------+------------+-------+ | Time | Date | A0 | +----------+------------+-------+ | 17:00:00 | 2015-06-23 | 100 | | 17:05:00 | 2015-06-23 | 120 | | 17:10:00 | 2015-06-23 | 200 | | 17:00:00 | 2015-06-24 | 200 | | 17:05:00 | 2015-06-24 | 190 | | 17:10:00 | 2015-06-24 | 200 | | 08:00:00 | 2015-06-25 | 90 | +----------+------------+-------+ and I use these code : <?php //We have included ../Includes/FusionCharts.php, which contains functions //to help us easily embed the charts. include("class/Includes/FusionCharts.php"); include("class/Includes/DBConn.php"); ?> <HTML> <HEAD> <TITLE> FusionCharts XT - </TITLE> <SCRIPT LANGUAGE="Javascript" SRC="fusioncharts/fusioncharts.js"></SCRIPT> <SCRIPT LANGUAGE="Javascript" SRC="fusioncharts/themes/fusioncharts.theme.fint.js"></SCRIPT> </HEAD> <BODY> <?php $link = connectToDB(); $strQueryCategories = "select distinct Time from input where Date between '2015-06-23' and '2015-06-27' order by Time"; $resultCategories = mysql_query($strQueryCategories) or die(mysql_error()); $strQueryData = "select * from input where Date between '2015-06-23' and '2015-06-27' "; $resultData = mysql_query($strQueryData) or die(mysql_error()); $strXML = "<chart legendPostion='' caption='Konsentrasi CO2' subCaption='By Quantity' xAxisName='Time' yAxisName='Concentration (ppm)' showValues='0' formatNumberScale='0' rotateValues='1' theme='fint'>"; $strXML .= buildCategories ($resultCategories, "Time"); $strXML .= buildDatasets ( $resultData, "A0", "Date"); $strXML .= "</chart>"; echo renderChart("MSLine", "", $strXML, "FactorySum", 600, 300, false, true); mysql_free_result($resultCategories); mysql_free_result($resultData); mysql_close($link); function buildCategories ( $result, $labelField ) { $strXML = ""; if ($result) { $strXML = "<categories>"; while($ors = mysql_fetch_array($result)) { $strXML .= "<category label='" . $ors[$labelField]. "'/>"; } $strXML .= "</categories>"; } return $strXML; } function buildDatasets ($result, $valueField, $controlBreak ) { $strXML = ""; if ($result) { $controlBreakValue =""; while( $ors = mysql_fetch_array($result) ) { echo" "; if( $controlBreakValue != $ors[$controlBreak] ) { $controlBreakValue = $ors[$controlBreak]; $strXML .= ( $strXML =="" ? "" : "</dataset>") . ( "<dataset seriesName='" . $controlBreakValue . "'>" ) ; } $strXML .= "<set value='" . $ors[$valueField] . "'/>"; } $strXML .= "</dataset>"; } return $strXML; } ?> </BODY> </HTML> But what I get is a chart with false value. the 1st value of A0 data at 2015-06-23 and 2015-06-24 are at 08:00:00 instead of 17:00:00, and so goes on for the other data. Please someone help me So the only data at 08:00:00 only 2015-06-25 data -
Hello to Forum, I am new one with combining Charts with FusionChart XT. I have created some normal charts with Pie,Column,Line but i have some difficulties with MultiSeries Line Chart and would be appreciate if you can help me please. In the text below i will provide you my php code: <?php //We have included ../Includes/FusionCharts.php and ../Includes/DBConn.php, which contains //functions to help us easily embed the charts and connect to a database. include("FusionCharts.php"); #include("../Includes/DBConn.php"); ?> <HTML> <HEAD> <TITLE>FusionCharts XT - Database Example</TITLE> <SCRIPT LANGUAGE="Javascript" SRC="FusionCharts.js"></SCRIPT> </HEAD> <BODY> <CENTER> <?php //In this example, we show how to connect FusionCharts to a database. //For the sake of ease, we have used an MySQL databases containing two //tables. // Connect to the DB mysql_connect('localhost','root','google'); mysql_select_db('Difference_Output'); // SQL query for category labels $strQueryCategories ="SELECT DISTINCT `CHANNEL_ID` FROM `DIFFERENTS` WHERE `SECONDS_ID2`>0 AND `SECONDS_ID1`>0 ORDER BY `CHANNEL_ID`"; // Query database $resultCategories = mysql_query($strQueryCategories) or die(mysql_error()); // SQL query for factory output data $strQueryData = "SELECT `SECONDS_ID2`, `SECONDS_ID1`, `CHANNEL_ID` FROM `DIFFERENTS` WHERE `SECONDS_ID2`>0 AND `SECONDS_ID1`>0 ORDER BY `SECONDS_ID2`,`SECONDS_ID1`"; // Query database $resultData = mysql_query($strQueryData) or die(mysql_error()); //We also keep a flag to specify whether we have to animate the chart or not. //If the user is viewing the detailed chart and comes back to this page, he shouldn't //see the animation again. //$strXML will be used to store the entire XML document generated //Generate the chart element $strXML = "<chart legendPosition='' caption='Records Output report' subCaption='By Seconds' xAxisName='Factory' yAxisName='Units' showValues='0' formatNumberScale='0' rotateValues='1' animation='1'>"; // Build category XML $strXML .= buildCategories ($resultCategories, "CHANNEL_ID"); // Build datasets XML $strXML .= buildDatasets ( $resultData, "SECONDS_ID2", "SECONDS_ID1"); //Finally, close <chart> element $strXML .= "</chart>"; //Create the chart - Pie 3D Chart with data from strXML echo renderChart("MSLine.swf", "", $strXML, "FactorySum", 1000, 700, false, true); // Free database resource # mysql_free_result($resultCategories); # mysql_free_result($resultData); # mysql_close($link); /*********************************************************************************************** * Function to build XML for categories * @param $result Database resource * @param $labelField Field name as String that contains value for chart category labels * * @return categories XML node */ function buildCategories ( $result, $labelField ) { $strXML = ""; if ($result) { $strXML = "<categories>"; while($ors = mysql_fetch_array($result)) { $strXML .= "<category label='" . $ors[$labelField]. "'/>"; } $strXML .= "</categories>"; } return $strXML; } /*********************************************************************************************** * Function to build XML for datasets that will contain chart data * @param $result Database resource. The data should come ordered by a control break field which will require to identify datasets and set its value to dataset's series name * @param $valueField Field name as String that contains value for chart dataplots * @param $controlBreak Field name as String that contains value for chart dataplots * * @return Dataset XML node */ function buildDatasets ($result, $valueField, $controlBreak ) { $strXML = ""; if ($result) { $controlBreakValue =""; while( $ors = mysql_fetch_array($result) ) { if( $controlBreakValue != $ors[$controlBreak] ) { $controlBreakValue = $ors[$controlBreak]; $strXML .= ( $strXML =="" ? "" : "</dataset>") . ( "<dataset seriesName='" . $controlBreakValue . "'>" ) ; } $strXML .= "<set value='" . $ors[$valueField] . "'/>"; } $strXML .= "</dataset>"; } return $strXML; } ?> </BODY> </HTML> The cart is running fine but is giving me all of the values, the thing that i need is 2 lines with dots.The CHANNEL_ID i want to be in X axis value and SECONDS1 and SECONDS2 IN Y values. For every other Details i can provide you my help. Thanks
-
Hi, Anyone who need FusionChart DashBoard using Mysql/php Application feel free to hire me
-
- forhire
- fusioncharts
-
(and 3 more)
Tagged with: