Skip to content

Commit 457fe04

Browse files
committed
feat: add plot/vega/y-scale initial implementation
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 27b2ebc commit 457fe04

File tree

4 files changed

+181
-0
lines changed

4 files changed

+181
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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 yScale = require( './../lib' );
22+
23+
var scale = yScale();
24+
console.log( scale.toJSON() );
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) 2025 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+
* Create a named scale.
23+
*
24+
* @module @stdlib/plot/vega/y-scale
25+
*
26+
* @example
27+
* var yScale = require( '@stdlib/plot/vega/y-scale' );
28+
*
29+
* var scale = yScale();
30+
* // returns <Scale>
31+
*/
32+
33+
// MODULES //
34+
35+
var main = require( './main.js' );
36+
37+
38+
// EXPORTS //
39+
40+
module.exports = main;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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 namedScaleFactory = require( '@stdlib/plot/vega/named-scale' ).factory;
24+
25+
26+
// MAIN //
27+
28+
/**
29+
* Returns a named scale.
30+
*
31+
* @name yScale
32+
* @type {Function}
33+
* @param {Options} [options] - function options
34+
* @param {(Collection|Object|Signal)} [options.domain] - domain of associated data values
35+
* @param {number} [options.domainMax] - maximum value in the scale domain (overrides the `domain` option)
36+
* @param {number} [options.domainMin] - minimum value in the scale domain (overrides the `domain` option)
37+
* @param {number} [options.domainMid] - single mid-point value inserted into a two-element domain
38+
* @param {Collection} [options.domainRaw] - array of raw domain values which overrides the `domain` property
39+
* @param {(string|Object)} [options.interpolate] - scale range interpolation method
40+
* @param {string} [options.name='yScale'] - scale name
41+
* @param {(Collection|Object|Signal|string)} [options.range] - scale range
42+
* @param {boolean} [options.reverse=false] - boolean indicating whether to reverse the order of the scale range
43+
* @param {boolean} [options.round=false] - boolean indicating whether to round numeric output values to integers
44+
* @param {string} [options.type='linear'] - scale type
45+
* @throws {TypeError} options argument must be an object
46+
* @throws {Error} must provide valid options
47+
* @returns {Scale} scale instance
48+
*
49+
* @example
50+
* var scale = yScale();
51+
* // returns <Scale>
52+
*/
53+
var yScale = namedScaleFactory( 'yScale' );
54+
55+
56+
// EXPORTS //
57+
58+
module.exports = yScale;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "@stdlib/plot/vega/y-scale",
3+
"version": "0.0.0",
4+
"description": "Create a named scale.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"benchmark": "./benchmark",
19+
"doc": "./docs",
20+
"example": "./examples",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"plot",
54+
"vega",
55+
"scale",
56+
"factory"
57+
],
58+
"__stdlib__": {}
59+
}

0 commit comments

Comments
 (0)