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

Typed arrays support #2388

Merged
merged 28 commits into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
91b03ff
rename Lib.isArray -> Lib.isArrayOrTypedArray
etpinard Feb 20, 2018
a25ff13
accept typed array when coercing 'data_array' attributes
etpinard Feb 20, 2018
45c2f35
[PoC] bypass ax.d2c for typedArray during ax.makeCalcdata
etpinard Feb 20, 2018
2d81bdc
replace Array.isArray -> Lib.isArrayOrTypedArray in various places
etpinard Feb 20, 2018
bcf59d7
replace Lib.isArray -> Array.isArray in tests w/o typed arrays
etpinard Feb 20, 2018
bc32981
[wip] a few todos
etpinard Feb 20, 2018
2372629
Merge branch 'master' into typed-arrays-support
etpinard Feb 22, 2018
909120e
make scattergl dragmode relayout replot not recalc
etpinard Feb 26, 2018
5316c47
large lint commit in scattergl/index.js
etpinard Feb 26, 2018
0aa0f5e
improvements to Scattergl.calc
etpinard Feb 26, 2018
39ef5a9
update baselines
etpinard Feb 26, 2018
36b4e25
update jasmine tests for new scattergl auto-ranges
etpinard Feb 26, 2018
40f93f7
add svg vs gl scatter autorange :lock:s
etpinard Feb 26, 2018
d98dcc0
improve makeCalcdata typed array handling + some tests + some linting
etpinard Feb 26, 2018
c0e2f73
a few more Array.isArray -> Lib.isArrayOrTypedArray
etpinard Feb 26, 2018
09d37b6
some typed array tests
etpinard Feb 26, 2018
a7ed2c2
:lock: Plotly.restyle support for typed arrays
etpinard Feb 28, 2018
b95e462
add and :lock: typed array support for extendTraces and prependTraces
etpinard Feb 28, 2018
53ea0ec
Merge branch 'master' into typed-arrays-support
etpinard Feb 28, 2018
98d2407
use c2l instead of d2l
etpinard Feb 28, 2018
01a8443
:hocho: TODOs
etpinard Feb 28, 2018
c15722f
add mock :lock:ing down cleanNumber for scattergl
etpinard Feb 28, 2018
a2fb88b
Merge pull request #2404 from plotly/scattergl-autorange
etpinard Feb 28, 2018
f0395b5
improve isTypedArray
etpinard Feb 28, 2018
9b83826
don't require all of Lib when only isArrayOrTypedArray is needed
etpinard Feb 28, 2018
6dd2f69
turn coord typed arrays into plain array for 'date' and 'category axes
etpinard Feb 28, 2018
306986d
check that typed arrays items aren't all NaNs in hasColorscale
etpinard Feb 28, 2018
d4cb0c4
no need to check for typed array in outer array of a 2d array
etpinard Feb 28, 2018
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 test/jasmine/tests/parcoords_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ describe('@gl parcoords', function() {
function restyleDimension(key, setterValue) {

// array values need to be wrapped in an array; unwrapping here for value comparison
var value = Lib.isArray(setterValue) ? setterValue[0] : setterValue;
var value = Array.isArray(setterValue) ? setterValue[0] : setterValue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you need to do this?

Copy link
Contributor Author

@etpinard etpinard Feb 28, 2018

Choose a reason for hiding this comment

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

Because Lib.isArray is no more. It was replaced by Lib.isArrayOrTypedArray and Lib.isTypedArray. Here, these parcoord test don't use typed arrays, so good old Array.isArray calls suffice.


return function() {
return Plotly.restyle(gd, 'dimensions[2].' + key, setterValue).then(function() {
Expand Down Expand Up @@ -875,7 +875,7 @@ describe('@gl parcoords', function() {
Plotly.plot(gd, mockCopy.data, mockCopy.layout);

function restyleDimension(key, dimIndex, setterValue) {
var value = Lib.isArray(setterValue) ? setterValue[0] : setterValue;
var value = Array.isArray(setterValue) ? setterValue[0] : setterValue;
return function() {
return Plotly.restyle(gd, 'dimensions[' + dimIndex + '].' + key, setterValue).then(function() {
expect(gd.data[0].dimensions[dimIndex][key]).toEqual(value, 'for dimension attribute \'' + key + '\'');
Expand Down
8 changes: 4 additions & 4 deletions test/jasmine/tests/sankey_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('sankey tests', function() {
}
});

expect(Lib.isArray(fullTrace.node.color)).toBe(true, 'set up color array');
expect(Array.isArray(fullTrace.node.color)).toBe(true, 'set up color array');
expect(fullTrace.node.color).toEqual(['rgba(31, 119, 180, 0.8)', 'rgba(255, 127, 14, 0.8)']);

});
Expand All @@ -197,7 +197,7 @@ describe('sankey tests', function() {
}
}, {colorway: ['rgb(255, 0, 0)', 'rgb(0, 0, 255)']});

expect(Lib.isArray(fullTrace.node.color)).toBe(true, 'set up color array');
expect(Array.isArray(fullTrace.node.color)).toBe(true, 'set up color array');
expect(fullTrace.node.color).toEqual(['rgba(255, 0, 0, 0.8)', 'rgba(0, 0, 255, 0.8)']);

});
Expand All @@ -215,7 +215,7 @@ describe('sankey tests', function() {
}
});

expect(Lib.isArray(fullTrace.link.label)).toBe(true, 'must be an array');
expect(Array.isArray(fullTrace.link.label)).toBe(true, 'must be an array');
expect(fullTrace.link.label).toEqual([], 'an array of empty strings');
});

Expand All @@ -233,7 +233,7 @@ describe('sankey tests', function() {
}
});

expect(Lib.isArray(fullTrace.link.label)).toBe(true, 'must be an array');
expect(Array.isArray(fullTrace.link.label)).toBe(true, 'must be an array');
expect(fullTrace.link.label).toEqual(['a', 'b'], 'an array of the supplied values');
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/jasmine/tests/table_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ describe('table', function() {
function restyleValues(what, key, setterValue) {

// array values need to be wrapped in an array; unwrapping here for value comparison
var value = Lib.isArray(setterValue) ? setterValue[0] : setterValue;
var value = Array.isArray(setterValue) ? setterValue[0] : setterValue;

return function() {
return Plotly.restyle(gd, what + '.values[' + key + ']', setterValue).then(function() {
Expand Down Expand Up @@ -367,7 +367,7 @@ describe('table', function() {

function restyleValues(what, fun, setterValue) {

var value = Lib.isArray(setterValue) ? setterValue[0] : setterValue;
var value = Array.isArray(setterValue) ? setterValue[0] : setterValue;

return function() {
return Plotly.restyle(gd, what, setterValue).then(function() {
Expand Down