Skip to content

Function isChartEmpty not able to handle nulls in dataset. #4

@Telchii

Description

@Telchii

The function isChartEmpty throws a type error when validating data that has gaps, or, null values. The error originates during the first filter of isChartEmpty, TypeError: Cannot read property 'X' of null. The data I'm using is a mix of integers and null values. e.g., [3, 6, null, 12].

Null data means no data, right? Not necessarily. Null is a proper way to represent a gap in the data.
For example, showing run times for a given task. If a point does not have a time value, a value of zero would indicate that the given task took literally no time. Null would indicate that the task did not finish, resulting in a gap in the data.

I'm not sure what Chart.js supported when this plugin was created, but Chart.js currently allows gaps during rendering when a specific property is set. (see Dataset Properties -> spanGaps) Even if spanGaps is not enabled, Chart.js will attempt to skip gaps, effectively merging data around a given gap.

So my bug report-slash-feature request is gap support. If the spanGaps property is set in the Chart.js config (globally or on an individual dataset), allow nulls in the data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions