diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js index 5e42c7cac871..26114e3baf5f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js @@ -197,6 +197,13 @@ var getTitleOpacity = require( './title-opacity/get.js' ); var setTitleOpacity = require( './title-opacity/set.js' ); var getTitlePadding = require( './title-padding/get.js' ); var setTitlePadding = require( './title-padding/set.js' ); +var getTitleX = require( './title-x/get.js' ); +var setTitleX = require( './title-x/set.js' ); +var getTitleY = require( './title-y/get.js' ); +var setTitleY = require( './title-y/set.js' ); + +var getTranslate = require( './translate/get.js' ); +var setTranslate = require( './translate/set.js' ); var getZIndex = require( './zindex/get.js' ); var setZIndex = require( './zindex/set.js' ); @@ -1800,6 +1807,63 @@ setReadWriteAccessor( Axis.prototype, 'titleOpacity', getTitleOpacity, setTitleO */ setReadWriteAccessor( Axis.prototype, 'titlePadding', getTitlePadding, setTitlePadding ); +/** +* Custom `x` position of the axis title relative to the axis group. +* +* @name titleX +* @memberof Axis.prototype +* @type {(void|number)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'titleX': 5 +* }); +* +* var v = axis.titleX; +* // returns 5 +*/ +setReadWriteAccessor( Axis.prototype, 'titleX', getTitleX, setTitleX ); + +/** +* Custom `y` position of the axis title relative to the axis group. +* +* @name titleY +* @memberof Axis.prototype +* @type {(void|number)} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'titleY': 5 +* }); +* +* var v = axis.titleY; +* // returns 5 +*/ +setReadWriteAccessor( Axis.prototype, 'titleY', getTitleY, setTitleY ); + +/** +* Coordinate space translation offset for axis layout. +* +* @name translate +* @memberof Axis.prototype +* @type {number} +* +* @example +* var axis = new Axis({ +* 'scale': 'xScale', +* 'orient': 'bottom', +* 'translate': 1 +* }); +* +* var v = axis.translate; +* // returns 1 +*/ +setReadWriteAccessor( Axis.prototype, 'translate', getTranslate, setTranslate ); + /** * Integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups. * diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/get.js new file mode 100644 index 000000000000..bf35f6fa96c6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the custom `x` position of the axis title relative to the axis group. +* +* @private +* @returns {(void|number)} position +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/properties.js new file mode 100644 index 000000000000..b4127f057b5b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'titleX' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/set.js new file mode 100644 index 000000000000..0669d818c6d4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the custom `x` position of the axis title relative to the axis group. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* - Setting the position overrides the standard layout. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/get.js new file mode 100644 index 000000000000..de46beb944b4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the custom `y` position of the axis title relative to the axis group. +* +* @private +* @returns {(void|number)} position +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/properties.js new file mode 100644 index 000000000000..31376053cd76 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'titleY' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/set.js new file mode 100644 index 000000000000..c6c1620e7bd6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/set.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the custom `y` position of the axis title relative to the axis group. +* +* ## Notes +* +* - Providing `undefined` "unsets" the configured value. +* - Setting the position overrides the standard layout. +* +* @private +* @param {(number|void)} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) && !isUndefined( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/get.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/get.js new file mode 100644 index 000000000000..6802683f0b48 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/get.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var prop = require( './properties.js' ); + + +// MAIN // + +/** +* Returns the coordinate space translation offset for axis layout. +* +* @private +* @returns {number} translation +*/ +function get() { + return this[ prop.private ]; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/properties.js new file mode 100644 index 000000000000..f7148d08eff1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/properties.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 property2object = require( '@stdlib/plot/vega/base/property2object' ); + + +// MAIN // + +var obj = property2object( 'translate' ); + + +// EXPORTS // + +module.exports = obj; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/set.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/set.js new file mode 100644 index 000000000000..747e47affa74 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/translate/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +/* eslint-disable no-invalid-this */ + +'use strict'; + +// MODULES // + +var logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var changeEvent = require( './../change_event.js' ); +var prop = require( './properties.js' ); + + +// VARIABLES // + +var debug = logger( 'vega:axis:set:'+prop.name ); + + +// MAIN // + +/** +* Sets the coordinate space translation offset for axis layout. +* +* @private +* @param {number} value - input value +* @throws {TypeError} must be a number +* @returns {void} +*/ +function set( value ) { + if ( !isNumber( value ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', prop.name, value ) ); + } + if ( value !== this[ prop.private ] ) { + debug( 'Current value: %s. New value: %s.', this[ prop.private ], value ); + this[ prop.private ] = value; + this.emit( 'change', changeEvent( prop.name ) ); + } +} + + +// EXPORTS // + +module.exports = set;