Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Infinity datapoints in getRightValue #3133

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ module.exports = function(Chart) {
if (rawValue === null || typeof(rawValue) === 'undefined') {
return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number
if (typeof(rawValue) === 'number' && isNaN(rawValue)) {
// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
if (typeof(rawValue) === 'number' && !isFinite(rawValue)) {
return NaN;
}
// If it is in fact an object, dive in one more level
Expand Down
4 changes: 2 additions & 2 deletions test/scale.linear.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ describe('Linear Scale', function() {
data: {
datasets: [{
yAxisID: 'yScale0',
data: [null, 90, NaN, undefined, 45, 30]
data: [null, 90, NaN, undefined, 45, 30, Infinity, -Infinity]
}],
labels: ['a', 'b', 'c', 'd', 'e', 'f']
labels: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
},
options: {
scales: {
Expand Down
6 changes: 3 additions & 3 deletions test/scale.logarithmic.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ describe('Logarithmic Scale tests', function() {
type: 'bar',
data: {
datasets: [{
data: [undefined, 10, null, 5, 5000, NaN, 78, 450]
data: [undefined, 10, null, 5, 5000, NaN, 78, 450, Infinity, -Infinity]
}, {
data: [undefined, 28, null, 1000, 500, NaN, 50, 42]
data: [undefined, 28, null, 1000, 500, NaN, 50, 42, Infinity, -Infinity]
}],
labels: ['a', 'b', 'c', 'd', 'e', 'f' ,'g']
labels: ['a', 'b', 'c', 'd', 'e', 'f' ,'g', 'h', 'i']
},
options: {
scales: {
Expand Down
4 changes: 2 additions & 2 deletions test/scale.radialLinear.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ describe('Test the radial linear scale', function() {
type: 'radar',
data: {
datasets: [{
data: [50, 60, NaN, 70, null, undefined]
data: [50, 60, NaN, 70, null, undefined, Infinity, -Infinity]
}],
labels: ['lablel1', 'label2', 'label3', 'label4', 'label5', 'label6']
labels: ['lablel1', 'label2', 'label3', 'label4', 'label5', 'label6', 'label7', 'label8']
},
options: {
scales: {
Expand Down