From e1d1f832479acd946a1f6810e566ceb375791a72 Mon Sep 17 00:00:00 2001
From: Daniel Cothran <daniel@andile.co>
Date: Tue, 5 Dec 2017 19:59:46 -0600
Subject: [PATCH] Issue #2879533 by lbaran: Improve Charts code documentation

---
 charts.api.php                                |  37 +-
 charts.module                                 |  13 +-
 charts.permissions.yml                        |   5 +-
 charts.routing.yml                            |   4 +-
 charts.services.yml                           |   3 -
 includes/charts.pages.inc                     |  57 ++-
 modules/charts_api_example/README.txt         |   2 +-
 .../charts_api_example.info.yml               |   6 +-
 .../charts_api_example.libraries.yml          |   4 -
 .../charts_api_example.module                 |  35 +-
 .../charts_api_example.routing.yml            |   2 +-
 .../js/charts_api_example.js                  |   0
 .../src/Controller/ChartsApiExample.php       |  28 +-
 .../templates/charts_api_example.html.twig    |   5 +-
 modules/charts_c3/charts_c3.info.yml          |   4 +-
 modules/charts_c3/charts_c3.libraries.yml     |  35 +-
 .../charts_c3/src/Charts/C3ChartsRender.php   |  27 +-
 modules/charts_google/charts_google.info.yml  |   4 +-
 .../charts_google/charts_google.libraries.yml |  21 +-
 modules/charts_google/charts_google.module    |   6 +-
 modules/charts_google/js/charts_google.js     |   9 +-
 .../src/Charts/GoogleChartsRender.php         |  50 ++-
 .../src/Settings/Google/ChartAxis.php         | 386 ++++++++++++++++++
 .../src/Settings/Google/GoogleOptions.php     |  43 +-
 .../src/Settings/Google/HorizontalAxis.php    | 374 +----------------
 .../src/Settings/Google/VerticalAxis.php      | 374 +----------------
 .../charts_highcharts.module                  |   8 +-
 .../src/Charts/HighchartsChartsRender.php     |  29 +-
 .../src/Settings/Highcharts/Chart.php         |  67 ++-
 src/Charts/ChartsRenderInterface.php          |  24 +-
 src/Charts/ModuleSelector.php                 |  68 ++-
 src/Form/ChartsConfigForm.php                 |   2 +-
 .../display/ChartsPluginDisplayChart.php      |  39 +-
 .../views/style/ChartsPluginStyleChart.php    |  77 ++--
 src/Services/ChartAttachmentService.php       |  11 +-
 .../ChartAttachmentServiceInterface.php       |  18 +-
 src/Services/ChartService.php                 |  13 +-
 src/Services/ChartServiceInterface.php        |  15 +-
 src/Services/ChartsSettingsService.php        |  12 +
 .../ChartsSettingsServiceInterface.php        |  14 +-
 src/Util/Util.php                             |  67 ++-
 41 files changed, 913 insertions(+), 1085 deletions(-)
 delete mode 100644 modules/charts_api_example/charts_api_example.libraries.yml
 delete mode 100644 modules/charts_api_example/js/charts_api_example.js
 create mode 100644 modules/charts_google/src/Settings/Google/ChartAxis.php

diff --git a/charts.api.php b/charts.api.php
index cdd8c6a..8247270 100644
--- a/charts.api.php
+++ b/charts.api.php
@@ -50,15 +50,15 @@ use Drupal\charts\Theme\ChartsInterface;
  * chart_data, chart_xaxis, and chart_yaxis). For a full list, see the
  * charts_element_info() function.
  *
- *
  * @see charts_element_info()
- *
- *
+ */
+
+/**
  * Alter an individual chart before it is printed.
  *
- * @param $chart
+ * @param array $chart
  *   The chart renderable. Passed in by reference.
- * @param $chart_id
+ * @param string $chart_id
  *   The chart identifier, pulled from the $chart['#chart_id'] property (if
  *   any). Not all charts have a chart identifier.
  */
@@ -76,9 +76,12 @@ function hook_chart_alter(&$chart, $chart_id) {
  * name instead of being passed in as an argument.
  *
  * @see hook_chart_alter()
- * @param $chart
+ *
+ * @param array $chart
+ *   Chart.
  */
 function hook_chart_CHART_ID_alter(&$chart) {
+  
 }
 
 /**
@@ -93,13 +96,14 @@ function hook_chart_CHART_ID_alter(&$chart) {
  * Even though this hook may be fragile, it may provide developers with access
  * to library-specific functionality.
  *
- * @param $definition
+ * @param array $definition
  *   The chart definition to be modified. The raw values are passed directly to
  *   the charting library.
- * @param $chart
+ * @param array $chart
  *   The chart renderable. This may be used for reference (or read to add
  *   support for new properties), but any changes to this variable will not
  *   have an effect on output.
+ *
  * @internal param $chart_id The chart ID, derived from the $chart['#chart_id'] property. Note that not*   The chart ID, derived from the $chart['#chart_id'] property. Note that not
  *   all charts may have a $chart_id.
  */
@@ -111,8 +115,10 @@ function hook_chart_definition_alter(&$definition, $chart) {
  *
  * Same as hook_chart_definition_alter(), only including the $chart_id in the
  * function name instead of being passed in as an argument.
- * @see hook_chart_definition_alter()
- * @param $chart
+ * @see hook_chart_definition_alter().
+ *
+ * @param array $chart
+ *   Chart.
  */
 function hook_chart_definition_CHART_ID_alter(&$chart) {
 }
@@ -143,7 +149,9 @@ function hook_charts_info() {
  *
  * If your module needs to modify the capabilities of a charting library, such
  * as to add support for a new chart type, it may do so with this hook.
- * @param $info
+ *
+ * @param array $info
+ *   Info.
  */
 function hook_charts_info_alter(&$info) {
   // Say the Google charts library supports geo charts.
@@ -167,7 +175,8 @@ function hook_charts_type_info() {
     // 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.
+    // Meaning x/y axis are flipped.
+    'axis_inverted' => TRUE,
     // For bar/area/other charts that support stacking of series, set this value
     // to TRUE.
     'stacking' => TRUE,
@@ -180,7 +189,9 @@ function hook_charts_type_info() {
  *
  * If your module needs to modify the capabilities or labels of a paricular
  * chart type, it may alter the definitions provided by other modules.
- * @param $chart_types
+ *
+ * @param array $chart_types
+ *   Chart Types.
  */
 function hook_charts_type_info_alter(&$chart_types) {
   $chart_types['bar']['stacking'] = FALSE;
diff --git a/charts.module b/charts.module
index 95c1562..cce6439 100644
--- a/charts.module
+++ b/charts.module
@@ -2,14 +2,14 @@
 
 /**
  * @file
- * Charts module file that provides hook_theme.
+ * Charts - Module.
  */
 
 use Drupal\charts\Util\Util;
 use Drupal\charts\Charts\ModuleSelector;
 
 /**
- * {@inheritdoc}
+ * Implements hook_theme().
  */
 function charts_theme($existing, $type, $theme, $path) {
 
@@ -17,14 +17,14 @@ function charts_theme($existing, $type, $theme, $path) {
     'views_view_charts' => [
       'variables' => [
         'view' => NULL,
-        'row' => NULL,
+        'row'  => NULL,
       ],
     ],
   ];
 }
 
 /**
- * {@inheritdoc}
+ * Implements template_preprocess_views_view_charts().
  */
 function template_preprocess_views_view_charts(&$variables) {
 
@@ -91,6 +91,9 @@ function template_preprocess_views_view_charts(&$variables) {
     $attachmentDisplayOptions[$i]['inherit_yaxis'] = $view->displayHandlers->get($attachmentId)->options['inherit_yaxis'];
   }
   $seriesData = array_merge($seriesData, $seriesDataAttachment);
-  $moduleSelector = new ModuleSelector($library, $categories, $seriesData, $options, $attachmentDisplayOptions, $variables, $chartId);
+  $moduleSelector = new ModuleSelector($library, $categories, $seriesData, $options, $attachmentDisplayOptions, $chartId);
+  if ($moduleSelector->moduleExists()) {
+    $moduleSelector->buildVariables($variables);
+  }
 
 }
diff --git a/charts.permissions.yml b/charts.permissions.yml
index cc35295..9c2bd40 100644
--- a/charts.permissions.yml
+++ b/charts.permissions.yml
@@ -1,5 +1,4 @@
-# In charts.permissions.yml file.
-access all charts:
+'access all charts':
   title: 'Administer Charts'
   description: 'This permission needs to be fleshed out.'
-  restrict access: TRUE
+  'restrict access': true
diff --git a/charts.routing.yml b/charts.routing.yml
index 4830d22..31fabb7 100644
--- a/charts.routing.yml
+++ b/charts.routing.yml
@@ -1,7 +1,7 @@
 charts.settings:
-  path: '/admin/config/content/charts'
+  path: /admin/config/content/charts
   defaults:
-    _form: 'Drupal\charts\Form\ChartsConfigForm'
+    _form: Drupal\charts\Form\ChartsConfigForm
     _title: 'Default chart configuration'
   requirements:
     _permission: 'administer site configuration'
diff --git a/charts.services.yml b/charts.services.yml
index cda6738..5320eb5 100644
--- a/charts.services.yml
+++ b/charts.services.yml
@@ -1,13 +1,10 @@
 services:
   charts.charts_service:
     class: Drupal\charts\Services\ChartService
-
   charts.charts_attachment:
     class: Drupal\charts\Services\ChartAttachmentService
-
   charts.views_variable:
     class: Drupal\charts\Services\ViewsDataService
-
   charts.settings:
     class: Drupal\charts\Services\ChartsSettingsService
     arguments: ['@config.factory']
diff --git a/includes/charts.pages.inc b/includes/charts.pages.inc
index c9affb5..dfc80f3 100644
--- a/includes/charts.pages.inc
+++ b/includes/charts.pages.inc
@@ -244,7 +244,7 @@ function charts_settings_form($form, $defaults = [], $field_options = [], $paren
 
   // Set data attributes to identify special properties of different types.
   foreach ($chart_types as $chart_type => $chart_type_info) {
-    if ($chart_type_info['axis_inverted']) {
+    if (isset($chart_type_info['axis_inverted']) && $chart_type_info['axis_inverted']) {
       $form['type'][$chart_type]['#attributes']['data-axis-inverted'] = TRUE;
     }
     if ($chart_type_info['axis'] === ChartsInterface::CHARTS_SINGLE_AXIS) {
@@ -256,7 +256,6 @@ function charts_settings_form($form, $defaults = [], $field_options = [], $paren
     $first_field = key($field_options);
 
     // $form['#theme'] = 'charts_settings_fields';
-
     $form['fields'] = [
       '#title' => t('Charts fields'),
       '#type' => 'fieldset',
@@ -602,34 +601,34 @@ function charts_default_settings_form_submit($form, $form_state) {
  * Provides default options used by charts_settings_form().
  */
 function charts_default_settings() {
-  $defaults = [];
-  $defaults['type'] = 'pie';
-  $defaults['library'] = NULL;
-  $defaults['label_field'] = NULL;
-  $defaults['data_fields'] = NULL;
-  $defaults['field_colors'] = NULL;
-  $defaults['title'] = '';
-  $defaults['title_position'] = 'out';
-  $defaults['data_labels'] = FALSE;
-  $defaults['legend'] = TRUE;
-  $defaults['legend_position'] = 'right';
-  $defaults['colors'] = charts_default_colors();
-  $defaults['background'] = '';
-  $defaults['tooltips'] = TRUE;
-  $defaults['tooltips_use_html'] = FALSE;
-  $defaults['width'] = NULL;
-  $defaults['height'] = NULL;
-  $defaults['xaxis_title'] = '';
-  $defaults['xaxis_labels_rotation'] = 0;
-  $defaults['yaxis_title'] = '';
-  $defaults['yaxis_min'] = '';
-  $defaults['yaxis_max'] = '';
-  $defaults['yaxis_prefix'] = '';
-  $defaults['yaxis_suffix'] = '';
-  $defaults['yaxis_decimal_count'] = '';
-  $defaults['yaxis_labels_rotation'] = 0;
+  $defaults = [
+    'type'                  => 'pie',
+    'library'               => NULL,
+    'label_field'           => NULL,
+    'data_fields'           => NULL,
+    'field_colors'          => NULL,
+    'title'                 => '',
+    'title_position'        => 'out',
+    'data_labels'           => FALSE,
+    'legend'                => TRUE,
+    'legend_position'       => 'right',
+    'colors'                => charts_default_colors(),
+    'background'            => '',
+    'tooltips'              => TRUE,
+    'tooltips_use_html'     => FALSE,
+    'width'                 => NULL,
+    'height'                => NULL,
+    'xaxis_title'           => '',
+    'xaxis_labels_rotation' => 0,
+    'yaxis_title'           => '',
+    'yaxis_min'             => '',
+    'yaxis_max'             => '',
+    'yaxis_prefix'          => '',
+    'yaxis_suffix'          => '',
+    'yaxis_decimal_count'   => '',
+    'yaxis_labels_rotation' => 0,
+  ];
 
   Drupal::moduleHandler()->alter('charts_default_settings', $defaults);
   return $defaults;
 }
-
diff --git a/modules/charts_api_example/README.txt b/modules/charts_api_example/README.txt
index 9bf15bf..cd739e3 100644
--- a/modules/charts_api_example/README.txt
+++ b/modules/charts_api_example/README.txt
@@ -5,4 +5,4 @@ To see the example, navigate to:
 Settings for this chart derive from the Charts module's 
 default settings, which are configured here:
 
-/admin/config/content/charts
\ No newline at end of file
+/admin/config/content/charts
diff --git a/modules/charts_api_example/charts_api_example.info.yml b/modules/charts_api_example/charts_api_example.info.yml
index 45bcce2..7ee00e3 100644
--- a/modules/charts_api_example/charts_api_example.info.yml
+++ b/modules/charts_api_example/charts_api_example.info.yml
@@ -1,7 +1,7 @@
-name: Charts API Example
+name: 'Charts API Example'
 type: module
-description: Demonstrates how to use the Charts module without Views.
+description: 'Demonstrates how to use the Charts module without Views.'
 core: 8.x
 package: Examples
 dependencies:
-  - charts:charts
+  - 'charts:charts'
diff --git a/modules/charts_api_example/charts_api_example.libraries.yml b/modules/charts_api_example/charts_api_example.libraries.yml
deleted file mode 100644
index fe456cc..0000000
--- a/modules/charts_api_example/charts_api_example.libraries.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-charts_api_examples:
-  version: 1.x
-  js:
-    js/charts_api_example.js: {}
\ No newline at end of file
diff --git a/modules/charts_api_example/charts_api_example.module b/modules/charts_api_example/charts_api_example.module
index ad96ecc..1c5d099 100644
--- a/modules/charts_api_example/charts_api_example.module
+++ b/modules/charts_api_example/charts_api_example.module
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains charts_api_example.module.
+ * Charts Api Example - Module.
  */
 
 use Drupal\Core\Routing\RouteMatchInterface;
@@ -12,41 +12,40 @@ use Drupal\charts\Charts\ModuleSelector;
  * Implements hook_help().
  */
 function charts_api_example_help($route_name, RouteMatchInterface $route_match) {
+  $output = '';
   switch ($route_name) {
     // Main module help for the charts_api_example module.
     case 'help.page.charts_api_example':
-      $output = '';
       $output .= '<h3>' . t('About') . '</h3>';
       $output .= '<p>' . t('A simple example on how to interact with the Charts API') . '</p>';
-      return $output;
-
-    default:
+      break;
   }
+  return $output;
 }
 
 /**
  * Implements hook_theme().
  */
 function charts_api_example_theme() {
-  $vars = [
-    'library' => '',
-    'categories' => '',
-    'seriesData' => '',
-    'options' => '',
-  ];
   return [
     'charts_api_example' => [
-      'template' => 'charts_api_example',
-      'variables' => $vars,
+      'template'  => 'charts_api_example',
+      'variables' => [
+        'library'    => '',
+        'categories' => [],
+        'seriesData' => [],
+        'options'    => [],
+      ],
     ],
   ];
 }
 
 /**
- * Implements template_preprocess_page
- *
- * @param $variables
+ * Implements template_preprocess_charts_api_example().
  */
 function template_preprocess_charts_api_example(&$variables) {
-  $moduleSelector = new ModuleSelector($variables['library'], $variables['categories'], $variables['seriesData'], $variables['options'], [], $variables, 'xyz');
-}
\ No newline at end of file
+  $moduleSelector = new ModuleSelector($variables['library'], $variables['categories'], $variables['seriesData'], $variables['options'], [], 'xyz');
+  if ($moduleSelector->moduleExists()) {
+    $moduleSelector->buildVariables($variables);
+  }
+}
diff --git a/modules/charts_api_example/charts_api_example.routing.yml b/modules/charts_api_example/charts_api_example.routing.yml
index 23e12cd..b24a89d 100644
--- a/modules/charts_api_example/charts_api_example.routing.yml
+++ b/modules/charts_api_example/charts_api_example.routing.yml
@@ -1,5 +1,5 @@
 charts_api_example.display:
-  path: '/charts/example/display'
+  path: /charts/example/display
   defaults:
     _controller: '\Drupal\charts_api_example\Controller\ChartsApiExample::display'
     _title: 'How to use the Charts API'
diff --git a/modules/charts_api_example/js/charts_api_example.js b/modules/charts_api_example/js/charts_api_example.js
deleted file mode 100644
index e69de29..0000000
diff --git a/modules/charts_api_example/src/Controller/ChartsApiExample.php b/modules/charts_api_example/src/Controller/ChartsApiExample.php
index b5ff641..835d1a0 100644
--- a/modules/charts_api_example/src/Controller/ChartsApiExample.php
+++ b/modules/charts_api_example/src/Controller/ChartsApiExample.php
@@ -47,20 +47,35 @@ class ChartsApiExample extends ControllerBase implements ContainerInjectionInter
     ];
 
     // Sample data format.
-    $categories = ["Category 1", "Category 2", "Category 3", "Category 4"];
+    $categories = ['Category 1', 'Category 2', 'Category 3', 'Category 4'];
     $seriesData = [
-      ["name" => "Series 1", "color" => "#0d233a", "type" => null, "data" => [250, 350, 400, 200]],
-      ["name" => "Series 2", "color" => "#8bbc21", "type" => "column", "data" => [150, 450, 500, 300]],
-      ["name" => "Series 3", "color" => "#910000", "type" => "area", "data" => [0, 0, 60, 90]]
+      [
+        'name'  => 'Series 1',
+        'color' => '#0d233a',
+        'type'  => NULL,
+        'data'  => [250, 350, 400, 200],
+      ], [
+        'name'  => 'Series 2',
+        'color' => '#8bbc21',
+        'type'  => 'column',
+        'data'  => [150, 450, 500, 300],
+      ], [
+        'name'  => 'Series 3',
+        'color' => '#910000',
+        'type'  => 'area',
+        'data'  => [0, 0, 60, 90],
+      ],
     ];
 
-    return [
+    $build = [
       '#theme'      => 'charts_api_example',
       '#library'    => (string) $library,
       '#categories' => $categories,
       '#seriesData' => $seriesData,
       '#options'    => $options,
     ];
+    
+    return $build;
   }
 
   /**
@@ -71,4 +86,5 @@ class ChartsApiExample extends ControllerBase implements ContainerInjectionInter
       $container->get('charts.settings')
     );
   }
-}
\ No newline at end of file
+
+}
diff --git a/modules/charts_api_example/templates/charts_api_example.html.twig b/modules/charts_api_example/templates/charts_api_example.html.twig
index 898a5cf..49e1b81 100644
--- a/modules/charts_api_example/templates/charts_api_example.html.twig
+++ b/modules/charts_api_example/templates/charts_api_example.html.twig
@@ -1,7 +1,6 @@
 {% set library = 'charts_' ~ chart_type ~ '/' ~ chart_type %}
 {{ attach_library("#{ library }") }}
 <p>Edit charts_api_example.html.twig to delete this message. To change the
-   library used by this file, change the <a href="/admin/config/content/charts">
-        default settings
-    </a>.</p>
+   library used by this file, change the <a href="{{ url('charts.settings',{}) }}">default settings</a>.
+</p>
 <div {{ attributes }} {{ content_attributes }} style="width:100%; height:400px;"></div>
diff --git a/modules/charts_c3/charts_c3.info.yml b/modules/charts_c3/charts_c3.info.yml
index ee14a3f..9ae4bc0 100644
--- a/modules/charts_c3/charts_c3.info.yml
+++ b/modules/charts_c3/charts_c3.info.yml
@@ -1,7 +1,7 @@
-name: C3 Charts
+name: 'C3 Charts'
 type: module
 description: 'Charts module integration with C3 Charts.'
 package: Charts
 core: 8.x
 dependencies:
-  - charts:charts
+  - 'charts:charts'
diff --git a/modules/charts_c3/charts_c3.libraries.yml b/modules/charts_c3/charts_c3.libraries.yml
index 2db5b68..f9bbac2 100644
--- a/modules/charts_c3/charts_c3.libraries.yml
+++ b/modules/charts_c3/charts_c3.libraries.yml
@@ -1,33 +1,32 @@
 charts_c3:
   version: 1.x
   js:
-    js/charts_c3.js: {}
+    js/charts_c3.js: {  }
   dependencies:
-        - core/jquery
-        - core/jquery.once
-        - core/drupal
+    - core/jquery
+    - core/jquery.once
+    - core/drupal
 d3:
-  remote: https://d3js.org/d3.v3.min.js
+  remote: 'https://d3js.org/d3.v3.min.js'
   version: 3
   license:
-        name: BSD
-        url: https://en.wikipedia.org/wiki/BSD_licenses
-        gpl-compatible: false
+    name: BSD
+    url: 'https://en.wikipedia.org/wiki/BSD_licenses'
+    gpl-compatible: false
   js:
-    vendor/dthree/d3.v3.min.js: {}
-
+    vendor/dthree/d3.v3.min.js: {  }
 c3:
-  remote: https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js
+  remote: 'https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js'
   version: 0.4.11
   license:
-        name: MIT
-        url: https://opensource.org/licenses/MIT
-        gpl-compatible: true
+    name: MIT
+    url: 'https://opensource.org/licenses/MIT'
+    gpl-compatible: true
   css:
     theme:
-      vendor/cthree/css/c3.min.css: {}
+      vendor/cthree/css/c3.min.css: {  }
   js:
-    vendor/cthree/c3.min.js: {}
+    vendor/cthree/c3.min.js: {  }
   dependencies:
-        - charts_c3/charts_c3
-        - charts_c3/d3
\ No newline at end of file
+    - charts_c3/charts_c3
+    - charts_c3/d3
diff --git a/modules/charts_c3/src/Charts/C3ChartsRender.php b/modules/charts_c3/src/Charts/C3ChartsRender.php
index 1931a89..5c1ee8e 100644
--- a/modules/charts_c3/src/Charts/C3ChartsRender.php
+++ b/modules/charts_c3/src/Charts/C3ChartsRender.php
@@ -11,31 +11,33 @@ use Drupal\charts_c3\Settings\CThree\ChartData;
 use Drupal\charts_c3\Settings\CThree\ChartColor;
 use Drupal\charts_c3\Settings\CThree\ChartAxis;
 
+/**
+ * C3 Charts Render.
+ */
 class C3ChartsRender implements ChartsRenderInterface {
 
+  /**
+   * Construct.
+   */
   public function __construct() {
     Util::checkMissingLibrary('charts_c3', '/vendor/cthree/c3.min.js');
   }
 
   /**
-   * @param $options
-   * @param array $categories
-   * @param array $seriesData
-   * @param $chartId
-   * @param array $attachmentDisplayOptions
-   *
-   * @return CThree
+   * {@inheritdoc}
    */
-  public function charts_render_charts($options, $categories = [], $seriesData = [], $attachmentDisplayOptions = [], &$variables, $chartId) {
+  public function chartsRenderCharts(array $options = [], array $categories = [], array $seriesData = [], array $attachmentDisplayOptions = [],array &$variables = [], $chartId = '') {
     $noAttachmentDisplays = count($attachmentDisplayOptions) === 0;
     $types = [];
 
     // @todo - make this work for more that one attachment.
     for ($i = 1; $i <= count($attachmentDisplayOptions); $i++) {
-      if ($attachmentDisplayOptions[$i - 1]['style']['options']['type'] == 'column')
+      if ($attachmentDisplayOptions[$i - 1]['style']['options']['type'] == 'column') {
         $types[$seriesData[$i]['name']] = 'bar';
-      else
+      }
+      else {
         $types[$seriesData[$i]['name']] = $attachmentDisplayOptions[$i - 1]['style']['options']['type'];
+      }
     }
     $c3Data = [];
     for ($i = 0; $i < count($seriesData); $i++) {
@@ -61,14 +63,14 @@ class C3ChartsRender implements ChartsRenderInterface {
     // Sets the primary y axis.
     $yAxis = [];
     $yAxis[$seriesData[0]['name']] = 'y';
-    $showAxis['show'] = true;
+    $showAxis['show'] = TRUE;
     $showAxis['label'] = $options['yaxis_title'];
     $chartAxis->y = $showAxis;
 
     // Sets secondary axis from the first attachment only.
     if (!$noAttachmentDisplays && $attachmentDisplayOptions[0]['inherit_yaxis'] == 0) {
       $yAxis[$seriesData[1]['name']] = 'y2';
-      $showSecAxis['show'] = true;
+      $showSecAxis['show'] = TRUE;
       $showSecAxis['label'] = $attachmentDisplayOptions[0]['style']['options']['yaxis_title'];
       $chartAxis->y2 = $showSecAxis;
     }
@@ -117,4 +119,5 @@ class C3ChartsRender implements ChartsRenderInterface {
     $variables['attributes']['id'][0] = $chartId;
     $variables['attributes']['class'][] = 'charts-c3';
   }
+
 }
diff --git a/modules/charts_google/charts_google.info.yml b/modules/charts_google/charts_google.info.yml
index 7d321e1..0d8ffa1 100644
--- a/modules/charts_google/charts_google.info.yml
+++ b/modules/charts_google/charts_google.info.yml
@@ -1,7 +1,7 @@
-name: Google Charts
+name: 'Google Charts'
 type: module
 description: 'Charts module integration with Google Charts.'
 package: Charts
 core: 8.x
 dependencies:
-  - charts:charts
+  - 'charts:charts'
diff --git a/modules/charts_google/charts_google.libraries.yml b/modules/charts_google/charts_google.libraries.yml
index d5a6e0f..8641261 100644
--- a/modules/charts_google/charts_google.libraries.yml
+++ b/modules/charts_google/charts_google.libraries.yml
@@ -1,20 +1,19 @@
 charts_google:
   version: 1.x
   js:
-    js/charts_google.js: {}
+    js/charts_google.js: {  }
   dependencies:
-        - core/jquery
-        - core/jquery.once
-        - core/drupal
-
+    - core/jquery
+    - core/jquery.once
+    - core/drupal
 google:
-  remote: https://www.gstatic.com/charts/loader.js
+  remote: 'https://www.gstatic.com/charts/loader.js'
   version: VERSION
   license:
-      name: Apache 2.0
-      url: http://www.apache.org/licenses/LICENSE-2.0
-      gpl-compatible: false
+    name: 'Apache 2.0'
+    url: 'http://www.apache.org/licenses/LICENSE-2.0'
+    gpl-compatible: false
   js:
-    vendor/google/loader.js: {}
+    vendor/google/loader.js: {  }
   dependencies:
-        - charts_google/charts_google
+    - charts_google/charts_google
diff --git a/modules/charts_google/charts_google.module b/modules/charts_google/charts_google.module
index 50aa6c1..f20e641 100644
--- a/modules/charts_google/charts_google.module
+++ b/modules/charts_google/charts_google.module
@@ -12,10 +12,10 @@ use Drupal\charts\Theme\ChartsInterface;
  */
 function charts_google_charts_info() {
   $info['google'] = [
-    'label' => t('Google Charts'),
+    'label'  => t('Google Charts'),
     'render' => '_charts_google_render',
-    'types' => ['area', 'bar', 'column', 'donut', 'line', 'pie', 'scatter'],
-    'file' => 'charts_google.inc',
+    'types'  => ['area', 'bar', 'column', 'donut', 'line', 'pie', 'scatter'],
+    'file'   => 'charts_google.inc',
   ];
   return $info;
 }
diff --git a/modules/charts_google/js/charts_google.js b/modules/charts_google/js/charts_google.js
index b7d7f23..d72285b 100644
--- a/modules/charts_google/js/charts_google.js
+++ b/modules/charts_google/js/charts_google.js
@@ -6,7 +6,7 @@
 (function ($) {
   'use strict';
 
-  Drupal.googleCharts = Drupal.googleCharts || {'charts': []};
+  Drupal.googleCharts = Drupal.googleCharts || {charts: []};
 
   /**
    * Behavior to initialize Google Charts.
@@ -35,6 +35,8 @@
 
   /**
    * Helper function to draw Google Charts.
+   * 
+   * @param {boolean} reload Reload.
    */
   Drupal.googleCharts.drawCharts = function (reload) {
     $('.charts-google').each(function () {
@@ -64,6 +66,11 @@
 
   /**
    * Helper function to draw a Google Chart.
+   * 
+   * @param {string} chartId - Chart Id.
+   * @param {string} chartType - Chart Type.
+   * @param {string} dataTable - Data.
+   * @param {string} googleChartOptions - Options.
    */
   Drupal.googleCharts.drawChart = function (chartId, chartType, dataTable, googleChartOptions) {
     return function () {
diff --git a/modules/charts_google/src/Charts/GoogleChartsRender.php b/modules/charts_google/src/Charts/GoogleChartsRender.php
index b9d9e53..b83794a 100644
--- a/modules/charts_google/src/Charts/GoogleChartsRender.php
+++ b/modules/charts_google/src/Charts/GoogleChartsRender.php
@@ -10,20 +10,22 @@ use Drupal\charts_google\Settings\Google\ChartArea;
 use Drupal\charts_google\Settings\Google\HorizontalAxis;
 use Drupal\charts_google\Settings\Google\VerticalAxis;
 
+/**
+ * Google Charts Render.
+ */
 class GoogleChartsRender implements ChartsRenderInterface {
 
+  /**
+   * Construct.
+   */
   public function __construct() {
     Util::checkMissingLibrary('charts_google', '/vendor/google/loader.js');
   }
 
   /**
-   * Creates a JSON Object formatted for Google charts to use
-   * @param array $categories
-   * @param array $seriesData
-   *
-   * @return json|string
+   * {@inheritdoc}
    */
-  public function charts_render_charts($options, $categories = [], $seriesData = [], $attachmentDisplayOptions = [], &$variables, $chartId) {
+  public function chartsRenderCharts(array $options = [], array $categories = [], array $seriesData = [], array $attachmentDisplayOptions = [], array &$variables = [], $chartId = '') {
 
     $categoriesCount = count($categories);
     $seriesCount = count($seriesData);
@@ -45,7 +47,7 @@ class GoogleChartsRender implements ChartsRenderInterface {
       array_unshift($rowDataTable, $categories[$j]);
       array_push($dataTable, $rowDataTable);
     }
-
+    
     $dataTableHeader = [];
     for ($r = 0; $r < $seriesCount; $r++) {
       array_push($dataTableHeader, $seriesData[$r]['name']);
@@ -53,23 +55,31 @@ class GoogleChartsRender implements ChartsRenderInterface {
     array_unshift($dataTableHeader, 'label');
     array_unshift($dataTable, $dataTableHeader);
 
-    $googleOptions = $this->charts_google_create_charts_options($options, $seriesData, $attachmentDisplayOptions);
-    $googleChartType = $this->charts_google_create_chart_type($options);
+    $googleOptions = $this->createChartsOptions($options, $seriesData, $attachmentDisplayOptions);
+    $googleChartType = $this->createChartType($options);
     $variables['chart_type'] = 'google';
     $variables['attributes']['class'][0] = 'charts-google';
     $variables['attributes']['id'][0] = $chartId;
     $variables['content_attributes']['data-chart'][] = json_encode($dataTable);
     $variables['attributes']['google-options'][1] = json_encode($googleOptions);
     $variables['attributes']['google-chart-type'][2] = json_encode($googleChartType);
+
   }
 
   /**
-   * @param $options
+   * Create charts options.
+   * 
+   * @param array $options
+   *   Options.
    * @param array $seriesData
+   *   Series data.
    * @param array $attachmentDisplayOptions
-   * @return GoogleOptions object with chart options or settings to be used by google visualization framework
+   *   Attachment Display Options.
+   *
+   * @return \Drupal\charts_google\Settings\Google\GoogleOptions
+   *   GoogleOptions object with chart options or settings to be used by google visualization framework.
    */
-  private function charts_google_create_charts_options($options, $seriesData = [], $attachmentDisplayOptions = []) {
+  private function createChartsOptions(array $options = [], array $seriesData = [], array $attachmentDisplayOptions = []) {
     $noAttachmentDisplays = count($attachmentDisplayOptions) === 0;
 
     $chartSelected = [];
@@ -269,8 +279,8 @@ class GoogleChartsRender implements ChartsRenderInterface {
       $googleOptions->setSubTitle($options['subtitle']);
     }
 
-    $googleOptions->setVAxes($vAxes);
-    $googleOptions->setHAxes($hAxes);
+    $googleOptions->setVerticalAxes($vAxes);
+    $googleOptions->setHorizontalAxes($hAxes);
 
     if (in_array('donut', $chartSelected)) {
       $googleOptions->pieHole = '0.5';
@@ -345,13 +355,19 @@ class GoogleChartsRender implements ChartsRenderInterface {
   }
 
   /**
-   * @param $options
-   * @return ChartType
+   * Create Chart Type.
+   *
+   * @param array $options
+   *   Options.
+   *
+   * @return \Drupal\charts_google\Settings\Google\ChartType
+   *   ChartType.
    */
-  private function charts_google_create_chart_type($options) {
+  private function createChartType(array $options = []) {
     $googleChartType = new ChartType();
     $googleChartType->setChartType($options['type']);
 
     return $googleChartType;
   }
+
 }
diff --git a/modules/charts_google/src/Settings/Google/ChartAxis.php b/modules/charts_google/src/Settings/Google/ChartAxis.php
new file mode 100644
index 0000000..27afcbf
--- /dev/null
+++ b/modules/charts_google/src/Settings/Google/ChartAxis.php
@@ -0,0 +1,386 @@
+<?php
+
+namespace Drupal\charts_google\Settings\Google;
+
+/**
+ * Class ChartAxis.
+ *
+ * @package Drupal\charts_google\Settings\Google
+ *
+ *  Chart Axis options are described here:
+ * @see https://developers.google.com/chart/interactive/docs/gallery/columnchart#configuration-options
+ */
+class ChartAxis implements \JsonSerializable {
+
+  /**
+   * Chart Axis property that specifies a title for the axis.
+   */
+  private $title;
+
+  /**
+   * An array that specifies the axis title text style.
+   */
+  private $titleTextStyle;
+
+  /**
+   * Chart Axis property that specifies the baseline for the axis. If the
+   * baseline is larger than the highest grid line or smaller than the lowest
+   * grid line, it will be rounded to the closest gridline.
+   */
+  private $baseline;
+
+  /**
+   * Specifies the color of the baseline for the axis. Can be any HTML
+   * color string, for example: 'red' or '#00cc00'.
+   */
+  private $baselineColor;
+
+  /**
+   * The direction in which the values along the axis grow. Specify -1
+   * to reverse the order of the values.
+   */
+  private $direction;
+
+  /**
+   * A format string for numeric axis labels.
+   */
+  private $format;
+
+  /**
+   * Position of the axis text, relative to the chart area.
+   * Supported values: 'out', 'in', 'none'.
+   */
+  private $textPosition;
+
+  /**
+   * An array that specifies the axis text style.
+   */
+  private $textStyle;
+
+  /**
+   * Moves the max value of the axis to the specified value; this will
+   * be upward in most charts. Ignored if this is set to a value smaller than
+   * the maximum y-value of the data.
+   */
+  private $maxValue;
+
+  /**
+   * Moves the min value of the axis to the specified value; this will
+   * be downward in most charts. Ignored if this is set to a value greater than
+   * the minimum y-value of the data.
+   */
+  private $minValue = 0;
+
+  /**
+   * Specifies how to scale the axis to render the values within the
+   * chart area.
+   */
+  private $viewWindowMode;
+
+  /**
+   * Specifies the cropping range of the axis.
+   */
+  private $viewWindow;
+
+  /**
+   * Get Chart Axis property that specifies a title for the axis.
+   *
+   * @return mixed
+   */
+  public function getTitle() {
+    return $this->title;
+  }
+
+  /**
+   * Set Chart Axis property that specifies a title for the axis.
+   *
+   * @param $value
+   */
+  public function setTitle($value) {
+    $this->title = $value;
+  }
+
+  /**
+   * Get an array that specifies the axis title text style.
+   *
+   * @return mixed
+   */
+  public function getTitleTextStyle() {
+    return $this->titleTextStyle;
+  }
+
+  /**
+   * Set an array that specifies the axis title text style.
+   *
+   * @param mixed $value
+   */
+  public function setTitleTextStyle($value) {
+    $this->titleTextStyle = $value;
+  }
+
+  /**
+   * Get an array property that specifies the axis title text style.
+   *
+   * @param string $key
+   *   Machine name of the text style property.
+   *
+   * @return mixed
+   */
+  public function getTitleTextStyleValue($key) {
+    return isset($this->titleTextStyle[$key]) ? $this->titleTextStyle[$key] : NULL;
+  }
+
+  /**
+   * Set an array property that specifies the axis title text style.
+   *
+   * @param string $key
+   *   Machine name of the text style property.
+   * @param mixed $value
+   *   Value of the text style property.
+   */
+  public function setTitleTextStyleValue($key, $value) {
+    $this->titleTextStyle[$key] = $value;
+  }
+
+  /**
+   * Get Chart Axis property that specifies the baseline for the axis.
+   *
+   * @return mixed
+   */
+  public function getBaseline() {
+    return $this->baseline;
+  }
+
+  /**
+   * Set Chart Axis property that specifies the baseline for the axis.
+   *
+   * @param mixed $value
+   */
+  public function setBaseline($value) {
+    $this->baseline = $value;
+  }
+
+  /**
+   * Get the color of the baseline for the axis.
+   *
+   * @return mixed
+   */
+  public function getBaselineColor() {
+    return $this->baselineColor;
+  }
+
+  /**
+   * Set the color of the baseline for the axis.
+   *
+   * @param mixed $value
+   */
+  public function setBaselineColor($value) {
+    $this->baselineColor = $value;
+  }
+
+  /**
+   * Get the direction in which the values along the axis grow.
+   *
+   * @return mixed
+   */
+  public function getDirection() {
+    return $this->direction;
+  }
+
+  /**
+   * Set the direction in which the values along the axis grow.
+   *
+   * @param mixed $value
+   */
+  public function setDirection($value) {
+    $this->direction = $value;
+  }
+
+  /**
+   * Get the format string for numeric axis labels
+   *
+   * @return mixed
+   */
+  public function getFormat() {
+    return $this->format;
+  }
+
+  /**
+   * Set a format string for numeric axis labels
+   *
+   * @param mixed $value
+   */
+  public function setFormat($value) {
+    $this->format = $value;
+  }
+
+  /**
+   * Get the position of the axis text, relative to the chart area.
+   *
+   * @return mixed
+   */
+  public function getTextPosition() {
+    return $this->textPosition;
+  }
+
+  /**
+   * Set the position of the axis text, relative to the chart area.
+   *
+   * @param mixed $value
+   */
+  public function setTextPosition($value) {
+    $this->textPosition = $value;
+  }
+
+  /**
+   * Get an array that specifies the axis text style.
+   *
+   * @return mixed
+   */
+  public function getTextStyle() {
+    return $this->textStyle;
+  }
+
+  /**
+   * Set an array that specifies the axis text style.
+   *
+   * @param mixed $value
+   */
+  public function setTextStyle($value) {
+    $this->textStyle = $value;
+  }
+
+  /**
+   * Get an array property that specifies the axis text style.
+   *
+   * @param string $key
+   *   Machine name of the text style property.
+   *
+   * @return mixed
+   */
+  public function getTextStyleValue($key) {
+    return isset($this->textStyle[$key]) ? $this->textStyle[$key] : NULL;
+  }
+
+  /**
+   * Set an array property that specifies the axis text style.
+   *
+   * @param string $key
+   *   Machine name of the text style property.
+   * @param mixed $value
+   *   Value of the text style property.
+   */
+  public function setTextStyleValue($key, $value) {
+    $this->textStyle[$key] = $value;
+  }
+
+  /**
+   * Get the max value of the axis.
+   *
+   * @return mixed
+   */
+  public function getMaxValue() {
+    return $this->maxValue;
+  }
+
+  /**
+   * Set the max value of the axis.
+   *
+   * @param mixed $value
+   */
+  public function setMaxValue($value) {
+    $this->maxValue = $value;
+  }
+
+  /**
+   * Get the min value of the axis.
+   *
+   * @return mixed
+   */
+  public function getMinValue() {
+    return $this->minValue;
+  }
+
+  /**
+   * Set the min value of the axis.
+   *
+   * @param mixed $value
+   */
+  public function setMinValue($value) {
+    $this->minValue = $value;
+  }
+
+  /**
+   * Get the value that specifies how to scale the axis to render the
+   * values within the chart area.
+   *
+   * @return mixed
+   */
+  public function getViewWindowMode() {
+    return $this->viewWindowMode;
+  }
+
+  /**
+   * Set the value that specifies how to scale the axis to render the
+   * values within the chart area.
+   *
+   * @param mixed $value
+   */
+  public function setViewWindowMode($value) {
+    $this->viewWindowMode = $value;
+  }
+
+  /**
+   * Get an array that specifies the cropping range of the axis.
+   *
+   * @return mixed
+   */
+  public function getViewWindow() {
+    return $this->viewWindow;
+  }
+
+  /**
+   * Set an array that specifies the cropping range of the axis.
+   *
+   * @param mixed $value
+   */
+  public function setViewWindow($value) {
+    $this->viewWindow = $value;
+  }
+
+  /**
+   * Get an array property that specifies the the cropping range of the
+   * axis.
+   *
+   * @param string $key
+   *   Property key.
+   *
+   * @return mixed
+   */
+  public function getViewWindowValue($key) {
+    return isset($this->viewWindow[$key]) ? $this->viewWindow[$key] : NULL;
+  }
+
+  /**
+   * Set an array property that specifies the cropping range of the horizontal
+   * axis.
+   *
+   * @param string $key
+   *   Property key.
+   * @param mixed $value
+   *   Property value.
+   */
+  public function setViewWindowValue($key, $value) {
+    $this->viewWindow[$key] = $value;
+  }
+
+  /**
+   * @return array
+   */
+  public function jsonSerialize() {
+    $vars = get_object_vars($this);
+    return $vars;
+  }
+
+}
+
diff --git a/modules/charts_google/src/Settings/Google/GoogleOptions.php b/modules/charts_google/src/Settings/Google/GoogleOptions.php
index ac79f5f..042b035 100644
--- a/modules/charts_google/src/Settings/Google/GoogleOptions.php
+++ b/modules/charts_google/src/Settings/Google/GoogleOptions.php
@@ -71,7 +71,8 @@ class GoogleOptions implements \JsonSerializable {
   /**
    * Gets the title of the Material Chart. Only Material Charts support titles.
    *
-   * @return mixed
+   * @return string
+   *   Title.
    */
   public function getTitle() {
     return $this->title;
@@ -81,6 +82,7 @@ class GoogleOptions implements \JsonSerializable {
    * Sets the title of the Material Chart. Only Material Charts support titles.
    *
    * @param string $title
+   *   Title.
    */
   public function setTitle($title) {
     $this->title = $title;
@@ -90,7 +92,8 @@ class GoogleOptions implements \JsonSerializable {
    * Gets the subtitle of the Material Chart. Only Material Charts support
    * subtitle.
    *
-   * @return mixed
+   * @return string
+   *   Subtitle.
    */
   public function getSubTitle() {
     return $this->subTitle;
@@ -109,7 +112,7 @@ class GoogleOptions implements \JsonSerializable {
   /**
    * Gets the position of chart title.
    *
-   * @return mixed
+   * @return string
    */
   public function getTitlePosition() {
     return $this->titlePosition;
@@ -123,7 +126,7 @@ class GoogleOptions implements \JsonSerializable {
    * - out: Draw the title outside the chart area.
    * - none: Omit the title.
    *
-   * @param mixed $position
+   * @param string $position
    */
   public function setTitlePosition($position) {
     $this->titlePosition = $position;
@@ -132,7 +135,7 @@ class GoogleOptions implements \JsonSerializable {
   /**
    * Gets the position of the axis titles.
    *
-   * @return mixed
+   * @return string
    */
   public function getAxisTitlesPosition() {
     return $this->axisTitlesPosition;
@@ -146,7 +149,7 @@ class GoogleOptions implements \JsonSerializable {
    * - out: Draw the axis titles outside the chart area.
    * - none: Omit the axis titles.
    *
-   * @param mixed $position
+   * @param string $position
    */
   public function setAxisTitlesPosition($position) {
     $this->axisTitlesPosition = $position;
@@ -173,36 +176,39 @@ class GoogleOptions implements \JsonSerializable {
   /**
    * Gets the horizontal axes.
    *
-   * @return mixed
+   * @return array
    */
-  public function getHAxes() {
+  public function getHorizontalAxes() {
     return $this->hAxes;
   }
 
   /**
    * Sets the horizontal axes.
    *
-   * @param mixed $hAxes
+   * @param array $hAxes
+   *   Horizontal axes.
    */
-  public function setHAxes($hAxes) {
+  public function setHorizontalAxes(array $hAxes = []) {
     $this->hAxes = $hAxes;
   }
 
   /**
    * Gets the vertical axes.
    *
-   * @return mixed
+   * @return array
+   *   Vertical axes.
    */
-  public function getVAxes() {
+  public function getVerticalAxes() {
     return $this->vAxes;
   }
 
   /**
    * Sets the vertical axes.
    *
-   * @param mixed $vAxes
+   * @param array $vAxes
+   *   Vertical axes.
    */
-  public function setVAxes($vAxes) {
+  public function setVerticalAxes(array $vAxes = []) {
     $this->vAxes = $vAxes;
   }
 
@@ -210,7 +216,8 @@ class GoogleOptions implements \JsonSerializable {
    * Gets the colors to use for the chart elements. An array of strings, where
    * each element is an HTML color string.
    *
-   * @return mixed
+   * @return array
+   *   Colors.
    */
   public function getColors() {
     return $this->colors;
@@ -220,9 +227,10 @@ class GoogleOptions implements \JsonSerializable {
    * Sets the colors to use for the chart elements. An array of strings, where
    * each element is an HTML color string.
    *
-   * @param mixed $colors
+   * @param array $colors
+   *   Colors.
    */
-  public function setColors($colors) {
+  public function setColors(array $colors = []) {
     $this->colors = $colors;
   }
 
@@ -308,6 +316,7 @@ class GoogleOptions implements \JsonSerializable {
 
   /**
    * @return array
+   *   Get an array.
    */
   public function jsonSerialize() {
     $vars = get_object_vars($this);
diff --git a/modules/charts_google/src/Settings/Google/HorizontalAxis.php b/modules/charts_google/src/Settings/Google/HorizontalAxis.php
index 3591b07..429933f 100644
--- a/modules/charts_google/src/Settings/Google/HorizontalAxis.php
+++ b/modules/charts_google/src/Settings/Google/HorizontalAxis.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\charts_google\Settings\Google;
 
+use Drupal\charts_google\Settings\Google\ChartAxis;
+
 /**
  * Class HorizontalAxis.
  *
@@ -10,376 +12,6 @@ namespace Drupal\charts_google\Settings\Google;
  * hAxis options are described here:
  * @see https://developers.google.com/chart/interactive/docs/gallery/columnchart#configuration-options
  */
-class HorizontalAxis implements \JsonSerializable {
-
-  /**
-   * hAxis property that specifies a title for the horizontal axis.
-   */
-  private $title;
-
-  /**
-   * An array that specifies the horizontal axis title text style.
-   */
-  private $titleTextStyle;
-
-  /**
-   * hAxis property that specifies the baseline for the horizontal axis. If the
-   * baseline is larger than the highest grid line or smaller than the lowest
-   * grid line, it will be rounded to the closest gridline.
-   */
-  private $baseline;
-
-  /**
-   * Specifies the color of the baseline for the horizontal axis. Can be any HTML
-   * color string, for example: 'red' or '#00cc00'.
-   */
-  private $baselineColor;
-
-  /**
-   * The direction in which the values along the horizontal axis grow. Specify -1
-   * to reverse the order of the values.
-   */
-  private $direction;
-
-  /**
-   * A format string for numeric axis labels.
-   */
-  private $format;
-
-  /**
-   * Position of the horizontal axis text, relative to the chart area.
-   * Supported values: 'out', 'in', 'none'.
-   */
-  private $textPosition;
-
-  /**
-   * An array that specifies the horizontal axis text style.
-   */
-  private $textStyle;
-
-  /**
-   * Moves the max value of the horizontal axis to the specified value; this will
-   * be upward in most charts. Ignored if this is set to a value smaller than
-   * the maximum y-value of the data.
-   */
-  private $maxValue;
-
-  /**
-   * Moves the min value of the horizontal axis to the specified value; this will
-   * be downward in most charts. Ignored if this is set to a value greater than
-   * the minimum y-value of the data.
-   */
-  private $minValue = 0;
-
-  /**
-   * Specifies how to scale the horizontal axis to render the values within the
-   * chart area.
-   */
-  private $viewWindowMode;
-
-  /**
-   * Specifies the cropping range of the horizontal axis.
-   */
-  private $viewWindow;
-
-  /**
-   * Get hAxis property that specifies a title for the horizontal axis.
-   *
-   * @return mixed
-   */
-  public function getTitle() {
-    return $this->title;
-  }
-
-  /**
-   * Set hAxis property that specifies a title for the horizontal axis.
-   *
-   * @param $value
-   */
-  public function setTitle($value) {
-    $this->title = $value;
-  }
-
-  /**
-   * Get an array that specifies the horizontal axis title text style.
-   *
-   * @return mixed
-   */
-  public function getTitleTextStyle() {
-    return $this->titleTextStyle;
-  }
-
-  /**
-   * Set an array that specifies the horizontal axis title text style.
-   *
-   * @param mixed $value
-   */
-  public function setTitleTextStyle($value) {
-    $this->titleTextStyle = $value;
-  }
-
-  /**
-   * Get an array property that specifies the horizontal axis title text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   *
-   * @return mixed
-   */
-  public function getTitleTextStyleValue($key) {
-    return isset($this->titleTextStyle[$key]) ? $this->titleTextStyle[$key] : NULL;
-  }
-
-  /**
-   * Set an array property that specifies the horizontal axis title text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   * @param mixed $value
-   *   Value of the text style property.
-   */
-  public function setTitleTextStyleValue($key, $value) {
-    $this->titleTextStyle[$key] = $value;
-  }
-
-  /**
-   * Get hAxis property that specifies the baseline for the horizontal axis.
-   *
-   * @return mixed
-   */
-  public function getBaseline() {
-    return $this->baseline;
-  }
-
-  /**
-   * Set hAxis property that specifies the baseline for the horizontal axis.
-   *
-   * @param mixed $value
-   */
-  public function setBaseline($value) {
-    $this->baseline = $value;
-  }
-
-  /**
-   * Get the color of the baseline for the horizontal axis.
-   *
-   * @return mixed
-   */
-  public function getBaselineColor() {
-    return $this->baselineColor;
-  }
-
-  /**
-   * Set the color of the baseline for the horizontal axis.
-   *
-   * @param mixed $value
-   */
-  public function setBaselineColor($value) {
-    $this->baselineColor = $value;
-  }
-
-  /**
-   * Get the direction in which the values along the horizontal axis grow.
-   *
-   * @return mixed
-   */
-  public function getDirection() {
-    return $this->direction;
-  }
-
-  /**
-   * Set the direction in which the values along the horizontal axis grow.
-   *
-   * @param mixed $value
-   */
-  public function setDirection($value) {
-    $this->direction = $value;
-  }
-
-  /**
-   * Get the format string for numeric axis labels
-   *
-   * @return mixed
-   */
-  public function getFormat() {
-    return $this->format;
-  }
-
-  /**
-   * Set a format string for numeric axis labels
-   *
-   * @param mixed $value
-   */
-  public function setFormat($value) {
-    $this->format = $value;
-  }
-
-  /**
-   * Get the position of the horizontal axis text, relative to the chart area.
-   *
-   * @return mixed
-   */
-  public function getTextPosition() {
-    return $this->textPosition;
-  }
-
-  /**
-   * Set the position of the horizontal axis text, relative to the chart area.
-   *
-   * @param mixed $value
-   */
-  public function setTextPosition($value) {
-    $this->textPosition = $value;
-  }
-
-  /**
-   * Get an array that specifies the horizontal axis text style.
-   *
-   * @return mixed
-   */
-  public function getTextStyle() {
-    return $this->textStyle;
-  }
-
-  /**
-   * Set an array that specifies the horizontal axis text style.
-   *
-   * @param mixed $value
-   */
-  public function setTextStyle($value) {
-    $this->textStyle = $value;
-  }
-
-  /**
-   * Get an array property that specifies the horizontal axis text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   *
-   * @return mixed
-   */
-  public function getTextStyleValue($key) {
-    return isset($this->textStyle[$key]) ? $this->textStyle[$key] : NULL;
-  }
-
-  /**
-   * Set an array property that specifies the horizontal axis text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   * @param mixed $value
-   *   Value of the text style property.
-   */
-  public function setTextStyleValue($key, $value) {
-    $this->textStyle[$key] = $value;
-  }
-
-  /**
-   * Get the max value of the horizontal axis.
-   *
-   * @return mixed
-   */
-  public function getMaxValue() {
-    return $this->maxValue;
-  }
-
-  /**
-   * Set the max value of the horizontal axis.
-   *
-   * @param mixed $value
-   */
-  public function setMaxValue($value) {
-    $this->maxValue = $value;
-  }
-
-  /**
-   * Get the min value of the horizontal axis.
-   *
-   * @return mixed
-   */
-  public function getMinValue() {
-    return $this->minValue;
-  }
-
-  /**
-   * Set the min value of the horizontal axis.
-   *
-   * @param mixed $value
-   */
-  public function setMinValue($value) {
-    $this->minValue = $value;
-  }
-
-  /**
-   * Get the value that specifies how to scale the horizontal axis to render the
-   * values within the chart area.
-   *
-   * @return mixed
-   */
-  public function getViewWindowMode() {
-    return $this->viewWindowMode;
-  }
-
-  /**
-   * Set the value that specifies how to scale the horizontal axis to render the
-   * values within the chart area.
-   *
-   * @param mixed $value
-   */
-  public function setViewWindowMode($value) {
-    $this->viewWindowMode = $value;
-  }
-
-  /**
-   * Get an array that specifies the cropping range of the horizontal axis.
-   *
-   * @return mixed
-   */
-  public function getViewWindow() {
-    return $this->viewWindow;
-  }
-
-  /**
-   * Set an array that specifies the cropping range of the horizontal axis.
-   *
-   * @param mixed $value
-   */
-  public function setViewWindow($value) {
-    $this->viewWindow = $value;
-  }
-
-  /**
-   * Get an array property that specifies the the cropping range of the
-   * horizontal axis.
-   *
-   * @param string $key
-   *   Property key.
-   *
-   * @return mixed
-   */
-  public function getViewWindowValue($key) {
-    return isset($this->viewWindow[$key]) ? $this->viewWindow[$key] : NULL;
-  }
-
-  /**
-   * Set an array property that specifies the cropping range of the horizontal
-   * axis.
-   *
-   * @param string $key
-   *   Property key.
-   * @param mixed $value
-   *   Property value.
-   */
-  public function setViewWindowValue($key, $value) {
-    $this->viewWindow[$key] = $value;
-  }
-
-  /**
-   * @return array
-   */
-  public function jsonSerialize() {
-    $vars = get_object_vars($this);
-    return $vars;
-  }
+class HorizontalAxis extends ChartAxis {
 
 }
diff --git a/modules/charts_google/src/Settings/Google/VerticalAxis.php b/modules/charts_google/src/Settings/Google/VerticalAxis.php
index 16d8228..57bfffa 100644
--- a/modules/charts_google/src/Settings/Google/VerticalAxis.php
+++ b/modules/charts_google/src/Settings/Google/VerticalAxis.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\charts_google\Settings\Google;
 
+use Drupal\charts_google\Settings\Google\ChartAxis;
+
 /**
  * Class VerticalAxis.
  *
@@ -10,376 +12,6 @@ namespace Drupal\charts_google\Settings\Google;
  * vAxis options are described here:
  * @see https://developers.google.com/chart/interactive/docs/gallery/columnchart#configuration-options
  */
-class VerticalAxis implements \JsonSerializable {
-
-  /**
-   * vAxis property that specifies a title for the vertical axis.
-   */
-  private $title;
-
-  /**
-   * An array that specifies the vertical axis title text style.
-   */
-  private $titleTextStyle;
-
-  /**
-   * vAxis property that specifies the baseline for the vertical axis. If the
-   * baseline is larger than the highest grid line or smaller than the lowest
-   * grid line, it will be rounded to the closest gridline.
-   */
-  private $baseline;
-
-  /**
-   * Specifies the color of the baseline for the vertical axis. Can be any HTML
-   * color string, for example: 'red' or '#00cc00'.
-   */
-  private $baselineColor;
-
-  /**
-   * The direction in which the values along the vertical axis grow. Specify -1
-   * to reverse the order of the values.
-   */
-  private $direction;
-
-  /**
-   * A format string for numeric axis labels.
-   */
-  private $format;
-
-  /**
-   * Position of the vertical axis text, relative to the chart area.
-   * Supported values: 'out', 'in', 'none'.
-   */
-  private $textPosition;
-
-  /**
-   * An array that specifies the vertical axis text style.
-   */
-  private $textStyle;
-
-  /**
-   * Moves the max value of the vertical axis to the specified value; this will
-   * be upward in most charts. Ignored if this is set to a value smaller than
-   * the maximum y-value of the data.
-   */
-  private $maxValue;
-
-  /**
-   * Moves the min value of the vertical axis to the specified value; this will
-   * be downward in most charts. Ignored if this is set to a value greater than
-   * the minimum y-value of the data.
-   */
-  private $minValue = 0;
-
-  /**
-   * Specifies how to scale the vertical axis to render the values within the
-   * chart area.
-   */
-  private $viewWindowMode;
-
-  /**
-   * Specifies the cropping range of the vertical axis.
-   */
-  private $viewWindow;
-
-  /**
-   * Get vAxis property that specifies a title for the vertical axis.
-   *
-   * @return mixed
-   */
-  public function getTitle() {
-    return $this->title;
-  }
-
-  /**
-   * Set vAxis property that specifies a title for the vertical axis.
-   *
-   * @param $value
-   */
-  public function setTitle($value) {
-    $this->title = $value;
-  }
-
-  /**
-   * Get an array that specifies the vertical axis title text style.
-   *
-   * @return mixed
-   */
-  public function getTitleTextStyle() {
-    return $this->titleTextStyle;
-  }
-
-  /**
-   * Set an array that specifies the vertical axis title text style.
-   *
-   * @param mixed $value
-   */
-  public function setTitleTextStyle($value) {
-    $this->titleTextStyle = $value;
-  }
-
-  /**
-   * Get an array property that specifies the vertical axis title text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   *
-   * @return mixed
-   */
-  public function getTitleTextStyleValue($key) {
-    return isset($this->titleTextStyle[$key]) ? $this->titleTextStyle[$key] : NULL;
-  }
-
-  /**
-   * Set an array property that specifies the vertical axis title text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   * @param mixed $value
-   *   Value of the text style property.
-   */
-  public function setTitleTextStyleValue($key, $value) {
-    $this->titleTextStyle[$key] = $value;
-  }
-
-  /**
-   * Get vAxis property that specifies the baseline for the vertical axis.
-   *
-   * @return mixed
-   */
-  public function getBaseline() {
-    return $this->baseline;
-  }
-
-  /**
-   * Set vAxis property that specifies the baseline for the vertical axis.
-   *
-   * @param mixed $value
-   */
-  public function setBaseline($value) {
-    $this->baseline = $value;
-  }
-
-  /**
-   * Get the color of the baseline for the vertical axis.
-   *
-   * @return mixed
-   */
-  public function getBaselineColor() {
-    return $this->baselineColor;
-  }
-
-  /**
-   * Set the color of the baseline for the vertical axis.
-   *
-   * @param mixed $value
-   */
-  public function setBaselineColor($value) {
-    $this->baselineColor = $value;
-  }
-
-  /**
-   * Get the direction in which the values along the vertical axis grow.
-   *
-   * @return mixed
-   */
-  public function getDirection() {
-    return $this->direction;
-  }
-
-  /**
-   * Set the direction in which the values along the vertical axis grow.
-   *
-   * @param mixed $value
-   */
-  public function setDirection($value) {
-    $this->direction = $value;
-  }
-
-  /**
-   * Get the format string for numeric axis labels
-   *
-   * @return mixed
-   */
-  public function getFormat() {
-    return $this->format;
-  }
-
-  /**
-   * Set a format string for numeric axis labels
-   *
-   * @param mixed $value
-   */
-  public function setFormat($value) {
-    $this->format = $value;
-  }
-
-  /**
-   * Get the position of the vertical axis text, relative to the chart area.
-   *
-   * @return mixed
-   */
-  public function getTextPosition() {
-    return $this->textPosition;
-  }
-
-  /**
-   * Set the position of the vertical axis text, relative to the chart area.
-   *
-   * @param mixed $value
-   */
-  public function setTextPosition($value) {
-    $this->textPosition = $value;
-  }
-
-  /**
-   * Get an array that specifies the vertical axis text style.
-   *
-   * @return mixed
-   */
-  public function getTextStyle() {
-    return $this->textStyle;
-  }
-
-  /**
-   * Set an array that specifies the vertical axis text style.
-   *
-   * @param mixed $value
-   */
-  public function setTextStyle($value) {
-    $this->textStyle = $value;
-  }
-
-  /**
-   * Get an array property that specifies the vertical axis text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   *
-   * @return mixed
-   */
-  public function getTextStyleValue($key) {
-    return isset($this->textStyle[$key]) ? $this->textStyle[$key] : NULL;
-  }
-
-  /**
-   * Set an array property that specifies the vertical axis text style.
-   *
-   * @param string $key
-   *   Machine name of the text style property.
-   * @param mixed $value
-   *   Value of the text style property.
-   */
-  public function setTextStyleValue($key, $value) {
-    $this->textStyle[$key] = $value;
-  }
-
-  /**
-   * Get the max value of the vertical axis.
-   *
-   * @return mixed
-   */
-  public function getMaxValue() {
-    return $this->maxValue;
-  }
-
-  /**
-   * Set the max value of the vertical axis.
-   *
-   * @param mixed $value
-   */
-  public function setMaxValue($value) {
-    $this->maxValue = $value;
-  }
-
-  /**
-   * Get the min value of the vertical axis.
-   *
-   * @return mixed
-   */
-  public function getMinValue() {
-    return $this->minValue;
-  }
-
-  /**
-   * Set the min value of the vertical axis.
-   *
-   * @param mixed $value
-   */
-  public function setMinValue($value) {
-    $this->minValue = $value;
-  }
-
-  /**
-   * Get the value that specifies how to scale the vertical axis to render the
-   * values within the chart area.
-   *
-   * @return mixed
-   */
-  public function getViewWindowMode() {
-    return $this->viewWindowMode;
-  }
-
-  /**
-   * Set the value that specifies how to scale the vertical axis to render the
-   * values within the chart area.
-   *
-   * @param mixed $value
-   */
-  public function setViewWindowMode($value) {
-    $this->viewWindowMode = $value;
-  }
-
-  /**
-   * Get an array that specifies the cropping range of the vertical axis.
-   *
-   * @return mixed
-   */
-  public function getViewWindow() {
-    return $this->viewWindow;
-  }
-
-  /**
-   * Set an array that specifies the cropping range of the vertical axis.
-   *
-   * @param mixed $value
-   */
-  public function setViewWindow($value) {
-    $this->viewWindow = $value;
-  }
-
-  /**
-   * Get an array property that specifies the the cropping range of the
-   * vertical axis.
-   *
-   * @param string $key
-   *   Property key.
-   *
-   * @return mixed
-   */
-  public function getViewWindowValue($key) {
-    return isset($this->viewWindow[$key]) ? $this->viewWindow[$key] : NULL;
-  }
-
-  /**
-   * Set an array property that specifies the cropping range of the vertical
-   * axis.
-   *
-   * @param string $key
-   *   Property key.
-   * @param mixed $value
-   *   Property value.
-   */
-  public function setViewWindowValue($key, $value) {
-    $this->viewWindow[$key] = $value;
-  }
-
-  /**
-   * @return array
-   */
-  public function jsonSerialize() {
-    $vars = get_object_vars($this);
-    return $vars;
-  }
+class VerticalAxis extends ChartAxis {
 
 }
diff --git a/modules/charts_highcharts/charts_highcharts.module b/modules/charts_highcharts/charts_highcharts.module
index 1861f5a..73e5fe7 100644
--- a/modules/charts_highcharts/charts_highcharts.module
+++ b/modules/charts_highcharts/charts_highcharts.module
@@ -11,10 +11,10 @@ use Drupal\charts\Theme\ChartsInterface;
  */
 function charts_highcharts_charts_info() {
   $info['highcharts'] = [
-    'label' => t('Highcharts'),
+    'label'  => t('Highcharts'),
     'render' => '_charts_highcharts_render',
-    'types' => ['area', 'bar', 'column', 'donut', 'line', 'pie', 'scatter'],
-    'file' => 'charts_highcharts.inc',
+    'types'  => ['area', 'bar', 'column', 'donut', 'line', 'pie', 'scatter'],
+    'file'   => 'charts_highcharts.inc',
   ];
 
   return $info;
@@ -26,7 +26,7 @@ function charts_highcharts_charts_info() {
 function charts_highcharts_charts_type_info() {
   $chart_types['donut'] = [
     'label' => t('Donut'),
-    'axis' => ChartsInterface::CHARTS_SINGLE_AXIS,
+    'axis'  => ChartsInterface::CHARTS_SINGLE_AXIS,
   ];
   return $chart_types;
 }
diff --git a/modules/charts_highcharts/src/Charts/HighchartsChartsRender.php b/modules/charts_highcharts/src/Charts/HighchartsChartsRender.php
index df69fad..c70f023 100644
--- a/modules/charts_highcharts/src/Charts/HighchartsChartsRender.php
+++ b/modules/charts_highcharts/src/Charts/HighchartsChartsRender.php
@@ -20,24 +20,22 @@ use Drupal\charts_highcharts\Settings\Highcharts\ChartCredits;
 use Drupal\charts_highcharts\Settings\Highcharts\ChartLegend;
 use Drupal\charts_highcharts\Settings\Highcharts\Highcharts;
 
+/**
+ * Highcharts Charts Render.
+ */
 class HighchartsChartsRender implements ChartsRenderInterface {
 
+  /**
+   * Construct.
+   */
   public function __construct() {
     Util::checkMissingLibrary('charts_highcharts', '/vendor/highcharts/highcharts.js');
   }
 
   /**
-   * Creates a JSON Object formatted for Highcharts to use
-   *
-   * @param $options
-   * @param array $categories
-   * @param array $seriesData
-   *
-   * @param array $attachmentDisplayOptions
-   *
-   * @return Highcharts object to be used by highcharts javascripts visualization framework
+   * {@inheritdoc}
    */
-  public function charts_render_charts($options, $categories = [], $seriesData = [], $attachmentDisplayOptions = [], &$variables, $chartId) {
+  public function chartsRenderCharts(array $options = [], array $categories = [], array $seriesData = [], array $attachmentDisplayOptions = [], array &$variables = [], $chartId = '') {
     $noAttachmentDisplays = count($attachmentDisplayOptions) === 0;
 
     $chart = new Chart();
@@ -51,12 +49,10 @@ class HighchartsChartsRender implements ChartsRenderInterface {
       }
       // Add innerSize to differentiate between donut and pie.
       foreach ($seriesData as $key => &$value) {
-        if ($typeOptions == 'pie') {
-          $innerSize['showInLegend'] = 'true';
-          $innerSize['innerSize'] = '40%';
-          $chartPlacement = array_search($value, $seriesData);
-          $seriesData[$chartPlacement] = array_merge($innerSize, $seriesData[$chartPlacement]);
-        }
+        $innerSize['showInLegend'] = 'true';
+        $innerSize['innerSize'] = '40%';
+        $chartPlacement = array_search($value, $seriesData);
+        $seriesData[$chartPlacement] = array_merge($innerSize, $seriesData[$chartPlacement]);
       }
     }
     $chart->setType($typeOptions);
@@ -151,4 +147,5 @@ class HighchartsChartsRender implements ChartsRenderInterface {
     $variables['attributes']['id'][0] = $chartId;
     $variables['attributes']['class'][] = 'charts-highchart';
   }
+
 }
diff --git a/modules/charts_highcharts/src/Settings/Highcharts/Chart.php b/modules/charts_highcharts/src/Settings/Highcharts/Chart.php
index b5d3c74..90725c9 100644
--- a/modules/charts_highcharts/src/Settings/Highcharts/Chart.php
+++ b/modules/charts_highcharts/src/Settings/Highcharts/Chart.php
@@ -2,64 +2,89 @@
 
 namespace Drupal\charts_highcharts\Settings\Highcharts;
 
+/**
+ * Chart.
+ */
 class Chart implements \JsonSerializable {
+  
   private $type;
-  private $width = NULL ;
-  private $height = NULL ;
+  private $width = NULL;
+  private $height = NULL;
   
-   /**
-   * @return mixed
+  /**
+   * Get Type.
+   *
+   * @return string
    */
   public function getType() {
     return $this->type;
   }
 
   /**
-   * @param mixed $type
+   * Set Type.
+   *
+   * @param string $type
    */
-  public function setType($type) {
+  public function setType($type = '') {
     $this->type = $type;
   }
- /**
-   * @return mixed 
+
+  /**
+   * Get Width.
+   *
+   * @return int|null
+   *   Width.
    */
   public function getWidth() {
     return $this->width;
   }
+
   /**
-   * @param mixed $width
+   * Set Width.
+   *
+   * @param int|null $width
+   *   Width.
    */
-  public function setWidth($width) {
+  public function setWidth($width = NULL) {
     if (empty($width)) {
-     $this->width = NULL;
-    } else {
-    $this->width = (int)$width;
+      $this->width = NULL;
+    }
+    else {
+      $this->width = (int) $width;
     }
   }
 
   /**
-   * @return mixed 
+   * Get Height.
+   *
+   * @return int|null
+   *   Height. 
    */
   public function getHeight() {
     return $this->height;
   }
   
   /**
-   * @param mixed $height
+   * Set Height.
+   *
+   * @param int|null $height
+   *   Height.
    */
- 
-  public function setHeight($height) {
+  public function setHeight($height = NULL) {
     if (empty($height)) {
-     $this->height = NULL;
-    } else {
-     $this->height = (int)$height;
+      $this->height = NULL;
+    }
+    else {
+      $this->height = (int)$height;
     }
   }
   
   /**
+   * Json Serialize.
+   * 
    * @return array
+   *   Variables.
    */
-  
   public function jsonSerialize() {
     $vars = get_object_vars($this);
 
diff --git a/src/Charts/ChartsRenderInterface.php b/src/Charts/ChartsRenderInterface.php
index 7f0456d..8f4e82a 100644
--- a/src/Charts/ChartsRenderInterface.php
+++ b/src/Charts/ChartsRenderInterface.php
@@ -2,7 +2,27 @@
 
 namespace Drupal\charts\Charts;
 
-
+/**
+ * Defines an interface for charts render classes.
+ */
 interface ChartsRenderInterface {
-  public function charts_render_charts($options, $categories = [], $seriesData = [], $attachmentDisplayOptions = [], &$variables, $chartId);
+
+  /**
+   * Charts render charts.
+   *
+   * @param array $options
+   *   Options.
+   * @param array $categories
+   *   Categories.
+   * @param array $seriesData
+   *   Series Data.
+   * @param array $attachmentDisplayOptions
+   *   Attachment Display Options.
+   * @param array $variables
+   *   Variables.
+   * @param string $chartId
+   *   Chart Id.
+   */
+  public function chartsRenderCharts(array $options = [], array $categories = [], array $seriesData = [], array $attachmentDisplayOptions = [],array &$variables = [], $chartId = '');
+
 }
diff --git a/src/Charts/ModuleSelector.php b/src/Charts/ModuleSelector.php
index ee99af5..b25df8f 100644
--- a/src/Charts/ModuleSelector.php
+++ b/src/Charts/ModuleSelector.php
@@ -1,16 +1,13 @@
 <?php
 
-/**
- * @ file
- *
- *
- */
-
 namespace Drupal\charts\Charts;
 
+/**
+ * ModuleSelector.
+ */
 class ModuleSelector {
 
-  private $moduleName;
+  private $library;
   private $assetLocation = '/vendor/';
   private $assetName;
   private $categories;
@@ -19,22 +16,63 @@ class ModuleSelector {
   private $attachmentDisplayOptions;
   private $chartId;
 
-  public function __construct($moduleName, $categories, $seriesData, $options, $attachmentDisplayOptions, &$variables, $chartId) {
-    $this->moduleName = $moduleName;
+  /**
+   * Construct.
+   *
+   * @param string $library
+   *   Module name.
+   * @param array $categories
+   *   Categories.
+   * @param array $seriesData
+   *   Series Data.
+   * @param array $options
+   *   Options.
+   * @param array $attachmentDisplayOptions
+   *   AttachmentDisplayOptions.
+   * @param string $chartId
+   *   Chart Id.
+   */
+  public function __construct($library = '', array $categories = [], array $seriesData = [], array $options = [], array $attachmentDisplayOptions = [], $chartId = '') {
+    $this->library = $library;
     $this->categories = $categories;
     $this->seriesData = $seriesData;
     $this->options = $options;
     $this->attachmentDisplayOptions = $attachmentDisplayOptions;
     $this->chartId = $chartId;
-    $this->moduleExists($moduleName, $variables);
   }
 
-  private function moduleExists($moduleName, &$variables) {
-    $moduleExist = \Drupal::moduleHandler()->moduleExists($moduleName);
-    if ('charts_' . $moduleExist) {
-      $moduleChartsRenderer = 'Drupal\charts_' . $moduleName . '\Charts\\' . ucfirst($moduleName) . 'ChartsRender';
+  /**
+   * Module exists.
+   *
+   * @return bool
+   *   Module exist.
+   */
+  public function moduleExists(){
+    return \Drupal::moduleHandler()->moduleExists('charts_'.$this->library);
+  }
+  
+  /**
+   * Get class charts render.
+   * 
+   * @return string
+   *   Class charts render name.
+   */
+  private function getClassChartsRender(){
+    return 'Drupal\charts_' . $this->library. '\Charts\\' . ucfirst($this->library) . 'ChartsRender';
+  }
+
+  /**
+   * Build Variables.
+   *
+   * @param array $variables
+   *   Variables.
+   */
+  public function buildVariables(array &$variables = []){
+    $moduleChartsRenderer = $this->getClassChartsRender();
+    if (class_exists($moduleChartsRenderer)) {
       $chartingModule = new $moduleChartsRenderer();
-      $chartingModule->charts_render_charts($this->options, $this->categories, $this->seriesData, $this->attachmentDisplayOptions, $variables, $this->chartId);
+      $chartingModule->chartsRenderCharts($this->options, $this->categories, $this->seriesData, $this->attachmentDisplayOptions, $variables, $this->chartId);
     }
   }
+
 }
diff --git a/src/Form/ChartsConfigForm.php b/src/Form/ChartsConfigForm.php
index 5d1a193..7b1fcfc 100644
--- a/src/Form/ChartsConfigForm.php
+++ b/src/Form/ChartsConfigForm.php
@@ -14,6 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  * Charts Config Form.
  */
 class ChartsConfigForm extends ConfigFormBase {
+
   protected $moduleHandler;
   protected $config;
 
@@ -92,7 +93,6 @@ class ChartsConfigForm extends ConfigFormBase {
         '#button_type' => 'primary',
       ],
     ];
-
     return $form;
   }
 
diff --git a/src/Plugin/views/display/ChartsPluginDisplayChart.php b/src/Plugin/views/display/ChartsPluginDisplayChart.php
index db18691..af2feea 100644
--- a/src/Plugin/views/display/ChartsPluginDisplayChart.php
+++ b/src/Plugin/views/display/ChartsPluginDisplayChart.php
@@ -4,7 +4,6 @@ namespace Drupal\charts\Plugin\views\display;
 
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Plugin\views\display\Attachment;
-use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\ViewExecutable;
 
 /**
@@ -19,7 +18,6 @@ use Drupal\views\ViewExecutable;
  *   theme = "views_view_charts",
  *   contextual_links_locations = {""}
  * )
- *
  */
 class ChartsPluginDisplayChart extends Attachment {
 
@@ -32,29 +30,25 @@ class ChartsPluginDisplayChart extends Attachment {
     $options['inherit_yaxis'] = ['default' => '1'];
 
     return $options;
-
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function execute() {
     return $this->view->render($this->display['id']);
   }
 
   /**
-   * Provide the summary for page options in the views UI.
-   *
-   * This output is returned as an array.
-   *
-   * @param $categories
-   * @param $options
+   * {@inheritdoc}
    */
   public function optionsSummary(&$categories, &$options) {
-    // It is very important to call the parent function here:
     parent::optionsSummary($categories, $options);
 
     $categories['attachment'] = [
-      'title' => t('Chart settings'),
+      'title'  => t('Chart settings'),
       'column' => 'second',
-      'build' => ['#weight' => -10,],
+      'build'  => ['#weight' => -10,],
     ];
     $displays = array_filter($this->getOption('displays'));
     if (count($displays) > 1) {
@@ -70,14 +64,14 @@ class ChartsPluginDisplayChart extends Attachment {
     }
     $options['displays'] = [
       'category' => 'attachment',
-      'title' => $this->t('Parent display'),
-      'value' => $attach_to,
+      'title'    => $this->t('Parent display'),
+      'value'    => $attach_to,
     ];
 
     $options['inherit_yaxis'] = [
       'category' => 'attachment',
-      'title' => $this->t('Axis settings'),
-      'value' => $this->getOption('inherit_yaxis') ? t('Use primary Y-axis') : t('Create secondary axis'),
+      'title'    => $this->t('Axis settings'),
+      'value'    => $this->getOption('inherit_yaxis') ? t('Use primary Y-axis') : t('Create secondary axis'),
     ];
 
     unset($options['attachment_position']);
@@ -86,10 +80,7 @@ class ChartsPluginDisplayChart extends Attachment {
   }
 
   /**
-   * Provide the default form for setting options.
-   *
-   * @param $form
-   * @param FormStateInterface $form_state
+   * {@inheritdoc}
    */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     parent::buildOptionsForm($form, $form_state);
@@ -102,14 +93,14 @@ class ChartsPluginDisplayChart extends Attachment {
       case 'inherit_yaxis':
         $form['#title'] .= t('Axis settings');
         $form['inherit_yaxis'] = [
-          '#title' => t('Y-Axis settings'),
-          '#type' => 'radios',
-          '#options' => [
+          '#title'         => t('Y-Axis settings'),
+          '#type'          => 'radios',
+          '#options'       => [
             1 => t('Inherit primary of parent display'),
             0 => t('Create a secondary axis'),
           ],
           '#default_value' => $this->getOption('inherit_yaxis'),
-          '#description' => t('In most charts, the X and Y axis from the parent display are both shared with each attached child chart. However, if this chart is going to use a different unit of measurement, a secondary axis may be added on the opposite side of the normal Y-axis.'),
+          '#description'   => t('In most charts, the X and Y axis from the parent display are both shared with each attached child chart. However, if this chart is going to use a different unit of measurement, a secondary axis may be added on the opposite side of the normal Y-axis.'),
         ];
         break;
     }
diff --git a/src/Plugin/views/style/ChartsPluginStyleChart.php b/src/Plugin/views/style/ChartsPluginStyleChart.php
index 66e390d..96c2f28 100644
--- a/src/Plugin/views/style/ChartsPluginStyleChart.php
+++ b/src/Plugin/views/style/ChartsPluginStyleChart.php
@@ -29,7 +29,7 @@ class ChartsPluginStyleChart extends StylePluginBase {
   protected $usesRowPlugin = TRUE;
 
   /**
-   * Set default options.
+   * {@inheritdoc}
    */
   protected function defineOptions() {
     $options = parent::defineOptions();
@@ -148,24 +148,24 @@ class ChartsPluginStyleChart extends StylePluginBase {
     }
     $chart_id = $this->view->id() . '__' . $this->view->current_display;
     $chart = [
-      '#type' => 'chart',
-      '#chart_type' => $this->options['type'],
-      '#chart_library' => $this->options['library'],
-      '#chart_id' => $chart_id,
-      '#id' => ('chart_' . $chart_id),
-      '#title' => $this->options['title_position'] ? $this->options['title'] : FALSE,
-      '#title_position' => $this->options['title_position'],
-      '#tooltips' => $this->options['tooltips'],
-      '#data_labels' => $this->options['data_labels'],
-      '#colors' => $this->options['colors'],
-      '#background' => $this->options['background'] ? $this->options['background'] : 'transparent',
-      '#legend' => $this->options['legend_position'] ? TRUE : FALSE,
+      '#type'            => 'chart',
+      '#chart_type'      => $this->options['type'],
+      '#chart_library'   => $this->options['library'],
+      '#chart_id'        => $chart_id,
+      '#id'              => ('chart_' . $chart_id),
+      '#title'           => $this->options['title_position'] ? $this->options['title'] : FALSE,
+      '#title_position'  => $this->options['title_position'],
+      '#tooltips'        => $this->options['tooltips'],
+      '#data_labels'     => $this->options['data_labels'],
+      '#colors'          => $this->options['colors'],
+      '#background'      => $this->options['background'] ? $this->options['background'] : 'transparent',
+      '#legend'          => $this->options['legend_position'] ? TRUE : FALSE,
       '#legend_position' => $this->options['legend_position'] ? $this->options['legend_position'] : NULL,
-      '#width' => $this->options['width'],
-      '#height' => $this->options['height'],
-      '#view' => $this->view,
+      '#width'           => $this->options['width'],
+      '#height'          => $this->options['height'],
+      '#view'            => $this->view,
       // Pass info about the actual view results to allow further processing
-      '#theme' => 'views_view_charts',
+      '#theme'           => 'views_view_charts',
     ];
     $chart_type_info = charts_get_type($this->options['type']);
     if ($chart_type_info['axis'] === ChartsInterface::CHARTS_SINGLE_AXIS) {
@@ -198,39 +198,40 @@ class ChartsPluginStyleChart extends StylePluginBase {
       }
 
       $chart[$this->view->current_display . '_series'] = [
-        '#type' => 'chart_data',
-        '#data' => $data,
+        '#type'  => 'chart_data',
+        '#data'  => $data,
         '#title' => $data_field['label'],
       ];
 
     } else {
       $chart['xaxis'] = [
-        '#type' => 'chart_xaxis',
-        '#title' => $this->options['xaxis_title'] ? $this->options['xaxis_title'] : FALSE,
+        '#type'            => 'chart_xaxis',
+        '#title'           => $this->options['xaxis_title'] ? $this->options['xaxis_title'] : FALSE,
         '#labels_rotation' => $this->options['xaxis_labels_rotation'],
       ];
       $chart['yaxis'] = [
-        '#type' => 'chart_yaxis',
-        '#title' => $this->options['yaxis_title'] ? $this->options['yaxis_title'] : FALSE,
+        '#type'            => 'chart_yaxis',
+        '#title'           => $this->options['yaxis_title'] ? $this->options['yaxis_title'] : FALSE,
         '#labels_rotation' => $this->options['yaxis_labels_rotation'],
-        '#max' => $this->options['yaxis_max'],
-        '#min' => $this->options['yaxis_min'],
+        '#max'             => $this->options['yaxis_max'],
+        '#min'             => $this->options['yaxis_min'],
       ];
 
       // @todo incorporate this patch: https://www.drupal.org/files/issues/charts_grouping-2146927-6.patch.
       $sets = $this->renderGrouping($this->view->result, $this->options['grouping'], TRUE);
+      $series_index = -1;
       foreach ($sets as $series_label => $data_set) {
-        $series_index = isset($series_index) ? $series_index + 1 : 0;
+        $series_index++;
         $series_key = $this->view->current_display . '__' . $field_key . '_' . $series_index;
         foreach ($data_fields as $field_key => $field_handler) {
           $chart[$series_key] = [
-            '#type' => 'chart_data',
-            '#data' => [],
+            '#type'          => 'chart_data',
+            '#data'          => [],
             // If using a grouping field, inherit from the chart level colors.
-            '#color' => ($series_label === '' && isset($this->options['field_colors'][$field_key])) ? $this->options['field_colors'][$field_key] : NULL,
-            '#title' => $series_label ? $series_label : $field_handler['label'],
-            '#prefix' => $this->options['yaxis_prefix'] ? $this->options['yaxis_prefix'] : NULL,
-            '#suffix' => $this->options['yaxis_suffix'] ? $this->options['yaxis_suffix'] : NULL,
+            '#color'         => ($series_label === '' && isset($this->options['field_colors'][$field_key])) ? $this->options['field_colors'][$field_key] : NULL,
+            '#title'         => $series_label ? $series_label : $field_handler['label'],
+            '#prefix'        => $this->options['yaxis_prefix'] ? $this->options['yaxis_prefix'] : NULL,
+            '#suffix'        => $this->options['yaxis_suffix'] ? $this->options['yaxis_suffix'] : NULL,
             '#decimal_count' => $this->options['yaxis_decimal_count'] ? $this->options['yaxis_decimal_count'] : NULL,
           ];
         }
@@ -282,8 +283,8 @@ class ChartsPluginStyleChart extends StylePluginBase {
       // a display.
       $subview = $this->view->createDuplicate();
       $subview->setDisplay($child_display);
-      //   Copy the settings for our axes over to the child view.
 
+      // Copy the settings for our axes over to the child view.
       foreach ($this->options as $option_name => $option_value) {
         if ($this->view->displayHandlers->get($child_display)->options['inherit_yaxis'] === '1') {
           $subview->display_handler->options['style_options'][$option_name] = $option_value;
@@ -334,8 +335,11 @@ class ChartsPluginStyleChart extends StylePluginBase {
 
   /**
    * Utility function to check if this chart has a parent display.
+   *
+   * @return bool
+   *   Parent Display.
    */
-  function get_parent_chart_display() {
+  function getParentChartDisplay() {
     $parent_display = FALSE;
 
     return $parent_display;
@@ -343,6 +347,9 @@ class ChartsPluginStyleChart extends StylePluginBase {
 
   /**
    * Utility function to check if this chart has children displays.
+   *
+   * @return array
+   *   Children Chart Display.
    */
   function getChildrenChartDisplays() {
 
@@ -350,7 +357,7 @@ class ChartsPluginStyleChart extends StylePluginBase {
     foreach ($children_displays as $key => $child) {
       $display_handler = $this->view->displayHandlers->get($child);
       //unset disabled & non chart attachments.
-      if ((!$display_handler->isEnabled()) || (strstr($child,'chart_extension') == !true)) {
+      if ((!$display_handler->isEnabled()) || (strstr($child,'chart_extension') == !TRUE)) {
         unset($children_displays[$key]);
       }
     }
diff --git a/src/Services/ChartAttachmentService.php b/src/Services/ChartAttachmentService.php
index 9d06a53..5864a7d 100644
--- a/src/Services/ChartAttachmentService.php
+++ b/src/Services/ChartAttachmentService.php
@@ -3,28 +3,25 @@
 namespace Drupal\charts\Services;
 
 /**
- * Class ChartAttachmentService
+ * Class ChartAttachmentService.
  *
  * @package Drupal\charts\Services.
  */
-
 class ChartAttachmentService implements ChartAttachmentServiceInterface {
 
   private $attachmentViews;
 
   /**
-   * @return $attachmentViews an array of different views.
+   * {@inheritdoc}
    */
   public function getAttachmentViews() {
-
     return $this->attachmentViews;
   }
 
   /**
-   * @param $attachmentViews
-   * This is an array of views.
+   * {@inheritdoc}
    */
-  public function setAttachmentViews($attachmentViews) {
+  public function setAttachmentViews(array $attachmentViews = []) {
     $this->attachmentViews = $attachmentViews;
   }
 
diff --git a/src/Services/ChartAttachmentServiceInterface.php b/src/Services/ChartAttachmentServiceInterface.php
index c8718c5..4961ce1 100644
--- a/src/Services/ChartAttachmentServiceInterface.php
+++ b/src/Services/ChartAttachmentServiceInterface.php
@@ -2,17 +2,25 @@
 
 namespace Drupal\charts\Services;
 
+/**
+ * Defines an interface for Chart attachment service classes.
+ */
 interface ChartAttachmentServiceInterface {
+
   /**
-   * @return $attachmentViews an array of different views.
+   * Get Attachment Views.
+   *
+   * @return array
+   *   Different views.
    */
-
   public function getAttachmentViews();
 
   /**
-   * @param $attachmentViews is an array of views.
+   * Set Attachment Views.
+   *
+   * @param array $attachmentViews
+   *   Attach an array of views.
    */
-
-  public function setAttachmentViews($attachmentViews);
+  public function setAttachmentViews(array $attachmentViews = []);
 
 }
diff --git a/src/Services/ChartService.php b/src/Services/ChartService.php
index f599c74..63a2c5f 100644
--- a/src/Services/ChartService.php
+++ b/src/Services/ChartService.php
@@ -5,30 +5,23 @@ namespace Drupal\charts\Services;
 /**
  * Service class for getting and setting the currently selected library's state.
  *
- * Class ChartService
- *
  * @package Drupal\charts\Services
  */
-
 class ChartService implements ChartServiceInterface {
 
   private $librarySelected;
 
   /**
-   * Gets the currently selected Library.
-   *
-   * @return string $librarySelected
+   * {@inheritdoc}
    */
   public function getLibrarySelected() {
     return $this->librarySelected;
   }
 
   /**
-   * Sets the previously set Library with the newly selected library value.
-   *
-   * @param string $librarySelected
+   * {@inheritdoc}
    */
-  public function setLibrarySelected($librarySelected) {
+  public function setLibrarySelected($librarySelected = '') {
     $this->librarySelected = $librarySelected;
   }
 
diff --git a/src/Services/ChartServiceInterface.php b/src/Services/ChartServiceInterface.php
index cef0129..d873595 100644
--- a/src/Services/ChartServiceInterface.php
+++ b/src/Services/ChartServiceInterface.php
@@ -7,17 +7,22 @@ namespace Drupal\charts\Services;
  *
  * @package Drupal\charts\Services
  */
-
 interface ChartServiceInterface {
+
   /**
-   * @return mixed
+   * Gets the currently selected Library.
+   *
+   * @return string
+   *   Library selected.
    */
-
   public function getLibrarySelected();
 
   /**
-   * @param $librarySelected
+   * Sets the previously set Library with the newly selected library value.
+   *
+   * @param string $librarySelected
+   *   Library selected.
    */
-  public function setLibrarySelected($librarySelected);
+  public function setLibrarySelected($librarySelected = '');
 
 }
diff --git a/src/Services/ChartsSettingsService.php b/src/Services/ChartsSettingsService.php
index ecaa4c8..ed46eed 100644
--- a/src/Services/ChartsSettingsService.php
+++ b/src/Services/ChartsSettingsService.php
@@ -4,15 +4,27 @@ namespace Drupal\charts\Services;
 
 use Drupal\Core\Config\ConfigFactory;
 
+/**
+ * Charts Settings Service.
+ */
 class ChartsSettingsService implements ChartsSettingsServiceInterface {
 
   //private $editableConfigName = 'charts.settings';
   private $configFactory;
 
+  /**
+   * Construct.
+   * 
+   * @param \Drupal\Core\Config\ConfigFactory $config_factory
+   *   Config factory.
+   */
   public function __construct(ConfigFactory $config_factory) {
     $this->configFactory = $config_factory;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function getChartsSettings() {
     $config = $this->configFactory->getEditable('charts.settings');
 
diff --git a/src/Services/ChartsSettingsServiceInterface.php b/src/Services/ChartsSettingsServiceInterface.php
index 07ab16f..2b183ba 100644
--- a/src/Services/ChartsSettingsServiceInterface.php
+++ b/src/Services/ChartsSettingsServiceInterface.php
@@ -1,10 +1,18 @@
 <?php
 
-
 namespace Drupal\charts\Services;
 
-
+/**
+ * Charts Settings Service Interface.
+ */
 interface ChartsSettingsServiceInterface {
 
+  /**
+   * Get Charts Settings.
+   *
+   * @return array
+   *   Charts settings.
+   */
   public function getChartsSettings();
-}
\ No newline at end of file
+
+}
diff --git a/src/Util/Util.php b/src/Util/Util.php
index 11f1942..e57817f 100644
--- a/src/Util/Util.php
+++ b/src/Util/Util.php
@@ -2,18 +2,32 @@
 
 namespace Drupal\charts\Util;
 
+use Drupal\views\ViewExecutable;
+
+/**
+ * Util.
+ */
 class Util {
 
   /**
-   * @param $view
-   * @param $labelValues
-   * @param $labelField
-   * @param $color
+   * Views Data.
+   *
+   * @param \Drupal\views\ViewExecutable $view
+   *   View.
+   * @param array $labelValues
+   *   Label Values.
+   * @param string $labelField
+   *   Label Field.
+   * @param array $color
+   *   Colors.
+   * @param string|null $attachmentChartTypeOption
+   *   Attachment Chart Type Option.
+   *
    * @return array
+   *   Data.
    */
-  public static function viewsData($view, $labelValues, $labelField, $color, $attachmentChartTypeOption) {
+  public static function viewsData(ViewExecutable $view = NULL, array $labelValues = [], $labelField = '', array $color = [], $attachmentChartTypeOption = NULL) {
     $data = [];
-
     foreach ($view->result as $row_number => $row) {
       $numberFields = 0;
       $rowData = [];
@@ -24,11 +38,11 @@ class Util {
             $tokenized_text = trim(str_replace("\n", '', strip_tags($view->field[$labelField]->tokenizeValue($text, $row_number))));
         }
         $rowData[$numberFields] = [
-          'value' => $view->field[$fieldId]->getValue($row),
+          'value'       => $view->field[$fieldId]->getValue($row),
           'label_field' => ($alter_text) ? $tokenized_text : $view->field[$labelField]->getValue($row),
-          'label' => $view->field[$fieldId]->label(),
-          'color' => $color[$fieldId],
-          'type' => $attachmentChartTypeOption,
+          'label'       => $view->field[$fieldId]->label(),
+          'color'       => $color[$fieldId],
+          'type'        => $attachmentChartTypeOption,
         ];
         $numberFields++;
       }
@@ -39,10 +53,15 @@ class Util {
   }
 
   /**
-   * Removes unselected fields
+   * Removes unselected fields.
+   *
+   * @param array $valueField
+   *   Value Field.
+   *
+   * @return array
+   *   Field Values.
    */
-
-  public static function removeUnselectedFields($valueField) {
+  public static function removeUnselectedFields(array $valueField = []) {
     $fieldValues = [];
     foreach ($valueField as $key => $value) {
       if (!empty($value)) {
@@ -53,10 +72,15 @@ class Util {
   }
 
   /**
-   * Creates chart data to be used later by visualization frameworks
+   * Creates chart data to be used later by visualization frameworks.
+   *
+   * @param string $data
+   *   Data.
+   *
+   * @return array
+   *   Chart Data.
    */
-
-  public static function createChartableData($data) {
+  public static function createChartableData(array $data = []) {
     $chartData = [];
     $categories = [];
     $seriesData = [];
@@ -80,13 +104,14 @@ class Util {
   }
 
   /**
-   * Checks for missing libraries necessary for data visualization
-   *
-   * @param $moduleName
-   * @param $libraryPath
+   * Checks for missing libraries necessary for data visualization.
    *
+   * @param string $moduleName
+   *   Module name.
+   * @param string $libraryPath
+   *   Library Path.
    */
-  public static function checkMissingLibrary($moduleName, $libraryPath) {
+  public static function checkMissingLibrary($moduleName = '', $libraryPath = '') {
     $module_path = drupal_get_path('module', $moduleName);
     if (!file_exists($module_path . $libraryPath)) {
       drupal_set_message(t('Charting libraries for ' . $moduleName . ' might 
-- 
GitLab