Skip to content

Default / 0 values for Y axis on every tick on X #3328

@turigeza

Description

@turigeza

My apologies for asking it here. I did ask on stackoverflow but no luck. Any help would be greatly appreciated.
http://stackoverflow.com/questions/39547512/default-0-value-for-missing-data

exmei

I would like missing Y values to default to 0 without me explicitly submitting the value as 0.

On the screenshot the data what is in the table was plotted onto the chart.

It is displayed in green. The red is what I would like to achieve. Notice how I have only got data for 7 days.

Is there any way that I can achieve this? In someway I would have expected this to be the default behaviour ... so it might just be an option I can not find in the docs.

The code is similar to this one:

reportChart = new Chart(reportChartElement, {
                type: 'line',
                data: data,
                options: {
                    spanGaps: true,
                    scales: {
                        xAxes: [{
                            ticks: {
                                //autoSkip:true,
                            },
                            type: 'time',
                            time: {
                                unit: 'day',
                                displayFormats: {

                                }
                            }
                        }],
                        yAxes: [{
                            ticks: {
                                min: 0,
                                stepSize: 1
                            }
                        }]
                    }
                }

            });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions