Skip to content

[BUG]Infinite loop when canvas width = 0 and padding > 0 #5047

Description

@fanthos

When the canvas width is smaller than padding left and right, results chartWidth and chartAreaWidth at Chart.js#6221 negative number, causes infinite loop when calculating axis.

// Step 1
var chartWidth = width - leftPadding - rightPadding;
var chartHeight = height - topPadding - bottomPadding;
var chartAreaWidth = chartWidth / 2; // min 50%
var chartAreaHeight = chartHeight / 2; // min 50%

Solution:
Check width and height are positive or 0 before update the chart.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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