KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

0 points in Google line chart #2764

Closed Eugene opened this topic on on Jul 26, 2022 - 2 comments

Eugene commented on Jul 26, 2022

How to avoid drawing 0 points in the chart?

Sebastian Morales commented on Jul 26, 2022

You can try "interpolateNulls" option in case some of your values are null:

    // MyReport.view.php
    LineChart::create(array(
        ...
        "options" => array(
            "interpolateNulls" => true,
            ...
        ),
    ));

If you want to skip 0 values as well, convert 0 to null with Map process:

    // MyReport.php
    ->pipe(new \koolreport\processes\Map(array(
        "{value}" => function($row) {
            foreach ($row as $k => $v) {
               if ($v === 0) $row[$k] = null;
            }
            return $row;
        }
    )))
Eugene commented on Jul 26, 2022

Thank you

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None