codeigniter-highcharts-library icon indicating copy to clipboard operation
codeigniter-highcharts-library copied to clipboard

Passing null values to missing points graphs

Open antoniomacs opened this issue 13 years ago • 1 comments

In case you need to pass null values to generate non linear data rows, you can't since the class simply discards empty or null values.

This is the fix for the moment: [file:application/library/highcharts.php:343]

public function push_serie_data($value = '', $serie_name = ''){

    if ($serie_name AND $value)
    {
        $index = $this->find_serie_name($serie_name);

        $value = (is_numeric($value)) ? (float)$value : $value;

        $this->opts['series'][$index]['data'][] = $value;
    } else {
        if($value===NULL) {
            $index = $this->find_serie_name($serie_name);
            $value = null;
            $this->opts['series'][$index]['data'][] = $value;
        }
    }
    return $this;
}

antoniomacs avatar Jan 29 '12 00:01 antoniomacs

Maybe simply by not testing value ?

public function push_serie_data($value = '', $serie_name = ''){

    if ($serie_name)
    {
        $index = $this->find_serie_name($serie_name);

        $value = (is_numeric($value)) ? (float)$value : $value;

        $this->opts['series'][$index]['data'][] = $value;
    }
    return $this;
}

ronan-gloo avatar Jan 30 '12 15:01 ronan-gloo