question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radial scale fails when radius is negative

See original GitHub issue

ctx.beginPath();
	if (circular) {
		ctx.arc(scale.xCenter, scale.yCenter, radius, 0, TAU);  <--- ERROR radius = -39
	} else {
		pointPosition = scale.getPointPosition(0, radius);
		ctx.moveTo(pointPosition.x, pointPosition.y);
		for (let i = 1; i < valueCount; i++) {
			pointPosition = scale.getPointPosition(i, radius);
			ctx.lineTo(pointPosition.x, pointPosition.y);
		}
	}

Uncaught DOMException: Failed to execute 'arc' on 'CanvasRenderingContext2D': The radius provided (-39) is negative.
    at drawRadiusLine (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:11228:7)
    at http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:11371:6
    at Array.forEach (<anonymous>)
    at RadialLinearScale.drawGrid (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:11368:13)
    at RadialLinearScale.draw (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:4882:6)
    at Object.draw (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:4895:9)
    at Chart.draw (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:5750:14)
    at Chart.render (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:5729:7)
    at Chart.update (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:5677:6)
    at Chart._resize (http://testserver.home:8123/hacsfiles/chart-card/chart.js?module:5489:7)
drawRadiusLine @ chart.js?module:11228
(anonymous) @ chart.js?module:11371
drawGrid @ chart.js?module:11368
draw @ chart.js?module:4882
draw @ chart.js?module:4895
draw @ chart.js?module:5750
render @ chart.js?module:5729
update @ chart.js?module:5677
_resize @ chart.js?module:5489
resize @ chart.js?module:5463
listener @ chart.js?module:5938
(anonymous) @ chart.js?module:1710
(anonymous) @ chart.js?module:34
(anonymous) @ chunk.af43f6ec356055cbfe65.js:1
requestAnimationFrame (async)
window.requestAnimationFrame @ chunk.af43f6ec356055cbfe65.js:1
(anonymous) @ chart.js?module:32
(anonymous) @ chart.js?module:1722

_Originally posted by @zibous in https://github.com/chartjs/Chart.js/issues/8147#issuecomment-742390596_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
etimbergcommented, Jan 31, 2021

I think this got fixed in #8191

0reactions
UrielMaDcommented, Dec 18, 2020

Hello @etimberg , I just ended a PR for the radius validation, let me know if there’s something wrong or if it needs another thing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can the radius of a circle be negative? - Quora
No. Radius is a distance, and as we know that in the 2 or 3 dimensions there cant be a distance that goes...
Read more >
Arc negative radius no rerender #8150 - chartjs/Chart.js - GitHub
In version 2 if the arc radius was negative it wouldn't render but as soon as it could because it was becoming positive...
Read more >
Negative strength of radial force component not work on ...
I have radial force component in my project with negative strength, which I use to simulate gravity(force strength set to -50000.0).
Read more >
Consequences of calibration errors. (a) Radial error r e from a...
Consequences of calibration errors. (a) Radial error r e from a positive (solid) and negative (dashed) X-axis offset as a function of zenithal...
Read more >
Radial and Angular Parts of Atomic Orbitals
When the orbitals overlap so that the wave functions match positive to negative, the bond will be weaker or may not form at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found