Skip to content

A firefox fix in Chart.Core.Js actually breaks the Chart.js library on Firefox and Internet Explorer #1198

Description

@sander1095

Hello everyone.

I had some trouble with Internet Explorer and Firefox and after some digging I found out that on these 2 browsers the style attribute of the chart canvas is not right. The Height/Width values will be 0 and this means that I can not see any charts.

I am using Knockback.js, this might be a part of the issue. I also calculate the height and width of the canvas myself, which is also not required. This might also be a part of the issue.

Chrome:

<canvas data-bind="barChart" style="padding: 10px; width: 200px; height: 170px;" width="200" height="170"></canvas>

Firefox:

<canvas height="0" width="0" data-bind="barChart" style="padding: 10px; width: 0px; height: 0px;"></canvas>

Internet Explorer:

<canvas width="0" height="0" style="padding: 10px; width: 0px; height: 0px;" data-bind="barChart"></canvas>

As you can see, Internet Explorer and Firefox's Height and Width are 0. This is WRONG and causes the Canvas not to draw the chart!

In the Chart.Core.Js file, around line 43, it says the following:

// Firefox requires this to work correctly     
    context.canvas.width  = width;
    context.canvas.height = height;

If you disable these lines, the charts will work Perfectly on Internet Explorer and Firefox. I hope someone can look into this problem!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions