You are here

function hook_charts_type_info in Charts 8

Same name and namespace in other branches
  1. 7.2 charts.api.php \hook_charts_type_info()

Provide a new chart type to the system.

Any chart types provided by this hook may be used as a #chart_type property on a $chart renderable. Note that not all chart types may be supported by all charting libraries.

2 functions implement hook_charts_type_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

ChartsConfigForm::charts_charts_type_info in src/Form/ChartsConfigForm.php
charts_charts_type_info in includes/charts.pages.inc
Implements hook_charts_type_info().
1 invocation of hook_charts_type_info()
charts_type_info in includes/charts.pages.inc
Retrieve a list of all chart types available.

File

./charts.api.php, line 167
Documentation on hooks provided by the Charts module.

Code

function hook_charts_type_info() {
  $chart_types['bar'] = array(
    'label' => t('Bar'),
    // If this chart supports both an X and Y axis, set this to
    // CHARTS_DUAL_AXIS. If only a single axis is supported (e.g. pie), then
    // set this to CHARTS_SINGLE_AXIS.
    'axis' => CHARTS_DUAL_AXIS,
    // Many charting libraries always refer to the main axis as the "y-axis",
    // even if the chart's main axis is horizontal. An example of this is a
    // bar chart, where the values are along the horizontal axis.
    'axis_inverted' => TRUE,
    // Meaning x/y axis are flipped.
    // For bar/area/other charts that support stacking of series, set this value
    // to TRUE.
    'stacking' => TRUE,
  );
  return $chart_types;
}