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
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ module.exports = function(Chart) {
// Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
getRightValue: function(rawValue) {
// Null and undefined values first
if (rawValue === null || typeof(rawValue) === 'undefined') {
if (rawValue === null || typeof(rawValue) === 'undefined' || rawValue === Infinity) {
Copy link
Contributor

@MatthieuRivaud MatthieuRivaud Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, we would have to test -Infinity as well.

I would use the isFinite global function [1] (/!\ not the Number.isFinite function, which IE doesn't support [2]). The check would need to be after the "object" checks, though.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite

return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number
Expand Down