Active Graphs and Charts

Active Graphs and Charts


Setting Data

Data can be supplied to the graph via two methods:-

Setting Data Directly within the Page

The the graph demos in the ./example directory all set the data via this method. Simply create data object and add the array's of data to it each series of data to be plotted like this:-

For the XY Scatter chart data should be supplied in x-y pairs:-

It is also possible to add properties to any/all data items. There are 3 optional properties that can be added to any data value:-

The parameters should be seperated by a semi-colon with the name: value format much like that of css.

Via a server 'Data File or Script/Process'

The second method for setting data allows the data to be supplied from a server file or script. The 'Data URL' is set and supplied to the graph software. Upon startup the graphing software will issue a URL request to read the data dynamically from the server.

It is important to note that pages that contain a graph configured in this manner must be served up via a web server, if not the request for the data will fail. i.e. such a page will not work from the local file system.

To set a dataurl set the JpGraphDataFile item on the property object:-

Here is an example of the contents of a data file:-

The URL to the property file does not have to be a physical file, it can be set to a server side script which will allow data values to be generated 'on the fly'. This is ideal where the data is being fetched in the real time from a database or other data repository.

The following is a simple PHP script which will supply the graph data:-

Any server side language can be used to dynamically generate in this manner (i.e. ASP, Python, JSP, Java etc)

[ ] [Support ]
Copyright © 2011 Neutron Solutions Limited - All rights reserved