KoolReport's Forum

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

How to set data number starting from zero #1162

Open Fuad Pashayev opened this topic on on Nov 18, 2019 - 6 comments

Fuad Pashayev commented on Nov 18, 2019

How to set data number starting from 0 not the smallest data. Currently if there is 3 data e.g: 5, 25, 48. ChartJS BarChart starts data from 5,and that column not displaying normally

David Winterburn commented on Nov 19, 2019

Hi Fuad,

If you are using ChartJS, please find this option at:

https://www.chartjs.org/docs/latest/axes/cartesian/linear.html

It should be either beginAtZero or suggestedMin = 0.

Fuad Pashayev commented on Nov 19, 2019

Which file I have to add this lines? I use report via directly koolreport

KoolReport commented on Nov 21, 2019

Sorry for our late reply, it should be like this

BarChart::create([
    ...
    "options"=>[
        "scales"=> [
            "yAxes": [[
                "display"=> true,
                "ticks"=> [
                    "beginAtZero"=> true,
                    "max"=>100,
                    "min"=>0
                ]
            ]]
        ],
    ]
]);
Fuad Pashayev commented on Nov 22, 2019

It worked,but it adds additional dates also to bottom.Look at the picture,dates should be only on the red lines,but it also adds to the bottom due to ticks option,how can I set beginAtZero but not displaying additional dates

Fuad Pashayev commented on Nov 24, 2019

Can you please,help around the issue?I need quick fix,deadline is coming.

David Winterburn commented on Nov 25, 2019

Please post your entire chart's php set up for us to check it for you. Thanks!

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

ChartJS