Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
117 changes: 117 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/legend/orientations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!--

@license Apache-2.0

Copyright (c) 2026 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

# legendOrientations

> List of supported Vega legend orientations.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var legendOrientations = require( '@stdlib/plot/vega/legend/orientations' );
```

#### legendOrientations()

Returns a list of legend orientations.

```javascript
var out = legendOrientations();
// returns [ 'bottom', 'bottom-left', 'bottom-right', 'left', 'none', 'right', 'top', 'top-left', 'top-right' ]
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var legendOrientations = require( '@stdlib/plot/vega/legend/orientations' );

var isLegendOrientation = contains( legendOrientations() );

var bool = isLegendOrientation( 'left' );
// returns true

bool = isLegendOrientation( 'top-right' );
// returns true

bool = isLegendOrientation( 'beep' );
// returns false

bool = isLegendOrientation( 'boop' );
// returns false
```

</section>

<!-- /.examples -->

<!-- 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. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

</section>

<!-- /.links -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
var pkg = require( './../package.json' ).name;
var legendOrientations = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
var out;
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = legendOrientations();
if ( out.length < 2 ) {
b.fail( 'should return an array' );
}
}
b.toc();
if ( !isStringArray( out ) ) {
b.fail( 'should return an array of strings' );
}
b.pass( 'benchmark finished' );
b.end();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

{{alias}}()
Returns a list of legend orientations.

Returns
-------
out: Array<string>
List of legend orientations.

Examples
--------
> var out = {{alias}}()
[ 'bottom', 'bottom-left', 'bottom-right', ... ]

See Also
--------

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// TypeScript Version: 4.1

/**
* Returns a list of legend orientations.
*
* @returns list of legend orientations
*
* @example
* var list = legendOrientations();
* // returns [ 'bottom', 'bottom-left', 'bottom-right', 'left', 'none', 'right', 'top', 'top-left', 'top-right' ]
*/
declare function legendOrientations(): Array<string>;


// EXPORTS //

export = legendOrientations;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import legendOrientations = require( './index' );


// TESTS //

// The function returns an array of strings...
{
legendOrientations(); // $ExpectType string[]
}

// The compiler throws an error if the function is provided any arguments...
{
legendOrientations( 9 ); // $ExpectError
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var legendOrientations = require( './../lib' );

var isLegendOrientation = contains( legendOrientations() );

var bool = isLegendOrientation( 'left' );
console.log( bool );
// => true

bool = isLegendOrientation( 'top-right' );
console.log( bool );
// => true

bool = isLegendOrientation( 'beep' );
console.log( bool );
// => false

bool = isLegendOrientation( 'boop' );
console.log( bool );
// => false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
"bottom",
"bottom-left",
"bottom-right",
"left",
"none",
"right",
"top",
"top-left",
"top-right"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/**
* Return a list of legend orientations.
*
* @module @stdlib/plot/vega/legend/orientations
*
* @example
* var legendOrientations = require( '@stdlib/plot/vega/legend/orientations' );
*
* var out = legendOrientations();
* // returns [ 'bottom', 'bottom-left', 'bottom-right', 'left', 'none', 'right', 'top', 'top-left', 'top-right' ]
*/

// MODULES //

var main = require( './main.js' );


// EXPORTS //

module.exports = main;
44 changes: 44 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/legend/orientations/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var DATA = require( './data.json' );


// MAIN //

/**
* Returns a list of legend orientations.
*
* @returns {StringArray} list of legend orientations
*
* @example
* var out = legendOrientations();
* // returns [ 'bottom', 'bottom-left', 'bottom-right', 'left', 'none', 'right', 'top', 'top-left', 'top-right' ]
*/
function legendOrientations() {
return DATA.slice();
}


// EXPORTS //

module.exports = legendOrientations;
Loading