This is an old revision of the document!
string diagram2(string Type, array Data, [array Options])
With the function diagram2()
data can be visualized which have been calculated before in the questionnaire – e.g. from the user's data via value()' or via
statistic().
Currently this function can only display a polarity profile.
* Type
'polar
Defines the type of chart:
* ' – polarity profile
* Data
'0000FF''' for blue)
The data is specified as a two-dimensional array, i.e. an array with one array per data series (see example).
* Options A number of options are available for controlling the display. Some of these only apply to certain types of chart. The options are specified as a named array (see example).
* int width – Width of the diagram (in pixels)
* int height – Height of the diagram (in pixels)
* int min – Minimum of the displayed scale (polarity profile only)
* int max – Maximum of the displayed scale (polarity profile only)
* boolean labels – Use the first data series as label
* int labelwidth – width of the label (in pixels)
* array limit – Display limits at the specified values (polarity profile only)
* array limitcolor – background colors for the different areas between the borders (only polarity profile, specified as HTML color codes, e.g.
For example, a multidimensional array could look like this:
array( array(1,2,3,4,5,6,7,8,10), // first data series array(1,4,2,3,5,7,2,1,2) // second data series )
An array with the options can look like this:
array( 'width' => 320, "height" => 120, 'min' => 1, 'max' => 7, labels => true, 'limit' => array(2,4) )
A diagram can be output as follows:
$src = diagram2('polar', array( array('Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Theta', 'Eta', 'Phi'), // Labels array(1,4,2,5,3,7,2,1,2) // Data ), array( 'width' => 320, "height" => 120, labelwidth => 100, 'min' => 1, 'max' => 7, labels => true, 'limit' => array(2,5,7), 'limitcolor' => array('FFFF99', 'FFFFFF', 'FFFF99') ) ); html($src);