Skip to content

Fix xyz column convert routine for columns containing nulls #1491

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

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

etpinard
Copy link
Contributor

So that

var x = [  0,  0,   0,  5,  null,   5,  10,  10,   10 ];
var y = [  0,  5,  10,  0,  null,  10,   0,   5,   10 ];
var z = [  0, 50, 100, 50,  null, 255, 100, 510, 1010 ];

Plotly.newPlot('graph', [{
  type: 'heatmap',
  x: x,
  y: y,
  z: z
}])

doesn't lead to index errors.


@rreusser unfortunately, commit 93a70be wiil conflict with your carpet PR #1239. I can help merge master into #1239 once this PR is in.

- as Lib.distinctVals + Lib.findBin don't work properly
  (and shouldn't) for non-numeric values
@etpinard etpinard added status: reviewable bug something broken labels Mar 16, 2017
@etpinard etpinard changed the title Fix convert xyz column convert routine for columns containing nulls Fix xyz column convert routine for columns containing nulls Mar 16, 2017
@etpinard etpinard added this to the v1.25.0 milestone Mar 16, 2017
@rreusser
Copy link
Contributor

All good. It shouldn't be too bad. I hardly did anything except generalize the column names a bit since carpet === x => a, y => b, z => [x, y], more or less.


if(hasColumnText) text = Lib.init2dArray(y.length, x.length);

for(i = 0; i < colLen; i++) {
ix = Lib.findBin(xCol[i] + xColdv.minDiff / 2, x);
iy = Lib.findBin(yCol[i] + yColdv.minDiff / 2, y);
if(xCol[i] !== BADNUM && yCol[i] !== BADNUM) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah right - because xCol and yCol have already gone through d2c so anything invalid (null, text, whatever) will have become BADNUM - nice.

@alexcjohnson
Copy link
Collaborator

💃

@etpinard etpinard merged commit b23fc92 into master Mar 17, 2017
@etpinard etpinard deleted the convert-column-fixes branch March 17, 2017 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants