mheavers
mheavers

Reputation: 30178

chart.js - how to draw a thicker horizontal line at the zero point of a graph with negative and positive values

I'm building a stacked bar chart in chart.js and trying to make the zero point line (the point at which forest loss is at zero for each decade) darker / more obvious than the other horizontal grid lines. Is there an option for this? If not, how might I accomplish it with code?enter image description here

Upvotes: 4

Views: 1204

Answers (1)

Christopher
Christopher

Reputation: 3677

It's mentioned at the Styling section in the docs and it's called lineWidth.

This related question might also be helpful: Chart.js how to use scriptable options

options {
  scales: {
    y: {
      grid: {
        lineWidth: ({ tick }) => tick.value == 0 ? 10 : 1
      }
    }
  }
}

Upvotes: 6

Related Questions