The actual series to append to the chart. In addition to the members listed below, any member of the plotOptions for that specific type of plot can be added to a series individually. For example, even though a general lineWidth is specified in plotOptions.series, an individual lineWidth can be specified for each series.

The methods used:

Add a data to the series with a given name. If the name exists the data will be overwritten. Data can be added via array, sql query or javascript function

Parameters:

  • string $name: the name of the chart. This will be displayed in the chart
  • mixed $value: can be array, sql query and java script function.
  • array $params: parameters passed to the query in case of SQL data
  • mixed $limit: if set to number the number of records to retrieve
  • integer $offset: how many records to skip in case of sql.

API Tags:
Return: instance
Access: public

Set a various options for a serie.
Parameters:

  • string $name: the name for the serie
  • mixed $option: can be a array or string. If array a key value pair should be used, where key is the properti value is the optinvalue
  • mixed $value: the value of the option value in case the option is a string

API Tags:
Return: instance
Access: public

The data is added with addSeries method.
Array Data
1. A list of numerical values. In this case, the numberical values will be interpreted and y values, and x values will be automatically calculated, either starting at 0 and incrementing by 1, or from pointStart and pointInterval given in the plotOptions. If the axis is has categories, these will be used. Example:

... $chart = new jqChart(); $chart->addSeries('Tokyo', array(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6)) ...

2. A list of arrays with two values. In this case, the first value is the x value and the second is the y value. If the first value is a string, it is applied as the name of the point, and the x value is incremented following the above rules. Example:

... $chart = new jqChart(); ->addSeries('data', array( arraY(20, 20), array(80, 80) )); ...

3. A list of object with named values. In this case the objects are point configuration objects as seen under options.point. Example:

... $chart = new jqChart(); ->addSeries('data', array( array( "name" =>'Point 1', "color"=> '#00FF00', "y"=> 0 ), array( "name" =>'Point 2', "color"=> '#FF00FF', "y"=> 5 ) )); ...

Data can be added via Javascript function
Example:

... $randdata = << RNDATA (function() { // generate an array of random data var data = [], time = (new Date()).getTime(), i; for (i = -19; i <= 0; i++) { data.push({ x: time + i * 1000, y: Math.random() }); } return data; })() RNDATA; ... $chart = new jqChart(); $chart->addSeries('Random data', 'js:'.$randdata ); ...


Data can be added direct via SQL query.
Example

... require_once ABSPATH."php/jqUtils.php"; require_once ABSPATH."php/jqGridPdo.php"; require_once ABSPATH."php/jqChart.php"; $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 jqGridDB::query($conn,"SET NAMES utf8"); $chart = new jqChart($conn); $chart->addSeries("MyOrders","SELECT SUM(ordersum) FROM orders GROUP BY order_date"); ...