class ChartsTypeInfo in Charts 8.3
Hierarchy
- class \Drupal\charts\Settings\ChartsTypeInfo uses StringTranslationTrait
Expanded class hierarchy of ChartsTypeInfo
5 files declare their use of ChartsTypeInfo
- ChartsBaseSettingsForm.php in src/Settings/ ChartsBaseSettingsForm.php 
- ChartsBaseSettingsFormTest.php in tests/src/ Unit/ Settings/ ChartsBaseSettingsFormTest.php 
- ChartsPluginStyleChart.php in src/Plugin/ views/ style/ ChartsPluginStyleChart.php 
- ChartsTypeInfoTest.php in tests/src/ Unit/ Settings/ ChartsTypeInfoTest.php 
- ExposedChartType.php in src/Plugin/ views/ field/ ExposedChartType.php 
File
- src/Settings/ ChartsTypeInfo.php, line 8 
Namespace
Drupal\charts\SettingsView source
class ChartsTypeInfo {
  use StringTranslationTrait;
  public function __construct() {
    $translation = \Drupal::service('string_translation');
    $this
      ->setStringTranslation($translation);
  }
  /**
   * Get charts types info.
   *
   * @return array
   *   Chart types.
   */
  public function chartsChartsTypeInfo() {
    $chart_types['area'] = [
      'label' => $this
        ->t('Area'),
      'axis' => ChartsInterface::CHARTS_DUAL_AXIS,
      'stacking' => TRUE,
    ];
    $chart_types['bar'] = [
      'label' => $this
        ->t('Bar'),
      'axis' => ChartsInterface::CHARTS_DUAL_AXIS,
      'axis_inverted' => TRUE,
      'stacking' => TRUE,
    ];
    $chart_types['column'] = [
      'label' => $this
        ->t('Column'),
      'axis' => ChartsInterface::CHARTS_DUAL_AXIS,
      'stacking' => TRUE,
    ];
    $chart_types['donut'] = [
      'label' => $this
        ->t('Donut'),
      'axis' => ChartsInterface::CHARTS_SINGLE_AXIS,
    ];
    $chart_types['gauge'] = [
      'label' => $this
        ->t('Gauge'),
      'axis' => ChartsInterface::CHARTS_SINGLE_AXIS,
      'stacking' => FALSE,
    ];
    $chart_types['line'] = [
      'label' => $this
        ->t('Line'),
      'axis' => ChartsInterface::CHARTS_DUAL_AXIS,
    ];
    $chart_types['pie'] = [
      'label' => $this
        ->t('Pie'),
      'axis' => ChartsInterface::CHARTS_SINGLE_AXIS,
    ];
    $chart_types['scatter'] = [
      'label' => $this
        ->t('Scatter'),
      'axis' => ChartsInterface::CHARTS_DUAL_AXIS,
    ];
    $chart_types['spline'] = [
      'label' => $this
        ->t('Spline'),
      'axis' => ChartsInterface::CHARTS_DUAL_AXIS,
    ];
    return $chart_types;
  }
  public function getChartTypes() {
    $chart_types = $this
      ->chartsChartsTypeInfo();
    $type_options = [];
    foreach ($chart_types as $chart_type => $chart_type_info) {
      $type_options[$chart_type] = $chart_type_info['label'];
    }
    return $type_options;
  }
  /**
   * Retrieve a specific chart type.
   *
   * @param string $chart_type
   *   The type of chart selected for display.
   *
   * @return mixed
   *   If not false, returns an array of values from charts_charts_type_info.
   */
  public function getChartType($chart_type) {
    $types = $this
      ->chartsChartsTypeInfo();
    return isset($types[$chart_type]) ? $types[$chart_type] : FALSE;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| ChartsTypeInfo:: | public | function | Get charts types info. | |
| ChartsTypeInfo:: | public | function | Retrieve a specific chart type. | |
| ChartsTypeInfo:: | public | function | ||
| ChartsTypeInfo:: | public | function | ||
| StringTranslationTrait:: | protected | property | The string translation service. | 1 | 
| StringTranslationTrait:: | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait:: | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait:: | protected | function | Gets the string translation service. | |
| StringTranslationTrait:: | public | function | Sets the string translation service to use. | 2 | 
| StringTranslationTrait:: | protected | function | Translates a string to the current language or to a given language. | 
