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

Does not work with typed array data columns #7

Closed
etpinard opened this issue May 1, 2018 · 4 comments
Closed

Does not work with typed array data columns #7

etpinard opened this issue May 1, 2018 · 4 comments

Comments

@etpinard
Copy link
Member

etpinard commented May 1, 2018

Consider:

const regl = require('regl')({ extensions: 'oes_element_index_uint' })
const createMatrix = require('./')

let splom = createMatrix(regl)

splom.update({
  data: [
    new Float32Array([1, 2, 3]),
    new Float32Array([4, 6, 8]),
    new Float32Array([1, 5, 9])
  ],
  ranges: [
    [0, 10],
    [0, 10],
    [0, 10]
  ],
  domain: [
    [0, 0, 0.3, 0.3],
    [0.35, 0.35, 0.65, 0.65],
    [0.7, 0.7, 1, 1] 
  ],
  color: ['red', 'green', 'blue'],
  size: [20, 10, 30]
})

splom.draw()

this gives:

image

and a blank screen.


Is this a known limitation of this implementation? That is, should we try to convert typed array to plain arrays in plotly.js? Or would there be an easy way to make regl-splom accept typed arrays?

@dy
Copy link
Member

dy commented May 1, 2018

Should be fixed in 1.0.1.

@etpinard
Copy link
Member Author

etpinard commented May 1, 2018

Thanks @dy ! Sploms are now working with Float32Array, but they are still broken with Int32Array (as in plotly/plotly.js#2585) and possibly other types.

For example,

const regl = require('regl')({ extensions: 'oes_element_index_uint' })
const createMatrix = require('./')

let splom = createMatrix(regl)

splom.update({
  data: [
    new Int32Array([1, 2, 3]),
    new Int32Array([4, 6, 8]),
    new Int32Array([1, 5, 9])
  ],
  ranges: [
    [0, 10],
    [0, 10],
    [0, 10]
  ],
  domain: [
    [0, 0, 0.3, 0.3],
    [0.35, 0.35, 0.65, 0.65],
    [0.7, 0.7, 1, 1] 
  ],
  color: ['red', 'green', 'blue'],
  size: [20, 10, 30]
})

splom.draw()

gives

image

and a blank screen.


Looks like regl-scatter2d accepts Int32Array just fine. Could we make regl-splom do the same?

@dy dy reopened this May 1, 2018
@dy
Copy link
Member

dy commented May 1, 2018

Ok, now should be fixed )

@etpinard
Copy link
Member Author

etpinard commented May 1, 2018

Sweet. This works:

lotly.newPlot( gd,
			  [{
    "type": "splom",
    "dimensions": [{
      "values": new Int32Array([1, 2, 3]),
      "label": "A"
    }, {
      "values": new Int32Array([2, 5, 6]),
      "label": "B"
    }]
  }]);

gives
image

@etpinard etpinard closed this as completed May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants