Manage data gap in Google Chart

Created on 14 August 2020, over 4 years ago
Updated 16 April 2025, 16 days ago

Problem/Motivation

I need to plot some data gap in my charts as described in this example http://jsfiddle.net/asgallant/fXq5r/
So, when I build my $seriesData array I put NULL values where gaps occur, but this module replaces NULL with 0 inside method buildVariables() of Google.php class.

Steps to reproduce

Build a chart using a data series array like:

[
  "name" => "Cal_22 EE",
  "color" => "#8bbc21",
  "type" => "spline",
  "data" => [
      0 => null,
      1 => null,
      2 => null,
      3 => null,
      4 => null,
      5 => null,
      6 => 53.42,
      7 => 54.33,
      8 => 54.15,
      9 => 54.75,
      10 => 54.95,
      11 => 55.55,
      12 => 55.64,
      13 => 55.83,
      14 => 55.42,
      15 => 55.49,
  ],
];

Proposed resolution

Replace $rowDataTabletemp = 0; to $rowDataTabletemp = NULL; in the following condition

          if (isset($seriesData[$i]['data'][$j])) {
            $rowDataTabletemp = $seriesData[$i]['data'][$j];
            array_push($rowDataTable, $rowDataTabletemp);
          }
          else {
            $rowDataTabletemp = 0;
            array_push($rowDataTable, $rowDataTabletemp);
          }
📌 Task
Status

Closed: works as designed

Version

3.2

Component

Google Charts integration

Created by

🇮🇹Italy robertoperuzzo 🇮🇹 Tezze sul Brenta, VI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024