-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bug null data #286
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
Bug null data #286
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,10 +184,13 @@ module.exports = function setConvert(ax) { | |
| // that aren't in the first etc. | ||
| // TODO: sorting options - do the sorting | ||
| // progressively here as we insert? | ||
| if(ax._categories.indexOf(v)===-1) ax._categories.push(v); | ||
|
|
||
| var c = ax._categories.indexOf(v); | ||
| return c===-1 ? constants.BADNUM : c; | ||
| if(v !== null && v !== undefined && ax._categories.indexOf(v) === -1){ | ||
| ax._categories.push(v); | ||
| return ax._categories.length - 1; | ||
|
||
| }else{ | ||
| return constants.BADNUM; | ||
| } | ||
| }; | ||
|
|
||
| ax.d2l = ax.d2c; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| var Plotly = require('@lib/index'); | ||
|
|
||
| var createGraphDiv = require('../assets/create_graph_div'); | ||
| var destroyGraphDiv = require('../assets/destroy_graph_div'); | ||
|
|
||
| describe('calculated data and points', function() { | ||
| describe('connectGaps', function() { | ||
|
|
||
| var gd; | ||
|
|
||
| beforeEach(function() { | ||
| gd = createGraphDiv(); | ||
| }); | ||
|
|
||
| afterEach(destroyGraphDiv); | ||
|
|
||
| it('should exclude null and undefined points when false', function() { | ||
| Plotly.plot(gd, [{ x: [1,2,3,undefined,5], y: [1,null,3,4,5]}], {}); | ||
|
|
||
| expect(gd.calcdata[0][1]).toEqual({ x: false, y: false}); | ||
| expect(gd.calcdata[0][3]).toEqual({ x: false, y: false}); | ||
| }); | ||
|
|
||
| it('should exclude null and undefined points as categories when false', function() { | ||
| Plotly.plot(gd, [{ x: [1,2,3,undefined,5], y: [1,null,3,4,5] }], { xaxis: { type: 'category' }}); | ||
|
|
||
| expect(gd.calcdata[0][1]).toEqual({ x: false, y: false}); | ||
| expect(gd.calcdata[0][3]).toEqual({ x: false, y: false}); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah man 🎉 |
||
| }); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, maybe we should make that standard: http://eslint.org/docs/rules/no-eq-null