You are here

public function Google::chartsGoogleVisualizationType in Charts 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/charts_google/src/Plugin/chart/Library/Google.php \Drupal\charts_google\Plugin\chart\Library\Google::chartsGoogleVisualizationType()

Utility to convert a Drupal renderable type to a Google visualization type.

1 call to Google::chartsGoogleVisualizationType()
Google::preRender in modules/charts_google/src/Plugin/chart/Library/Google.php
Pre render.

File

modules/charts_google/src/Plugin/chart/Library/Google.php, line 69

Class

Google
Define a concrete class for a Chart.

Namespace

Drupal\charts_google\Plugin\chart\Library

Code

public function chartsGoogleVisualizationType($renderable_type) {
  $types = [
    'area' => 'AreaChart',
    'bar' => 'BarChart',
    'column' => 'ColumnChart',
    'line' => 'LineChart',
    'spline' => 'SplineChart',
    'pie' => 'PieChart',
    'donut' => 'DonutChart',
    'gauge' => 'Gauge',
    'scatter' => 'ScatterChart',
    'geo' => 'GeoChart',
  ];
  \Drupal::moduleHandler()
    ->alter('charts_google_visualization_types', $types);
  return isset($types[$renderable_type]) ? $types[$renderable_type] : FALSE;
}