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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var isArray = require( '@stdlib/assert/is-array' );
var defaults = require( './../defaults.js' );

Check warning on line 24 in lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/config/legend.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

only the `legend` property of the required module is used; require the property directly
var resolveValue = require( './resolve_value.js' );
var resolveTextValue = require( './resolve_text_value.js' );
var resolveSchemaValue = require( './resolve_schema_value.js' );
Expand All @@ -32,11 +32,26 @@
var PROPS = [
'direction',
'orient',
'titleAlign',
'titleAnchor',
'titleBaseline',
'titleColor',
'titleFont',
'titleFontSize',
'titleFontStyle',
'titleFontWeight',
'titleLimit',
'titleLineHeight',
'titleOpacity',
'titleOrient',
'titlePadding',
'type'
];
var ARRAY_PROPS = [];
var SCHEMA_PROPS = [];
var TEXT_PROPS = [];
var TEXT_PROPS = [
'title'
];


// MAIN //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
// MODULES //

var objectKeys = require( '@stdlib/utils/keys' );
var format = require( '@stdlib/string/format' );
var defaults = require( './../defaults.js' );

Check warning on line 25 in lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/menus/legend.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

only the `legend` property of the required module is used; require the property directly


// VARIABLES //
Expand Down Expand Up @@ -68,10 +69,49 @@
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'orient' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'title' ) {
controller = folder.add( conf, k );
} else if ( k === 'titleAlign' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'titleAnchor' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'titleBaseline' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'titleColor' ) {
controller = folder.addColor( conf, k );
} else if ( k === 'titleFont' ) {
controller = folder.add( conf, k );
} else if ( k === 'titleFontSize' ) {
controller = folder.add( conf, k )
.min( d.min )
.step( d.step );
controller.name( format( '%s (%s)', k, d.units ) );
} else if ( k === 'titleFontStyle' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'titleFontWeight' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'titleLimit' ) {
controller = folder.add( conf, k )
.min( d.min )
.step( d.step );
controller.name( format( '%s (%s)', k, d.units ) );
} else if ( k === 'titleLineHeight' ) {
controller = folder.add( conf, k )
.min( d.min )
.step( d.step );
} else if ( k === 'titleOpacity' ) {
controller = folder.add( conf, k )
.min( d.min )
.max( d.max );
} else if ( k === 'titleOrient' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else if ( k === 'titlePadding' ) {
controller = folder.add( conf, k );
controller.name( format( '%s (%s)', k, d.units ) );
} else if ( k === 'type' ) {
controller = folder.add( conf, k, EMPTY_STRING.concat( d.values ) );
} else {
console.log( 'Unrecognized property in editor configuration. Key: %s.', k );

Check warning on line 114 in lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/menus/legend.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected console statement
continue;
}
controllers[ k ] = controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,26 @@ var signalName = require( './../../utils/signal_name.js' );

var PROPS = [
'orient',
'title',
'titleAlign',
'titleAnchor',
'titleColor',
'titleFont',
'titleFontSize',
'titleFontStyle',
'titleFontWeight',
'titleLimit',
'titleLineHeight',
'titleOpacity',
'titleOrient',
'titlePadding',
'type'
];

// Define a list of properties which need to be made explicitly "undefined" when set to falsy values:
var SPECIAL_PROPS = [
'direction'
'direction',
'titleBaseline'
];
var isSpecialProp = contains( SPECIAL_PROPS );

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @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 schema = require( './schema.json' );
var handler = require( './main.js' );


// MAIN //

/**
* Defines a route handler for receiving updating a plot configuration.
*
* @private
* @returns {Object} route declaration
*/
function route() {
schema.handler = handler;
return schema;
}


// EXPORTS //

module.exports = route;
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* @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 middleware = require( './../../../../middleware_sequence.js' );
var allowCredentials = require( './../../../../middleware/allow-credentials' );
var tryAssign = require( './../../../../middleware/plot-try-assign' );
var body = require( './../../../../middleware/body' );
var ok = require( './../../../../middleware/ok' );
var onError = require( './../../../../middleware/error' );
var transform = require( './../../transforms.js' ).empty2undefined;


// VARIABLES //

var steps = [
allowCredentials,
body,
tryAssign( [ 'config', 'legends', ':legend' ], 'titleAlign', transform ),
ok
];


// MAIN //

/**
* Request handler for updating a plot configuration.
*
* @private
* @name handler
* @type {Function}
* @param {Object} request - request object
* @param {Object} response - response object
*/
var handler = middleware( steps, onError );


// EXPORTS //

module.exports = handler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"method": "POST",
"url": "/config/legends/:legend/titleAlign",
"schema": {
"response": {
"200": {
"type": "string"
},
"400": {
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"413": {
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"handler": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @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 schema = require( './schema.json' );
var handler = require( './main.js' );


// MAIN //

/**
* Defines a route handler for receiving updating a plot configuration.
*
* @private
* @returns {Object} route declaration
*/
function route() {
schema.handler = handler;
return schema;
}


// EXPORTS //

module.exports = route;
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* @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 middleware = require( './../../../../middleware_sequence.js' );
var allowCredentials = require( './../../../../middleware/allow-credentials' );
var tryAssign = require( './../../../../middleware/plot-try-assign' );
var body = require( './../../../../middleware/body' );
var ok = require( './../../../../middleware/ok' );
var onError = require( './../../../../middleware/error' );
var transform = require( './../../transforms.js' ).empty2undefined;


// VARIABLES //

var steps = [
allowCredentials,
body,
tryAssign( [ 'config', 'legends', ':legend' ], 'titleAnchor', transform ),
ok
];


// MAIN //

/**
* Request handler for updating a plot configuration.
*
* @private
* @name handler
* @type {Function}
* @param {Object} request - request object
* @param {Object} response - response object
*/
var handler = middleware( steps, onError );


// EXPORTS //

module.exports = handler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"method": "POST",
"url": "/config/legends/:legend/titleAnchor",
"schema": {
"response": {
"200": {
"type": "string"
},
"400": {
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"413": {
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"handler": null
}
Loading
Loading