You are here

ChartData.php in Charts 5.0.x

Same filename and directory in other branches
  1. 8.4 src/Element/ChartData.php

File

src/Element/ChartData.php
View source
<?php

namespace Drupal\charts\Element;

use Drupal\Core\Render\Element\RenderElement;

/**
 * Provides a chart data render element.
 *
 * @RenderElement("chart_data")
 */
class ChartData extends RenderElement {

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

}

Classes

Namesort descending Description
ChartData Provides a chart data render element.