Skip to content

Background glitch on line chart with segments and gradient #9039

@devmount

Description

@devmount

Expected Behavior

When using a line chart with a gradient for backgroundColor and a dashed segment for the last segment of the chart, I expect the background to only fill the area below the line, no matter what size the chart has.

image

Current Behavior

Currently I experience a strange behavior here: As soon as I resize the chart smaller than a mysterious threshold (e.g. in my case <= 500px), the background glitches out of the line border to a triangle shape.

image

Possible Solution

I have no idea 🙈 But I tested that this bug DOESN'T occur if...

Steps to Reproduce

  1. Open https://codepen.io/devmount/pen/KKWPMdZ
  2. Set the view mode in Codepen to vertical (if not already set)
  3. Resize the viewport of the chart so see the bug

chartjs_background_glitch

Context

In my ThirdStats Thunderbird add-on, I'm visualizing email counts with Chart.js and I wanted to have those beautiful background gradients as well as make the last segment dashed to show, that the data in this segment isn't complete yet. That was when I found this bug:

image

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions