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

Sort + set 'categoryarray' #1689

Merged
merged 3 commits into from
May 16, 2017
Merged
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
Next Next commit
add sort vis categorial target test
  • Loading branch information
etpinard committed May 15, 2017
commit f98670349e2ddfd045cd5d1c435418535fbd4793
15 changes: 15 additions & 0 deletions test/jasmine/tests/transform_sort_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ describe('Test sort transform calc:', function() {
expect(out[0].y).toEqual([0, 2, 4, 3, 1]);
});

it('should sort via categorical targets', function() {
var trace = extend({
transforms: [{ target: 'marker.size' }]
});
trace.x = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'];

var out = _transform([trace]);

expect(out[0].x).toEqual(['F', 'D', 'C', 'E', 'A', 'G', 'B']);
expect(out[0].y).toEqual([3, 1, 3, 2, 1, 1, 2]);
expect(out[0].ids).toEqual(['p2', 'z', 'n2', 'p1', 'n0', 'p3', 'n1']);
expect(out[0].marker.size).toEqual([0, 1, 5, 6, 10, 10, 20]);
expect(out[0].marker.color).toEqual([0.3, 0.1, 0.3, 0.2, 0.1, 0.4, 0.2]);
});

it('should sort via custom targets', function() {
var out = _transform([extend({
transforms: [{
Expand Down