Skip to content

Commit 2fb9c67

Browse files
authored
Merge branch 'refactor/plot' into refactor/plot-vega-transform-aggregate-ctor
2 parents bd4ebcf + 5d3cd6d commit 2fb9c67

11 files changed

Lines changed: 528 additions & 0 deletions

File tree

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# aggregateOperations
22+
23+
> List of supported Vega aggregate transform operations.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var aggregateOperations = require( '@stdlib/plot/vega/transform/aggregate-operations' );
41+
```
42+
43+
#### aggregateOperations()
44+
45+
Returns a list of aggregate transform operations.
46+
47+
```javascript
48+
var out = aggregateOperations();
49+
// returns [ 'count', 'valid', 'missing', 'distinct', 'sum', 'product', 'mean', 'average', 'variance', 'variancep', 'stdev', 'stdevp', 'stderr', 'median', 'q1', 'q3', 'ci0', 'ci1', 'min', 'max', 'argmin', 'argmax', 'values' ]
50+
```
51+
52+
</section>
53+
54+
<!-- /.usage -->
55+
56+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
57+
58+
<section class="notes">
59+
60+
</section>
61+
62+
<!-- /.notes -->
63+
64+
<!-- Package usage examples. -->
65+
66+
<section class="examples">
67+
68+
## Examples
69+
70+
<!-- eslint no-undef: "error" -->
71+
72+
```javascript
73+
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
74+
var aggregateOperations = require( '@stdlib/plot/vega/transform/aggregate-operations' );
75+
76+
var isAggregateOperation = contains( aggregateOperations() );
77+
78+
var bool = isAggregateOperation( 'count' );
79+
// returns true
80+
81+
bool = isAggregateOperation( 'median' );
82+
// returns true
83+
84+
bool = isAggregateOperation( 'beep' );
85+
// returns false
86+
87+
bool = isAggregateOperation( 'boop' );
88+
// returns false
89+
```
90+
91+
</section>
92+
93+
<!-- /.examples -->
94+
95+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
96+
97+
<section class="references">
98+
99+
</section>
100+
101+
<!-- /.references -->
102+
103+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
104+
105+
<section class="related">
106+
107+
</section>
108+
109+
<!-- /.related -->
110+
111+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
112+
113+
<section class="links">
114+
115+
</section>
116+
117+
<!-- /.links -->
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+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
25+
var pkg = require( './../package.json' ).name;
26+
var aggregateOperations = require( './../lib' );
27+
28+
29+
// MAIN //
30+
31+
bench( pkg, function benchmark( b ) {
32+
var out;
33+
var i;
34+
35+
b.tic();
36+
for ( i = 0; i < b.iterations; i++ ) {
37+
out = aggregateOperations();
38+
if ( out.length < 2 ) {
39+
b.fail( 'should return an array' );
40+
}
41+
}
42+
b.toc();
43+
if ( !isStringArray( out ) ) {
44+
b.fail( 'should return an array of strings' );
45+
}
46+
b.pass( 'benchmark finished' );
47+
b.end();
48+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
{{alias}}()
3+
Returns a list of aggregate transform operations.
4+
5+
Returns
6+
-------
7+
out: Array<string>
8+
List of aggregate transform operations.
9+
10+
Examples
11+
--------
12+
> var out = {{alias}}()
13+
[ 'count', 'valid', 'missing', ... ]
14+
15+
See Also
16+
--------
17+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Returns a list of aggregate transform operations.
23+
*
24+
* @returns list of aggregate transform operations
25+
*
26+
* @example
27+
* var list = aggregateOperations();
28+
* // returns [ 'count', 'valid', 'missing', 'distinct', 'sum', 'product', 'mean', 'average', 'variance', 'variancep', 'stdev', 'stdevp', 'stderr', 'median', 'q1', 'q3', 'ci0', 'ci1', 'min', 'max', 'argmin', 'argmax', 'values' ]
29+
*/
30+
declare function aggregateOperations(): Array<string>;
31+
32+
33+
// EXPORTS //
34+
35+
export = aggregateOperations;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
import aggregateOperations = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
aggregateOperations(); // $ExpectType string[]
27+
}
28+
29+
// The compiler throws an error if the function is provided any arguments...
30+
{
31+
aggregateOperations( 9 ); // $ExpectError
32+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 contains = require( '@stdlib/array/base/assert/contains' ).factory;
22+
var aggregateOperations = require( './../lib' );
23+
24+
var isAggregateOperation = contains( aggregateOperations() );
25+
26+
var bool = isAggregateOperation( 'count' );
27+
console.log( bool );
28+
// => true
29+
30+
bool = isAggregateOperation( 'median' );
31+
console.log( bool );
32+
// => true
33+
34+
bool = isAggregateOperation( 'beep' );
35+
console.log( bool );
36+
// => false
37+
38+
bool = isAggregateOperation( 'boop' );
39+
console.log( bool );
40+
// => false
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
"count",
3+
"valid",
4+
"missing",
5+
"distinct",
6+
"sum",
7+
"product",
8+
"mean",
9+
"average",
10+
"variance",
11+
"variancep",
12+
"stdev",
13+
"stdevp",
14+
"stderr",
15+
"median",
16+
"q1",
17+
"q3",
18+
"ci0",
19+
"ci1",
20+
"min",
21+
"max",
22+
"argmin",
23+
"argmax",
24+
"values"
25+
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
* Return a list of aggregate transform operations.
23+
*
24+
* @module @stdlib/plot/vega/transform/aggregate-operations
25+
*
26+
* @example
27+
* var aggregateOperations = require( '@stdlib/plot/vega/transform/aggregate-operations' );
28+
*
29+
* var out = aggregateOperations();
30+
* // returns [ 'count', 'valid', 'missing', 'distinct', 'sum', 'product', 'mean', 'average', 'variance', 'variancep', 'stdev', 'stdevp', 'stderr', 'median', 'q1', 'q3', 'ci0', 'ci1', 'min', 'max', 'argmin', 'argmax', 'values' ]
31+
*/
32+
33+
// MODULES //
34+
35+
var main = require( './main.js' );
36+
37+
38+
// EXPORTS //
39+
40+
module.exports = main;

0 commit comments

Comments
 (0)