You are here

function charts_element_info in Charts 7.2

Implements hook_element_info().

File

./charts.module, line 49
Provides elements for rendering charts and Views integration.

Code

function charts_element_info() {

  // Create the elements representing charts themselves.
  $info['chart'] = array(
    '#chart_type' => NULL,
    // Options: pie, bar, column, etc.
    '#chart_id' => NULL,
    // Machine name to alter this chart individually.
    '#title' => NULL,
    '#title_color' => '#000',
    '#title_font_weight' => 'normal',
    // Options: normal, bold
    '#title_font_style' => 'normal',
    // Options: normal, italic
    '#title_font_size' => 14,
    // Font size in pixels, e.g. 12.
    '#title_position' => 'out',
    // Options: in, out.
    '#colors' => charts_default_colors(),
    '#font' => 'Arial',
    '#font_size' => 12,
    // Font size in pixels, e.g. 12.
    '#background' => 'transparent',
    '#stacking' => NULL,
    // Bar chart only. Set to TRUE to stack.
    '#pre_render' => array(
      'charts_pre_render_element',
    ),
    '#tooltips' => TRUE,
    '#tooltips_use_html' => FALSE,
    '#data_labels' => FALSE,
    '#legend' => TRUE,
    '#legend_title' => NULL,
    '#legend_title_font_weight' => 'bold',
    // Options: normal, bold
    '#legend_title_font_style' => 'normal',
    // Options: normal, italic
    '#legend_title_font_size' => NULL,
    // CSS value for font size, e.g. 1em or 12px.
    '#legend_position' => 'right',
    // Options: top, right, bottom, left.
    '#legend_font_weight' => 'normal',
    // Options: normal, bold
    '#legend_font_style' => 'normal',
    // Options: normal, italic
    '#legend_font_size' => NULL,
    // CSS value for font size, e.g. 1em or 12px.
    '#width' => NULL,
    '#height' => NULL,
    '#attributes' => array(),
    // Applied to the wrapper, not the chart.
    '#chart_library' => NULL,
    // If requiring a particular charting module.
    '#raw_options' => array(),
  );

  // Properties for x and y axes.
  $axis_properties = array(
    '#axis_type' => 'linear',
    // Options: linear, logarithmic, datetime, labels.
    '#title' => '',
    '#title_color' => '#000',
    '#title_font_weight' => 'normal',
    // Options: normal, bold
    '#title_font_style' => 'normal',
    // Options: normal, italic
    '#title_font_size' => 12,
    // CSS value for font size, e.g. 1em or 12px.
    '#labels' => NULL,
    '#labels_color' => '#000',
    '#labels_font_weight' => 'normal',
    // Options: normal, bold
    '#labels_font_style' => 'normal',
    // Options: normal, italic
    '#labels_font_size' => NULL,
    // CSS value for font size, e.g. 1em or 12px.
    '#labels_rotation' => NULL,
    // Integer rotation value, e.g. 30, -60 or 90.
    '#grid_line_color' => '#ccc',
    '#base_line_color' => '#ccc',
    '#minor_grid_line_color' => '#e0e0e0',
    '#max' => NULL,
    // Integer max value on this axis.
    '#min' => NULL,
    // Integer minimum value on this axis.
    '#opposite' => FALSE,
  );
  $info['chart_xaxis'] = array() + $axis_properties;
  $info['chart_yaxis'] = array() + $axis_properties;

  // And then the pieces of charts used within chart types.
  $info['chart_data'] = array(
    '#title' => NULL,
    '#labels' => NULL,
    '#data' => array(),
    '#color' => NULL,
    '#show_in_legend' => TRUE,
    '#show_labels' => FALSE,
    // Show inline labels next to the data.
    '#chart_type' => NULL,
    // If building multicharts. The chart type, e.g. pie.
    '#line_width' => 1,
    // Line chart only.
    '#marker_radius' => 3,
    // Line chart only. Size in pixels, e.g. 1, 5.
    '#target_axis' => NULL,
    // If using multiple axes, key for the matching y axis.
    // Formatting options.
    '#decimal_count' => NULL,
    // The number of digits after the decimal separator. e.g. 2
    '#date_format' => NULL,
    // A custom date format, e.g. %Y-%m-%d
    '#prefix' => NULL,
    '#suffix' => NULL,
  );
  $info['chart_data_item'] = array(
    '#data' => NULL,
    '#color' => NULL,
    '#title' => NULL,
  );
  return $info;
}