Skip to content
Open
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
44 changes: 44 additions & 0 deletions lib/node_modules/@stdlib/plot/charts/area/ctor/examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @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';

var linspace = require( '@stdlib/array/linspace' );
var Float64Vector = require( '@stdlib/ndarray/vector/float64' );
var map = require( '@stdlib/ndarray/map' );
var pdf = require( '@stdlib/stats/base/dists/normal/pdf' );

Check warning on line 24 in lib/node_modules/@stdlib/plot/charts/area/ctor/examples/index.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

only the `factory` property of the required module is used; require the property directly
var AreaChart = require( './../lib' );

// Generate linearly spaced values over the support of interest:
var x = new Float64Vector( linspace( -5.0, 10.0, 100 ) );

// Evaluate the PDF of several normal distributions:
var y = [
map( x, pdf.factory( 0.0, 1.0 ) ),
map( x, pdf.factory( 2.0, 2.0 ) ),
map( x, pdf.factory( 5.0, 0.5 ) )
];

// Overlay the distributions:
var chart = new AreaChart( x, y, {
'labels': [ 'N(0,1)', 'N(2,2)', 'N(5,0.5)' ],
'fillOpacity': [ 0.5 ],
'legend': true,
'yTitle': 'f(x)'
});
console.log( chart.toJSON() );
41 changes: 41 additions & 0 deletions lib/node_modules/@stdlib/plot/charts/area/ctor/lib/change_event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @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';

// MAIN //

/**
* Returns a new change event object.
*
* @private
* @param {string} property - property name
* @returns {Object} event object
*/
function event( property ) { // eslint-disable-line stdlib/no-redeclare
return {
'type': 'update',
'source': 'visualization',
'property': property
};
}


// EXPORTS //

module.exports = event;
44 changes: 44 additions & 0 deletions lib/node_modules/@stdlib/plot/charts/area/ctor/lib/colors/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @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.
*/

/* eslint-disable no-invalid-this */

'use strict';

// MODULES //

var copy = require( '@stdlib/array/base/copy' );
var prop = require( './properties.js' );

Check warning on line 26 in lib/node_modules/@stdlib/plot/charts/area/ctor/lib/colors/get.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

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


// MAIN //

/**
* Returns the area colors.
*
* @private
* @returns {Array<string>} colors
*/
function get() {
return copy( 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) 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 property2object = require( '@stdlib/plot/vega/base/property2object' );


// MAIN //

var obj = property2object( 'colors' );


// EXPORTS //

module.exports = obj;
75 changes: 75 additions & 0 deletions lib/node_modules/@stdlib/plot/charts/area/ctor/lib/colors/set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* @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.
*/

/* eslint-disable no-invalid-this */

'use strict';

// MODULES //

var logger = require( 'debug' );
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var hasEqualValues = require( '@stdlib/array/base/assert/has-equal-values' );
var copy = require( '@stdlib/array/base/copy' );
var join = require( '@stdlib/array/base/join' );
var format = require( '@stdlib/string/format' );
var prop = require( './properties.js' );


// VARIABLES //

var debug = logger( 'area-chart:set:'+prop.name );


// MAIN //

/**
* Sets area colors.
*
* @private
* @param {(Array<string>|string)} value - input value
* @throws {TypeError} must be a string or an array of strings
* @returns {void}
*/
function set( value ) {
var isStr = isString( value );
if ( !isStr && !isStringArray( value ) ) {
throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', prop.name, value ) );
}
if ( isStr ) {
value = [ value ];
}
if ( !hasEqualValues( value, this[ prop.private ] ) ) {
debug( 'Current value: [%s]. New value: [%s].', join( this[ prop.private ], ', ' ), join( value, ', ' ) );

// Perform a defensive copy as we will be caching the specified area colors:
value = copy( value );

// Cache the value before updating the scale to ensure consistent state:
this[ prop.private ] = value;

// Update the color range:
this.colorScale.range = value;
}
}


// EXPORTS //

module.exports = set;
54 changes: 54 additions & 0 deletions lib/node_modules/@stdlib/plot/charts/area/ctor/lib/defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @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 category10 = require( '@stdlib/plot/color-schemes/category10' );


// MAIN //

/**
* Returns defaults.
*
* @private
* @returns {Object} defaults
*
* @example
* var obj = defaults();
* // returns {...}
*/
function defaults() {
return {
// Area colors:
'colors': category10(),

// Area fill opacity:
'fillOpacity': [ 0.5 ],

// Boolean indicating whether to display a legend:
'legend': false
};
}


// EXPORTS //

module.exports = defaults;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @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.
*/

/* eslint-disable no-invalid-this */

'use strict';

// MODULES //

var copy = require( '@stdlib/array/base/copy' );
var prop = require( './properties.js' );

Check warning on line 26 in lib/node_modules/@stdlib/plot/charts/area/ctor/lib/fill-opacity/get.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

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


// MAIN //

/**
* Returns the area fill opacities.
*
* @private
* @returns {Array<number>} opacities
*/
function get() {
return copy( 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) 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 property2object = require( '@stdlib/plot/vega/base/property2object' );


// MAIN //

var obj = property2object( 'fillOpacity' );


// EXPORTS //

module.exports = obj;
Loading
Loading