Skip to content

FlashChartHelper API

alkemann edited this page Sep 13, 2010 · 1 revision

Api documentation for the FlashChartHelper

Usage rules

  • Start with (one) call of the FlashChartHelper::begin() method.
  • Add the prototype parameter to the begin call if you use prototype.
  • End with FlashChartHelper::render() (one per diagram)
  • Call the FlashChartHelper::axis(‘x’) to apply the labels
  • If using the labels on the x axis from the dataset, set the data before calling axis()
  • begin(), chart() and render() methods should be echo’ed

Public variables

$Chart
Contains the vendor php object. Use only for features that is not implemented in the helper

$swf
Defaults to ‘flash/open-flash-chart.swf’. Change only if you put the file somewhere else than app/webroot/flash or rename it.

$ready
Javascript callback for when the data is loaded into the chart.

$loading
Javascript callback for when the data is loading.

Public methods


begin($options)

  • $options array Valid keys : ‘prototype’

Initializes the helper and embeds the needed javascript libraries.


render($width, $height, $chartId, $domId)

  • $width int Pixel with of the flash chart
  • $height int Pixel height of flash chart
  • $chartId int name of chart for when using multiple seperate charts
  • $domId int Dom object id if you wish to target an existing div

Outputs the embeded flash, rendering the charts.


setData($data, $numbersPath, $labelsPath, $datasetName, $chartId)

  • $data array An array containing at least the values to be charted
  • $numbersPath array ‘{n}’ XPath to the values to be charted
  • $labelsPath array false XPath to labels
  • $datasetName string ‘default’ Association tag for the added data

Add a set of data to be rendered by the helper.


chart($type, $options, $datasetName, $chartId)

  • $type string ‘bar’ type of chart
  • $options array
  • $datasetName string ‘default’
  • $chartId string ‘default’

Renders the javascript with data and customization for one graph chart. To be called last, but may be called multiple times with different datasetNames for different datasets or different type (and options) for different display of the same data in the same chart. What options are valid vary from chart type to chart type, and the helper is set up in such a way as to pass the options on to the vendor, therefore letting you use an updated vendor without changes to the helper. This also means that the helper doesnt know (or care) what options you send, but if they do not exist in the vendor, you will throw an error.

Aliases

  • barStack($options = array(), $datasetName = ‘default’, $chartId = ‘default’)
  • scatter($options = array(), $datasetName = ‘default’, $chartId = ‘default’)
  • sketch($options = array(), $datasetName = ‘default’, $chartId = ‘default’)
  • radar($options = array(), $datasetName = ‘default’, $chartId = ‘default’)
  • pie($options = array(), $datasetName = ‘default’, $chartId = ‘default’)

setToolTip($tooltip, $options)

  • $tooltop string
  • $options array

Sets the tool tip for the chart by using a string with replaceable codewords like #val#. Check OFC2 for documentation. Also you can style the tooltips look and behavior using the options parameter.


setTitle($title,$style)


setLegend($axis, $title, $style)


axis($axis, $options, $labelsOptions)


rightAxis($options)


setRadarAxis($options, $labels)


setRadarSpokes($spokes, $colour)


setNumbersPath($path, $datasetName)


setLabelsPath($path)


setBgColour($colour)


setStackColours($colours)