Skip to content

Bar chart broken when using Chart.js 2.9.0+ and using tooltip #6

@markokimpel

Description

@markokimpel

Steps to repeat:

When using Chart.js 2.9.0 (or the latest 2.9.4) a JavaScript error is thrown when hovering over a bar and the chart remains in a white-ish color.

I did some digging:

  • In chartjs-plugin-rough.js, RoughTooltip>drawBody>ctx.fillRect and ctx.StrokeRect 'options.fillOptions' and 'options.strokeOptions' are accessed. This is where the error occurs.
  • Variable 'options' is updated in the customized 'helpers.each'. The logic expects Chart.js to use helper.each to iterate. Chart.js is not using that method in that place anymore.

drawBody in Chart.js 2.8.0:
// Draw body lines now
helpers$1.each(body, function(bodyItem, i) {

drawBody in Chart.js 2.9.0:
// Draw body lines now
for (i = 0, ilen = body.length; i < ilen; ++i) {
bodyItem = body[i];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions