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
64 changes: 64 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@
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' );
Expand Down Expand Up @@ -345,7 +352,7 @@
} catch ( err ) {
debug( 'Encountered an error. Error: %s', err.message );

// FIXME: retain thrown error type

Check warning on line 355 in lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: retain thrown error type'
throw new Error( transformErrorMessage( err.message ) );
}
}
Expand Down Expand Up @@ -1800,6 +1807,63 @@
*/
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.
*
Expand Down
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/get.js
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
67 changes: 67 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/set.js
Original file line number Diff line number Diff line change
@@ -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.

Check warning on line 45 in lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-x/set.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "unsets"
* - 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;
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/get.js
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
67 changes: 67 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/set.js
Original file line number Diff line number Diff line change
@@ -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.

Check warning on line 45 in lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/title-y/set.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "unsets"
* - 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;
Loading
Loading