You are here

Charts and Graphs - General Reference in Charts and Graphs 6

Here you have the reference for the properties available for all charting libraries. Any library that doesn't implements some of this properties should document it so in it's specific page.

Properties list

Properties

height

The height property sets the graph height in pixels.

Example:
<?php
$canvas->height = 300;

series

The series property sets the data to be plotted on the graph.

It's an associative array of arrays. The keys are the data series names (which will appear on the legend of the graph). Each inside array holds the values for that data serie.

In a pie chart there should be only one data series and the key for this data serie is ignored as the values are named after the x labels.

Example:
<?php
$canvas->series = array(
  array(1000, 1200, 1300, 1150),
  array(345, 1300, 120, 937),
);

title

The title property sets the graph title.

Example:
<?php
$canvas->title = 'Graph title';

type

The type property sets the graph type. All charting libraries support at least the following types:

bar
Bar graph
line
Line graph
pie
Pie graph
Example:
<?php
$canvas->type = 'line';
Others standardized graph types

Here is a complete list of standardized chart types (see each charting library Advanced Help page for a specific list of supported chart types):

area
Area graph. It's similar to a line graph with line/axis area painted.
donut
Similar to a pie graph but with a hole in the middle.
side_bar
Side bar graph, also known as sidebar.
stacked_area
Similar to an area graph where each new data series is presented above the other.
stacked_bar
Similar to a bar graph where the bars for the same x reference are stacke one over the other instead of being side by side.
stacked_side_bar
Similar to a side bar graph where each bar for the same y reference is put to the right of each other instead of one below the other.
Other graph types

Each charting library might support other graph types. Please see the accompanying Advanced Help page or the charting library documentation page.

width

The width property sets the graph width in pixels.

Example:
<?php
$canvas->width = 500;

x_labels

The x_labels property sets the labels for each point in the x axis of the graph.

In a pie chart these are the names used to identify each value in the data series.

Example:
<?php
$canvas->x_labels = array('2007', '2008', '2009', '2010');

y_legend

The y_legend property sets the text presented next to the y axis of the graph.

Example:
<?php
$canvas->y_legend = 'population';

File

help/general_reference.html
View source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Charts and Graphs - General Reference</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Here you have the reference for the properties available for all
      charting libraries. Any library that doesn't implements some of this
      properties should document it so in it's specific page.</p>
    <h3>Properties list</h3>
    <ul>
      <li><a href="#height">height</a></li>
      <li><a href="#series">series</a></li>
      <li><a href="#title">title</a></li>
      <li><a href="#type">type</a></li>
      <li><a href="#width">width</a></li>
      <li><a href="#x_labels">x_labels</a></li>
      <li><a href="#y_legend">y_legend</a></li>
    </ul>
    <h3>Properties</h3>
      <h4><a name="height">height</a></h4>
        <p>The <i>height</i> property sets the graph height in pixels.</p>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->height = 300;
</pre>
      <h4><a name="series">series</a></h4>
        <p>The <i>series</i> property sets the data to be plotted on the graph.</p>
        <p>It's an associative array of arrays. The keys are the data series
          names (which will appear on the legend of the graph). Each inside
          array holds the values for that data serie.</p>
        <p>In a pie chart there should be only one data series and the key for
          this data serie is ignored as the values are named after the
          <a href="#x_labels">x labels</a>.</p>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->series = array(
  array(1000, 1200, 1300, 1150),
  array(345, 1300, 120, 937),
);
</pre>
      <h4><a name="title">title</a></h4>
        <p>The <i>title</i> property sets the graph title.</p>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->title = 'Graph title';
</pre>
      <h4><a name="type">type</a></h4>
        <p>The <i>type</i> property sets the graph type. All charting libraries
          support at least the following types:</p>
        <dl>
          <dt>bar</dt>
          <dd>Bar graph</dd>
          <dt>line</dt>
          <dd>Line graph</dd>
          <dt>pie</dt>
          <dd>Pie graph</dd>
        </dl>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->type = 'line';
</pre>
      <h5><a name="other_standardized_types">Others standardized graph types</a></h5>
        <p>Here is a complete list of standardized chart types (see each
          charting library Advanced Help page for a specific list of supported
          chart types):</p>
        <dl>
          <dt>area</dt>
            <dd>Area graph. It's similar to a line graph with line/axis area
              painted.</dd>
          <dt>donut</dt>
            <dd>Similar to a pie graph but with a hole in the middle.</dd>
          <dt>side_bar</dt>
            <dd>Side bar graph, also known as sidebar.</dd>
          <dt>stacked_area</dt>
            <dd>Similar to an area graph where each new data series is presented
              above the other.</dd>
          <dt>stacked_bar</dt>
            <dd>Similar to a bar graph where the bars for the same x reference are
              stacke one over the other instead of being side by side.</dd>
          <dt>stacked_side_bar</dt>
            <dd>Similar to a side bar graph where each bar for the same y
              reference is put to the right of each other instead of one below the
              other.</dd>
        </dl>
      <h5><a name="other_types">Other graph types</a></h5>
        <p>Each charting library might support other graph types. Please see the
        accompanying Advanced Help page or the charting library documentation
        page.</p>
      <h4><a name="width">width</a></h4>
        <p>The <i>width</i> property sets the graph width in pixels.</p>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->width = 500;
</pre>
      <h4><a name="x_labels">x_labels</a></h4>
        <p>The <i>x_labels</i> property sets the labels for each point in the x
          axis of the graph.</p>
        <p>In a pie chart these are the names used to identify each value in the
          data series.</p>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->x_labels = array('2007', '2008', '2009', '2010');
</pre>
      <h4><a name="y_legend">y_legend</a></h4>
        <p>The <i>y_legend</i> property sets the text presented next to the y
          axis of the graph.</p>
        <h5>Example:</h5>
<pre>
&lt;?php
$canvas->y_legend = 'population';
</pre>
  </body>
</html>