Table of Contents
FusionCharts XT in PHP Series
FusionCharts_XT_with_PHP
. This will be our demo folder.Charts
folder from the FusionCharts XT Download Package and paste it within our demo folder. This completes the installation of FusionCharts XT in our web application.Includes
folder from FusionCharts XT Download Package > Code > PHP > Includes
to our demo folder.link
attribute added to the dataplots of the parent chart (see below how to add this attribute)label
and the value
attributes for the set
element. Now to add drill-down to that dataplot, you will have to specify the link
attribute. With the above XML, the dataplot, when clicked, will go to the page DrillDown_Child_Chart.php?country=China
, which contains another chart to show some other data. In FusionChartsXT_with_PHP_and_MySQL_DataString.php
, edit the part where you create the dataplots as below: $strXML .= "";Now that we have the first 2 things required for a drill-down chart, let us create the page that will show the child chart. This child chart needs to show a specific subset of the aggregate data; data related only to the parent dataplot. Create a blank PHP file named
DrillDown_Child_Chart.php
in our demo folder and write the following code in it: < ?php // Include the DBConn.php and FusionCharts.php files, so that we can access their variables and functions. include('Includes/DBConn.php'); include('Includes/FusionCharts.php'); // Retrieve the name of the country from the $_REQUEST parameter $countryName = $_REQUEST['country']; // Use the connectToDB() function provided in DBConn.php, and establish the connection between PHP and the World database in our MySQL setup. $link = connectToDB(); // Form the SQL query which will return the Top 10 Most Populous Cities according to the specified Country. $strQuery = 'SELECT city.Name AS City, city.Population AS Population FROM city WHERE city.CountryCode = (SELECT country.Code FROM country WHERE country.Name = "'.$countryName.'") ORDER BY Population DESC LIMIT 10'; // Execute the query, or else return the error message. $result = mysql_query($strQuery) or die(mysql_error()); // If we get a valid response - if ($result) { // Create the chart's XML string. We can add attributes here to customize our chart. $strXML = ""; while($ors = mysql_fetch_array($result)) { // Append the names of the cities and their respective populations to the chart's XML string. $strXML .= ""; } } // Close the chart's XML string. $strXML .= ""; ?> < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Have you ever spent hours buried in documentation, hunting for a specific piece of code?…
Do you feel like your data is a cryptic puzzle, locked away from revealing its…
In web development, mastering JavaScript charting libraries is crucial for keeping up with the fast-paced…
Ever spend an afternoon neck-deep in documentation, searching for that one elusive code snippet? Or…
In the dynamic world of data visualization, the need for precision and innovation has never…
Are you drowning in data but struggling to find the insights that drive real business…
View Comments
Kiểu dáng hiện đại. Mỗi ngăn kéo có 1 tay nắm nhựa.
Искал информацию о том установить люстру в спальной комнате, нащел всю необходимую информацию в этой статье
Simply wish to say your article is as astonishing.
The clearness for your post is just nice and i can think you're knowledgeable on this subject.
Fine along with your permission allow me to grasp your feed to keep updated with impending post.
Thank you 1,000,000 and please keep up the gratifying work.