Commit 49b27b8f authored by Nia Kathoni's avatar Nia Kathoni
Browse files

Issue #3317896 by nikathone: Make it easier for other module to extend...

Issue #3317896 by nikathone: Make it easier for other module to extend existing hichcharts charts plugin
parent 107e11e2
Loading
Loading
Loading
Loading
+5 −9
Changes for modules/charts_highcharts/src/Plugin/chart/Library/Highcharts.php: 5 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -479,7 +479,7 @@ class Highcharts extends ChartBase implements ContainerFactoryPluginInterface {
   * @return array
   *   Return the chart definition.
   */
  private function populateOptions(array $element, array $chart_definition) {
  protected function populateOptions(array $element, array $chart_definition) {
    $chart_type = $this->getType($element['#chart_type']);
    $chart_definition['chart']['type'] = $chart_type;
    $chart_definition['chart']['backgroundColor'] = $element['#background'];
@@ -600,7 +600,7 @@ class Highcharts extends ChartBase implements ContainerFactoryPluginInterface {
   * @return array
   *   Return the chart definition.
   */
  private function populateData(array &$element, array $chart_definition) {
  protected function populateData(array &$element, array $chart_definition) {
    $categories = [];
    $chart_type = $this->getType($element['#chart_type']);
    foreach (Element::children($element) as $key) {
@@ -776,7 +776,7 @@ class Highcharts extends ChartBase implements ContainerFactoryPluginInterface {
   * @return array
   *   Return the chart definition.
   */
  private function populateAxes(array $element, array $chart_definition) {
  protected function populateAxes(array $element, array $chart_definition) {
    foreach (Element::children($element) as $key) {
      if ($element[$key]['#type'] === 'chart_xaxis' || $element[$key]['#type'] === 'chart_yaxis') {
        // Make sure defaults are loaded.
@@ -837,12 +837,8 @@ class Highcharts extends ChartBase implements ContainerFactoryPluginInterface {
   * @return string
   *   Return the chart type.
   */
  private function getType($type) {
    if ($type === 'donut') {
      $type = 'pie';
    }

    return $type;
  protected function getType($type) {
    return $type === 'donut' ? 'pie' : $type;
  }

  private function datesDataForConfigForm() {