Skip to content

Commit 262da68

Browse files
committed
feat: add plot/vega/transform/collect
1 parent 9f578f0 commit 262da68

10 files changed

Lines changed: 669 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
var Compare = require( '@stdlib/plot/vega/compare/ctor' );
22+
var CollectTransform = require( './../lib' );
23+
24+
var compare = new Compare({
25+
'field': 'amount'
26+
});
27+
28+
var transform = new CollectTransform({
29+
'sort': compare
30+
});
31+
console.log( transform.toJSON() );
32+
33+
compare = new Compare({
34+
'field': [ 'amount', 'date' ],
35+
'order': [ 'descending', 'ascending' ]
36+
});
37+
transform.sort = compare;
38+
console.log( transform.toJSON() );
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MAIN //
22+
23+
/**
24+
* Returns a new change event object.
25+
*
26+
* @private
27+
* @param {string} property - property name
28+
* @returns {Object} event object
29+
*/
30+
function event( property ) { // eslint-disable-line stdlib/no-redeclare
31+
return {
32+
'type': 'update',
33+
'source': 'transform',
34+
'property': property
35+
};
36+
}
37+
38+
39+
// EXPORTS //
40+
41+
module.exports = event;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* Collect transform constructor.
23+
*
24+
* @module @stdlib/plot/vega/transform/collect
25+
*
26+
* @example
27+
* var Compare = require( '@stdlib/plot/vega/compare/ctor' );
28+
* var CollectTransform = require( '@stdlib/plot/vega/transform/collect' );
29+
*
30+
* var compare = new Compare({
31+
* 'field': 'amount'
32+
* });
33+
* // returns <Compare>
34+
*
35+
* var transform = new CollectTransform({
36+
* 'sort': compare
37+
* });
38+
* // returns <CollectTransform>
39+
*/
40+
41+
// MODULES //
42+
43+
var main = require( './main.js' );
44+
45+
46+
// EXPORTS //
47+
48+
module.exports = main;

0 commit comments

Comments
 (0)