Skip to content

Draw line annotation on top of first dataset but under second dataset #887

@andy1547

Description

@andy1547

Currently using the drawTime: beforeDatasetsDraw option to ensure the first dataset is drawn on top of the line annotation (I'm using plugin to draw a y = 0 line).

I'd like to add a second dataset that gets drawn under the line annotation, the use case is that I'm using the fill: 0 option for this dataset so the line annotation should take preference.

The z index order ASC should be:
dataset #2 (using fill up to dataset #1)
line annotation (y = 0)
dataset #1 (not filled, just a line)

Is this possible? I assume the z index option is only in relation to other annotations and nothing to do with datasets.
I'm using chart.js v4.3.0 and v2.2.1 of the plugin.

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