Charts API Array Structure - Prior releases
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
The Charts API structure depends on the version of the charts module being used. Starting from version 7.x-2.x, charts uses a new structure, which has not yet been documented in these charts documentation pages (feel free to enhance these pages for it ...). The information below applies to versions prior to 7.x-2.x.
The main Chart structure consists of:
- Chart: Include all series and global attributes, like height and width
- Series: A collection of values. Its all points of a line chart or all values from a pie chart
- Value: The simplest unity. its a single value in a series
Each of these options allow for setting some attributes to customize a chart.
Charts
- #height: REQUIRED. The chart height, in pixels.
- #width: REQUIRED. The chart height, in pixels.
- #plugin: REQUIRED. The chart API, like Google, Open Flash Chart, etc. It must be its code.
- #type: REQUIRED. The type of the chart. Each plugin accepts a list of chart types. Almost all chart plugins will accept: 'line2D', 'hbar2D', 'vbar2D' and 'pie2D'. But generally, they will accept a much longer list.
- #color: the RRGGBB1 schema for colors, just like CSS.
- #title: If you want a title on the chart, put it here, like 'Profit X Revenue 2015', 'Market Share'...
Series
- #color: the RRGGBB1 schema for colors, just like CSS.
- #legend: If the series has a legend, put it here, like 'Revenue', 'Profit', 'Expenses'...
Values
- #color: the RRGGBB1 schema for colors, just like CSS.
- #label: If a particular point has a legend, put it here, like 'Today', 'Target'...
1 - Don't use the # character at the beginning
You have to use # character at the beginning. Eg.
$series['#color'] = '#AAAAAA';
If you think that might be other attributes on any level, open an issue and try to implement it into the default chart provide filters.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion