|
Search:
Advanced search
|
Browse by category:
|
Data |
|||
DataTo display a custom chart, amPie will need to get your data in a suitable form. There are two formats you can use: CSV and XML.
CSV data is similar to a very simple Excel table. Rows are separated by line breaks (each new table row is a new text row in the file). Columns are separated by a special character - usually a comma ',' or a semicolon ';'. This character is called a separator. Adding the Data - XMLIf you are using the default file and folder names, the data goes into the file ampie_data.xml, which is located in the ampie directory. You will see the following code: <pie> The important rows are the ones starting with <slice. These hold the individual parts of your pie or donut chart - the slices. There are two types of data you can store here:
Change the slice parameters and values to reflect your data. You can create as many slices as you like, as long as they are all in the format <slice parameter="information">value</slice>, and are placed sequentially in the file. The sequential order of the slices in the file is the same as their order on the chart, clockwise from the top. Adding the Data - CSVIf you are using CSV data, you must tell the software to look for that format.
so.addVariable("data_file", escape("ampie/ampie_data.xml")); Change ampie_data.xml to ampie_data.txt, and save/upload the file.
<data_type>xml</data_type> Replace xml with csv and save/upload the file. If you are using the default file and folder names, the data goes into the file ampie_data.txt, which is located in the ampie directory. The CSV file is actually plain text. Each slice is on a new row. The parameters and value are separated by a special character. By default, this is the semicolon, but you can change it to a different character using the chart settings. The slice information is in the following order: title;value;pull_out;color;url;description;alpha;label_radius
If you are only using the first two or more, you don't have to specify the rest. If you are skipping some parameters, but using a later one, you must use a semicolon for each skipped parameter. Check the example ampie_data.txt file to see how this works. The sequential order of the slices in the file is the same as their order on the chart, clockwise from the top. External Data FilesYou can use any data file name and file type you want. The data file does not have to be an XML or plaintext file. It can be PHP, ASP, or any other format. As long as you can open the file's URL in your browser and get XML or CSV data in return, the software will work. You can also pass parameters to the data file in the URL. To use a data file different from the default, open your web page file in Notepad. Find the code snippet for the chart. Find the following line: so.addVariable("data_file", escape("ampie/ampie_data.xml")); Replace ampie/ampie_data.xml with the full path to your data file. We recommend that you use relative paths, like in the example above - full paths can cause conflicts with the Flash Player's security settings. Loading data from a different domain or from a secure server (https://) To load data from a different domain, or from a server whose URL starts with https://, you need to create a cross domain policy file and upload it to the server where your data is. More ways to solve this problem can be found here. There is another easy way to load data from secure server (starting with https://) - all you need to do is to add this header to your php file: header("Pragma: cache"); |
|||
| Others in this Category | |
| Dynamic Data | |
| Data in the HTML | |