Flashchart Sample 6

Data for Chart is retrieved from Joomlas MySql Database

We will not only access Joomla's local database but retrieve similar data from remote MySql Datenbases. All sites have flashChart installed and are using flashChart's MySql interface.

In this sample two charts are generated. Second chart is not displayed ("hidden") as it has parameter "hide_chart" set. All charts may be displayed by clicking choice in chart menu. Javascripts to be used in "menu" have been created dynamically via parameter "create_script".

Please select choice in chart menu

Access to remote MySql Databaes is done with a tiny PHP-Script, which will be triggered for execution via parameter data="url" and "url". It uses flashChart's Version 1.3.0 interfaces (via "flashchart_class.php").

Here you have this PHP-Script - "getDatafromDB.php", which has been installed in directory "../templates/system" on both remote sites:


defined('_JEXEC') or die('Restricted access');
require_once (JPATH_ROOT . "/plugins/content/flashchart/lib/flashchart_class.php");

$chartdata = new flashChart("myid");
$chartdata->setChartProperty("data", "database");
$chartdata->setChartProperty("sql", "Select title, hits From jos_content Order By hits Desc Limit 10");

echo ( $chartdata->getChartProperty("data") );


Important: If you want to test this sample via copy/paste, ensure that you paste with option "paste as plain text" otherwise imbedded html-codes may invalidate your input.




Today: 17
Yesterday: 15
This Week: 73
Last Week: 124
This Month: 339
Last Month: 526
United States 35.3% USA
Germany 13.4% Germany
Russia 4.6% Russia
France 3.3% France
Indonesia 2.6% Indonesia
Italy 2.6% Italy
India 2.4% India
Poland 2.2% Poland



Cookies make it easier for us to provide you with our services. With the usage of our services you permit us to use cookies.