Skip to content

Commit 84b8a1a

Browse files
committed
feat: add z-index support
--- 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: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - 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 49c50e1 commit 84b8a1a

File tree

4 files changed

+160
-0
lines changed

4 files changed

+160
-0
lines changed

lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ var setTicks = require( './ticks/set.js' );
153153
var getTitle = require( './title/get.js' );
154154
var setTitle = require( './title/set.js' );
155155

156+
var getZIndex = require( './zindex/get.js' );
157+
var setZIndex = require( './zindex/set.js' );
158+
156159

157160
// VARIABLES //
158161

@@ -1333,6 +1336,26 @@ setReadWriteAccessor( Axis.prototype, 'ticks', getTicks, setTicks );
13331336
*/
13341337
setReadWriteAccessor( Axis.prototype, 'title', getTitle, setTitle );
13351338

1339+
/**
1340+
* Integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups.
1341+
*
1342+
* @name zindex
1343+
* @memberof Axis.prototype
1344+
* @type {number}
1345+
* @default 0
1346+
*
1347+
* @example
1348+
* var axis = new Axis({
1349+
* 'scale': 'xScale',
1350+
* 'orient': 'bottom',
1351+
* 'zindex': 2
1352+
* });
1353+
*
1354+
* var v = axis.zindex;
1355+
* // returns 2
1356+
*/
1357+
setReadWriteAccessor( Axis.prototype, 'zindex', getZIndex, setZIndex );
1358+
13361359
/**
13371360
* Serializes an instance to a JSON object.
13381361
*
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var prop = require( './properties.js' );
26+
27+
28+
// MAIN //
29+
30+
/**
31+
* Returns the integer z-index indicating the layering of the axis group relative to other axis, mark, and legend groups.
32+
*
33+
* @private
34+
* @returns {number} z-index
35+
*/
36+
function get() {
37+
return this[ prop.private ];
38+
}
39+
40+
41+
// EXPORTS //
42+
43+
module.exports = get;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 property2object = require( '@stdlib/plot/vega/base/property2object' );
24+
25+
26+
// MAIN //
27+
28+
var obj = property2object( 'zindex' );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = obj;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var logger = require( 'debug' );
26+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
27+
var format = require( '@stdlib/string/format' );
28+
var changeEvent = require( './../change_event.js' );
29+
var prop = require( './properties.js' );
30+
31+
32+
// VARIABLES //
33+
34+
var debug = logger( 'vega:axis:set:'+prop.name );
35+
36+
37+
// MAIN //
38+
39+
/**
40+
* Sets the integer z-index indicating the layering of the axis group relative to other axis, mark, and legend groups.
41+
*
42+
* @private
43+
* @param {number} value - input value
44+
* @throws {TypeError} must be a number
45+
* @returns {void}
46+
*/
47+
function set( value ) {
48+
if ( !isNumber( value ) ) {
49+
throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) );
50+
}
51+
if ( value !== this[ prop.private ] ) {
52+
debug( 'Current value: %s. New value: %s.', this[ prop.private ], value );
53+
this[ prop.private ] = value;
54+
this.emit( 'change', changeEvent( prop.name ) );
55+
}
56+
}
57+
58+
59+
// EXPORTS //
60+
61+
module.exports = set;

0 commit comments

Comments
 (0)