When analyzing data, the way of using charts is very straightforward, and if the charts can be interactive, the effect will be even better. In this article, we will explore how to use PHP with the open source report library FusionCharts (project address: www.fusioncharts.com/) to create interactive drill-through reports. The so-called drill-through report means that when the user clicks on the data axis in the report, a new report can be opened, which facilitates navigation between different reports and is very convenient.
Introducing linked charts
Generally speaking, the data of ordinary charts are independent. How can we aggregate these data together and allow us to navigate back and forth between these data charts? This is exactly what LinkedCharts can achieve. It is a new drill feature added in FusionCharts 3.2. It allows you to create unlimited drill charts with only one data source. All links are from the parent chart and its data.
In this article, we will learn how to combine charts with web applications. The Mysql database will contain the required data, while the PHP program will retrieve the data from the database, and FusionCharts will be responsible for processing and displaying the data. Their relationship is as follows:
If you want to know more about LinkedCharts, you can read the following article (http://kb.fusioncharts.com/questions/459/What+is+a+Drill-down+chart?), The main points of this article are summarized as follows:
1 The drill-down report uses the default settings of the parent chart to display data;
2 Each drill layer can have additional settings. Of course, you can change the settings and chart type of each drill layer;
3 Link charts can be opened in a new window, which supports jQuery dialog boxes, lightbox, extJS windows and more;
4 Supports the use of Javascript to expand events.
What are we going to do
We often need to monitor how many visitors our website has to see if it has grown. In this article, we will make a small application that can display how many registered users our website has over a period of time.
Preparation: Support php web server, here we use apache, mysql database, download FusionCharts.
Step 1 Initial setup
Create an empty database fctutorial, and create a subdirectory of fcdemo to store php files.
Step 2 Initialize database data
Here we create a users table, which simply has two fields, one is ID and the other is user registration time: