From 72a0fa1e0cdd2c2e958cf8f42c5ee8a534f20469 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Wed, 19 Feb 2025 23:55:11 +0530 Subject: [PATCH 1/4] initial immature version --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/plot/mine/bar/test.js | 11 + .../@stdlib/plot/mine/bar/test2.js | 25 ++ .../plot/unicode/static_plots/bar/default.js | 45 +++ .../plot/unicode/static_plots/bar/main.js | 303 +++++++++++++++++ .../static_plots/bar/props/cols/get.js | 35 ++ .../static_plots/bar/props/cols/set.js | 60 ++++ .../static_plots/bar/props/rows/get.js | 35 ++ .../static_plots/bar/props/rows/set.js | 61 ++++ .../static_plots/bar/props/vertical/get.js | 35 ++ .../static_plots/bar/props/vertical/set.js | 57 ++++ .../static_plots/bar/props/xaxis/get.js | 35 ++ .../static_plots/bar/props/xaxis/set.js | 56 +++ .../static_plots/bar/props/yaxis/get.js | 35 ++ .../static_plots/bar/props/yaxis/set.js | 56 +++ .../plot/unicode/static_plots/bar/test.js | 26 ++ .../static_plots/bar/utils/scale_bar.js | 30 ++ .../unicode/static_plots/base/lib/default.js | 48 +++ .../unicode/static_plots/base/lib/index.js | 41 +++ .../unicode/static_plots/base/lib/markers.js | 34 ++ .../unicode/static_plots/base/lib/pallete.js | 152 +++++++++ .../static_plots/base/lib/primitive.js | 320 ++++++++++++++++++ .../static_plots/base/lib/props/height/get.js | 35 ++ .../static_plots/base/lib/props/height/set.js | 60 ++++ .../static_plots/base/lib/props/hpos/get.js | 35 ++ .../static_plots/base/lib/props/hpos/set.js | 60 ++++ .../static_plots/base/lib/props/isfill/get.js | 35 ++ .../static_plots/base/lib/props/isfill/set.js | 53 +++ .../static_plots/base/lib/props/isline/get.js | 35 ++ .../static_plots/base/lib/props/isline/set.js | 53 +++ .../static_plots/base/lib/props/vpos/get.js | 35 ++ .../static_plots/base/lib/props/vpos/set.js | 60 ++++ .../static_plots/base/lib/props/width/get.js | 35 ++ .../static_plots/base/lib/props/width/set.js | 60 ++++ .../unicode/static_plots/base/lib/test.js | 35 ++ .../unicode/static_plots/base/lib/utilies.js | 130 +++++++ .../static_plots/base/lib/utils/fill.js | 11 + .../base/lib/utils/getTerminalSize.js | 3 + .../static_plots/base/lib/utils/line.js | 34 ++ .../base/lib/utils/scale_for_canva.js | 12 + 39 files changed, 2281 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/mine/bar/test.js create mode 100644 lib/node_modules/@stdlib/plot/mine/bar/test2.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js diff --git a/lib/node_modules/@stdlib/plot/mine/bar/test.js b/lib/node_modules/@stdlib/plot/mine/bar/test.js new file mode 100644 index 000000000000..bd93dc17d757 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/mine/bar/test.js @@ -0,0 +1,11 @@ +// var palt = require('./pallete') + + +// var ins = new palt() + +// ins.setSize(5 , 5) + +// ins.set_matrices( ) + +// console.log(ins.setcanvas()) +console.log("\x1b[47m\x1b[94mThis text has a white background and light blue foreground\x1b[0m"); diff --git a/lib/node_modules/@stdlib/plot/mine/bar/test2.js b/lib/node_modules/@stdlib/plot/mine/bar/test2.js new file mode 100644 index 000000000000..8e39390a5936 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/mine/bar/test2.js @@ -0,0 +1,25 @@ +var mon = require('@stdlib/plot/mine/bar/monitor'); +var palt = require('@stdlib/plot/mine/bar/pallete') + + + +var inst = new mon(); + +var data = [ + [ 1 , 2, 3, 4, 5, 6, 7 , 8, 9, 10, 11, 12, 13 + // ,11, 12, 13, 14, 15, 16 + ], + [ 10, 1, 5, 20, 25, 23, 35, 40, 10, 11, 12, 13, 15 + // , 10, 10, 10, 10, 10, 10 + ] +] +inst.draw_bar( data ); +inst.build(); +inst.show(); + +// var ins = new palt() +// ins.setSize( 5 , 5 ); +// ins.set_matrices(); + +// ins.addElement( 2, 4 ) +// console.log(ins.setcanvas()) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js new file mode 100644 index 000000000000..743c797337ff --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 // + + +// MAIN // + +/** +* Returns default options. +* +* @private +* @returns {Object} default options +*/ +function defaults() { + var out = {}; + out.rows = void 0; + out.cols = void 0; + out.vertical = false; + out.xaxis = []; + out.yaxis = []; + return out; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js new file mode 100644 index 000000000000..115c1e2e93cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js @@ -0,0 +1,303 @@ +var setNonEnumerableReadOnly = require('@stdlib/utils/define-nonenumerable-read-only-property'); +var defineProperty = require('@stdlib/utils/define-property'); +var mergeFcn = require( '@stdlib/utils/merge' ).factory; +var objectKeys = require( '@stdlib/utils/keys' ); +var defaults = require('./default.js'); +var setXaxis = require( './props/xaxis/set.js' ); +var getXaxis = require( './props/xaxis/get.js' ); +var setYaxis = require( './props/yaxis/set.js' ); +var getYaxis = require( './props/yaxis/get.js' ); +var setRows = require( './props/rows/set.js' ) +var getRows = require( './props/rows/get.js' ) +var setCols = require( './props/cols/set.js' ) +var getCols = require( './props/cols/get.js' ); +var setVertical = require( './props/vertical/set.js' ); +var getVertical = require( './props/vertical/get.js' ); +var primitive = require( '../base/lib' ); +// var scale_bar = require( './utils/scale_bar.js' ) + +/** + * xpos + * ypos + * + */ +var merge = mergeFcn({ + 'extend': false +}); + +// List of private properties (note: keep in alphabetical order): +var PRIVATE_PROPS = [ + '_x', + '_y', + '_primitive', + '_rows', + '_cols', + '_vertical' +]; + +var options = { + 'isFill' : true + +} + +function barplot() { + for( i = 0; i < PRIVATE_PROPS; i++ ) { + defineProperty( this, PRIVATE_PROPS[ i ], { + 'configurable': false, + 'enumerable': false, + 'writable': true, + 'value': null + } ) + } + + this._x = []; + this._y = []; + this._primitive = new primitive(); + var options; + var nargs; + var opts; + + nargs = arguments.length; + opts = defaults(); + if ( nargs ) { + options = arguments[ 0 ]; + } + else { + options = {} + } + opts = merge( opts, options ); + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + key = keys[i]; + this[ key ] = opts[ key ]; + } + + // initilize primitive class + + this._primitive.setSize(this._rows, this.cols ) + return this; +} + +setNonEnumerableReadOnly(barplot.prototype, 'draw', function draw() { + this.addLableX(); + var ybar; + var xbar; + var temp; + var i; + if ( this._vertical ) { + temp = scale_bar_vertical(this._x, this._y, this._rows - this._primitive._padTop - this._primitive._padBottom ); + xbar = temp[1]; + ybar = temp[0]; + } + else { + temp = scale_bar(this._x, this._y, this._cols - this._primitive._padLeft - this._primitive._padRight ); + xbar = temp[0]; + ybar = temp[1]; + } + var xlim = getLim(xbar) + var ylim = getLim(ybar) + // var finalCordx = scale( xbar, this._x.length - this._primitive._padLeft - this._primitive._padRight, getLim(xbar), this._ ) + var finalCordx = []; + var finalCordy = []; + + for ( i = 0; i < xbar.length; i++ ) { + finalCordx.push( scale( xbar[i], this._cols - this._primitive._padLeft - this._primitive._padRight, xlim, this._primitive._padLeft ) ); + } + this.addCategory( finalCordx ); + for ( i = 0; i < ybar.length; i++ ) { + finalCordy.push( scale( ybar[i], this._rows - this._primitive._padBottom - this._primitive._padTop, ylim, this._primitive._padBottom ) ); + } + for ( i = 0; i < xbar.length; i++ ) { + this._primitive.draw_rectangle( finalCordy[i], finalCordx[i] ); + } +}); + +setNonEnumerableReadOnly(barplot.prototype, 'render', function render() { + this._primitive.build(); + this._primitive.show(); +}); + +setNonEnumerableReadOnly(barplot.prototype, 'addLableX', function addLableX() { + var xpos = this._primitive._padBottom; + var pointGap = 1; + var y = []; + var mx; + var i; + var gap; + + x = [ ...this._x ]; + mx = minmax( this._y ); + + this._primitive._padLeft += mx[1].toString().length ; + this._primitive.drawFrame(); + if ( this._vertical ) { + gap = ( mx[1] - mx[0] ) / ( this._cols - this._primitive._padLeft - this._primitive._padRight ); + } + else { + gap = ( mx[1] - mx[0]) / (this._rows - this._primitive._padTop - this._primitive._padBottom ); + } + + gap = Math.ceil(gap * 10) / 10; + i = mx[0]; + while ( i <= mx[1] ) { + var elm = new Array(3); + elm[1] = 0; + elm[0] = xpos; + elm[2] = i.toString(); + y.push(elm); + i += gap; + i = Math.round(i * 10) / 10; + xpos += pointGap; + } + + this._primitive.addTic( [], y ); + +}); + +setNonEnumerableReadOnly(barplot.prototype, 'addCategory', function addCategory( BarPositions ) { + var i; + var cat = []; + var elm; + var temp; + for ( i = 0; i < BarPositions.length; i++ ) { + elm = new Array(3); + temp = Math.floor( ( BarPositions[i][1] + BarPositions[i][0] ) / 2 ); + elm[ 0 ] = 0; + elm[ 1 ] = temp; + elm[ 2 ] = ( i + 1 ).toString(); + cat.push(elm); + } + + this._primitive.addTic(cat); + +}); + + + +defineProperty( barplot.prototype, 'xaxis', { + 'configurable': false, + 'enumerable': true, + 'set': setXaxis, + 'get': getXaxis +}); + +defineProperty( barplot.prototype, 'yaxis', { + 'configurable': false, + 'enumerable': true, + 'set': setYaxis, + 'get': getYaxis +}); + +defineProperty( barplot.prototype, 'rows', { + 'configurable': false, + 'enumerable': true, + 'set': setRows, + 'get': getRows +}); + +defineProperty( barplot.prototype, 'cols', { + 'configurable': false, + 'enumerable': true, + 'set': setCols, + 'get': getCols +}); + +defineProperty( barplot.prototype, 'vertical', { + 'configurable': false, + 'enumerable': true, + 'set': setVertical, + 'get': getVertical +}); + + +function scale_bar ( x, y, containerWidth ) { + var width = 0.8; + var dataPoints = x.length; + var awidth = Math.floor( containerWidth / dataPoints ); + width = width * ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); + // 0.8 is the max width we can use because we also need to care about the spaces between bars + width = Math.min( width , 0.8 ) + + + // this normalization is done to reduce the rounding error, effect of this can be seen when the width is of 16 char or less and there is 14 plot + var widthWG = Math.floor( awidth * width ); + width = width * ( widthWG / ( awidth * width ) ); + + var bins = x.length; + + var width_half = width / 2; + var xbar = []; + var ybar = []; + + for (let i = 0; i < bins; i++) { + xbar.push([x[i] - width_half, x[i] + width_half]); + ybar.push([0, y[i]]); + } + + return [xbar, ybar]; +} + + +function scale_bar_vertical ( x, y, containerWidth ) { + var width = 0.2; + var dataPoints = x.length; + var awidth = Math.floor( containerWidth / dataPoints ); + width = width * ( ( containerWidth / dataPoints ) * ( 7 / 12 ) ); + width = Math.min( width , 0.8 ) + + var bins = x.length; + + var width_half = width / 2; + var xbar = []; + var ybar = []; + + for (let i = 0; i < bins; i++) { + xbar.push( [ i - width_half + 1, i + width_half + 1]); + ybar.push([0, y[i]]); + } + + return [xbar, ybar]; +} + +function minmax( elms ) { + + + var min = Infinity ; + var max = -Infinity; + var elm; + for ( elm of elms ) { + min = Math.min( elm, min ); + max = Math.max(elm , max); + } + + return [min, max]; +} + +function scale (elms, bins, lim, pad) { + var elm; + var arr=[]; + var i; + var sElm; + for ( i = 0; i < elms.length; i++ ) { + elm = elms[i]; + sElm = ( elm - lim[0] ) / ( lim[1] - lim[0] ); + arr.push( Math.round( pad + ( ( bins - 1 ) * sElm ) ) ) + // arr.push( ) + } + return arr; +} + + +function getLim(elms) { + var min = Infinity; + var max = -Infinity; + + elms.forEach(arr => { + min = Math.min(min, ...arr); + max = Math.max(max, ...arr); + }); + + return [min, max]; +} + +module.exports = barplot \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js new file mode 100644 index 000000000000..4d6b12927581 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {Array} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._cols; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js new file mode 100644 index 000000000000..c5d8efaef2d3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isArray = require( '@stdlib/assert/is-array' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {Array} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !num ) { + this._cols = process.stdout.columns; + return; + } + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. must be a array.' ) ); + } + this._cols = num; + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js new file mode 100644 index 000000000000..ff5cc5b151b5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {Array} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._rows; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js new file mode 100644 index 000000000000..e2869ce3c3de --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isArray = require( '@stdlib/assert/is-array' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {number} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !num ) { + this._rows = process.stdout.rows ; + return; + } + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. must be a array.' ) ); + } + this._rows = num; + + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js new file mode 100644 index 000000000000..144cd38d41d2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {boolean} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._vertical; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js new file mode 100644 index 000000000000..e42b102fe65f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isArray = require( '@stdlib/assert/is-array' ); +var format = require( '@stdlib/string/format' ); +const isBoolean = require('@stdlib/assert/is-boolean').isPrimitive; + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {boolean} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( bool ) { + /* eslint-disable no-invalid-this */ + if ( !isBoolean( bool ) ) { + throw new TypeError( format( 'invalid assignment. must be a array.' ) ); + } + this._vertical = bool; + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js new file mode 100644 index 000000000000..d20731021564 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {Array} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._x; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js new file mode 100644 index 000000000000..83cc5e4f3cf8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +// var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isArray = require( '@stdlib/assert/is-array' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {Array} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isArray( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a array. Value: `%s`.', 'autoRender', num ) ); + } + this._x = num; + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js new file mode 100644 index 000000000000..fcf2a1102b43 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {Array} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._y; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js new file mode 100644 index 000000000000..69f8c16a783a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +// var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isArray = require( '@stdlib/assert/is-array' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {Array} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isArray( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a array. Value: `%s`.', 'autoRender', num ) ); + } + this._y = num; + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js new file mode 100644 index 000000000000..53903d280546 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js @@ -0,0 +1,26 @@ +var barchart = require('./main'); + + +// var options = { +// xaxis : [ 1 , 2, 3, 4, 5, 6, 7 , 8, 9, 10, 11, 12, 13], +// yaxis : [10, 1, 5, 20, 25, 23, 35, 40, 10, 11, 12, 13, 15], +// rows : 40, +// cols: 40, +// vertical : true +// } +var options = { + xaxis : [ 1 , 2, 3, 4, 5,6, + 7 , 8, 9, 10, 11, 12, 13,14 + ], + yaxis : [10, 1, 5, 6, 7, 22, 10, + 35, 40, 10, 11, 12, 13, 15 + ], + rows : 10, + cols: 70, + // vertical : true +} +var inst = new barchart(options) + + +inst.draw(); +inst.render(); diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js new file mode 100644 index 000000000000..a128717ebf98 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js @@ -0,0 +1,30 @@ +function scale_bar () { + var width = 0.8; + + // width_half = width_half * ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); + width = width * ( ( 10 / dataPoints ) * ( containerWidth / 101 ) ); + // 0.8 is the max width we can use because we also need to care about the spaces between bars + width = Math.min( width , 0.8 ) + + // var actualWidth = containerWidth / dataPoints ; + // width *= ( Math.floor(actualWidth) / actualWidth ); + + var bins = x.length; + + var width_half = width / 2; + var xbar = []; + var ybar = []; + + // if (bins > 1) { + // width_half *= ( ( (Math.max(...x) - Math.min(...x)) / (bins - 1) ) ) ; + // } + + for (let i = 0; i < bins; i++) { + xbar.push([x[i] - width_half, x[i] + width_half]); + ybar.push([0, y[i]]); + } + + return [xbar, ybar]; +} + +module.exports = scale_bar \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js new file mode 100644 index 000000000000..d30903a56b64 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 // + + + + +// MAIN // + +/** +* Returns default options. +* +* @private +* @returns {Object} default options +*/ +function defaults() { + var out = {}; + out.heightscale = 1; + out.widthscale = 1; + out.hpos = 0; + out.vpos = 0; + out.isline = false; + out.isfill = true; + return out; +} + + +// EXPORTS // + +module.exports = defaults; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js new file mode 100644 index 000000000000..80d2e5d92411 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Base class for sparklines. +* +* @module @stdlib/plot/sparklines/base/ctor +* +* @example +* var Sparkline = require( '@stdlib/plot/sparklines/base/ctor' ); +* +* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; +* +* var chart = Sparkline( data ); +*/ + +// MODULES // + +var main = require( './primitive' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js new file mode 100644 index 000000000000..6b35e4e308d2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js @@ -0,0 +1,34 @@ + +const elms = { + 'sp' : ' ', + 'null' : '', + 'block' : '█' , + 'vertical': '│', + 'horizontal' : '─', + 'LBcorner' : '└', + 'RBcorner' : '┘', + 'LTcorner' : '┌', + 'RTcorner' : '┐', + 'Fwh' : '\x1b[37m', + 'Fbl' : '\x1b[30m', + 'Frd' : '\x1b[31m', + 'Fbu' : '\x1b[94m', + 'Bwh' : '\x1b[47m', + 'Bbl' : '\x1b[40m', + 'Bbu' : '\x1b[104m', + 'Byl' : '\x1b[43m', + // 'Bbu' : '\x1b[33m', + 'def': '\x1b[0m', + 'HorTic' : '┬' , + 'VerTic' : '┤' + +} +var i = 0; +for ( i = 0 ; i < 10; i++ ) { + elms[`${i}`] = `${i}` +} + +elms['.'] = '.'; + + +module.exports = elms; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js new file mode 100644 index 000000000000..26d8694ced22 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js @@ -0,0 +1,152 @@ +var defineProperty = require( '@stdlib/utils/define-property' ); +var setNonEnumerable = require( '@stdlib/utils/define-nonenumerable-property' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dfs = require('@stdlib/plot/unicode/static_plots/base/lib/markers') +function Pallete () { + this.counter = 0; + this.rows = 0; + this.cols = 0; + this.top = 0; + this.left = 0; + this.canva; + this.sketch; + this.colors; + this.backgrounds; + this.terminalWidth = process.stdout.columns; + this.setSize(0,0); + this.set_matrices(); +} + +/** + * set size + * set backColor + * set fontColor + * set marker + * + * + */ + +setNonEnumerableReadOnly( Pallete.prototype, 'setSize', function setSize( row, col ) { + this.rows = row; + this.cols = col; +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'setSpawnPosition', function setPosition( top, left ) { + this.top = top; + this.left = left; +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'isLegal', function isLegal( row, col ) { + return row < this.sketch.length && col < this.sketch[0].length && row >= 0 && col >=0; +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'setSketch', function setSketch( row, col, mark ) { + if (this.isLegal( row, col)) { + this.sketch[row][col] = mark; + } +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'addHorizontelString', function addHorizontelString( row, col, mark) { + var c = col; + for(ch of mark) { + this.setColor( row , c , 'Fbl' ); + this.addElement(row , c, ch ); + c++; + } +} ) +setNonEnumerableReadOnly( Pallete.prototype, 'setColor', function setColor(row, col, color) { + if (this.isLegal( row, col)) { + this.colors[row][col] = color; + } +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'addVerticalString', function addHorizontelString() { + +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'addElement', function addElement( row, col, marker = 'block' ) { + this.setSketch( row, col, marker ); + // console.log(this.setcanvas()) + // console.log(this.counter++); +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'creatCanva', function creatCanva() { + +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'drawFrame', function drawFrame() { + var i; + + for ( i = 0 ; i < this.rows; i++ ){ + this.addElement( i , 0 , 'vertical'); + this.addElement( i , this.cols-1 , 'vertical'); + this.setColor( i, 0, 'Fbl') + this.setColor( i, this.cols-1, 'Fbl') + } + + for ( i = 0 ; i < this.cols; i++ ){ + this.addElement( 0 , i , 'horizontal'); + this.addElement( this.rows-1 , i , 'horizontal'); + this.setColor( 0, i, 'Fbl') + this.setColor( this.rows-1, i, 'Fbl') + } + + // corners + + this.addElement( 0 , 0 , 'LBcorner') + this.addElement( 0 , this.cols-1 , 'RBcorner') + this.addElement( this.rows-1 , 0 , 'LTcorner') + this.addElement( this.rows-1 , this.cols-1 , 'RTcorner') +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'setcanvas', function setcanvas() { + var canva = ''; + var color ; + var background; + var remainwidth = this.terminalWidth - this.left; + var i; + var j; + // console.log(this.sketch) + // console.log(this.colors) + // console.log(this.backgrounds) + + // canva += '\x1b[47m\x1b[94m'; + if ( this.top > 0 ) { + canva += `\x1b[${this.top}B` + } + for( i = this.sketch.length - 1 ; i >= 0; i-- ) { + canva += '\r'; + if ( this.left > 0 ) { + canva += `\x1b[${this.left}C`; + } + for ( j = 0; j < this.sketch[0].length && j < remainwidth; j++ ) { + if ( !this.isLegal( i , j - 1 ) || this.backgrounds[i][j] != this.backgrounds[i][j-1] ) { + background = dfs[this.backgrounds[i][j]]; + if( background == undefined){ + console.log("bck") + } + canva += background; + } + if ( !this.isLegal( i , j - 1 ) || this.colors[i][j] != this.colors[i][j-1] ) { + color = dfs[this.colors[i][j]]; + // if( color == undefined){ + // console.log("bck") + // } + canva += color; + } + canva += dfs[this.sketch[i][j]]; + } + canva += dfs['def'] + canva += '\n'; + } + this.canva = canva ; + return this.canva; +} ) + +setNonEnumerableReadOnly( Pallete.prototype, 'set_matrices', function set_matrices() { + this.sketch = Array.from({length: this.rows}, ()=> Array(this.cols).fill('sp') ); + this.colors = Array.from({length: this.rows}, ()=> Array(this.cols).fill('Frd') ); + this.backgrounds = Array.from({length: this.rows}, ()=> Array(this.cols).fill('Bbu') ); +} ) + +module.exports = Pallete; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js new file mode 100644 index 000000000000..5785b4cc6d34 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js @@ -0,0 +1,320 @@ +var defineProperty = require('@stdlib/utils/define-property'); +var setNonEnumerable = require('@stdlib/utils/define-nonenumerable-property'); +var setHeight = require( './props/height/set.js' ); +var getHeight = require( './props/height/get.js' ); +var setWidth = require( './props/width/set.js' ); +var getWidth = require( './props/width/get.js' ); +var setHpos = require( './props/hpos/set.js' ); +var getHpos = require( './props/hpos/get.js' ); +var setVpos = require( './props/vpos/set.js' ); +var getVpos = require( './props/vpos/get.js' ); +var setIsFill = require( './props/isfill/set.js' ); +var getIsFill = require( './props/isfill/get.js' ); +var setIsLine = require( './props/isline/set.js' ); +var getIsLine = require( './props/isline/get.js' ); +var setNonEnumerableReadOnly = require('@stdlib/utils/define-nonenumerable-read-only-property'); +var dfs = require('@stdlib/plot/unicode/static_plots/base/lib/markers.js'); +var Pallete = require('./pallete'); +var ut = require('./utilies'); +var mergeFcn = require( '@stdlib/utils/merge' ).factory; +var objectKeys = require( '@stdlib/utils/keys' ); +var defaults = require('./default.js') + +// VARIABLES // + +var merge = mergeFcn({ + 'extend': false +}); + +// List of private properties (note: keep in alphabetical order): +var PRIVATE_PROPS = [ + '_heightscale', + '_widthscale', + '_hpos', + '_vpos', + '_isFill', + '_isLine', + '_row', + '_col', + '_xlim', + '_ylim', + '_padTop', + '_padBottom', + '_padLeft', + '_padRight', + '_x', + '_y', + '_rows', + '_cols', + '_marker', + '_terminalHeight', + '_terminalWidth' +]; + +function Primitive() { + + for( i = 0; i < PRIVATE_PROPS; i++ ) { + defineProperty( this, PRIVATE_PROPS[ i ], { + 'configurable': false, + 'enumerable': false, + 'writable': true, + 'value': null + } ) + } + + this._x = []; + this._y = []; + this._marker = []; + this._color = []; + this._palt = new Pallete(); + this._signals = 0; + this._xlim = [0, 0]; + this._ylim = [0, 0]; + this._cols = 0; + this._rows = 0; + var keys; + var key; + var i; + + // by defailt 1 padding for frame + this._padTop = 1; + this._padBottom = 2; + this._padLeft = 3; + this._padRight = 1; + + // this is positions decide the spawn positions for the + // horizontle position + this._hpscale = 1; + // vertical position + this._vpscale = 1; + + var options; + var nargs; + var opts; + + nargs = arguments.length; + opts = defaults(); + if ( nargs ) { + options = arguments[ 0 ]; + } + else { + options = {} + } + opts = merge( opts, options ); + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + key = keys[i]; + this[ key ] = opts[ key ]; + } + return this; + + +} + +setNonEnumerableReadOnly(Primitive.prototype, 'setSize', function setSize( row , col) { + // this._terminalWidth = siz[1]; + // this._terminalHeight = siz[0]; + // this._palt.terminalHeight = siz[0]; + // this._palt.terminalWidth = siz[1]; + + + + this._cols = col; + this._rows = row; + console.log(` ${this._rows} , ${this._cols}` ); + // this._palt.setSpawnPosition(Math.floor( this._terminalHeight * this._vpos ), Math.floor ( this._terminalWidth * this._hpos ) ); + this._palt.setSize(this._rows, this._cols); + this._palt.set_matrices(); +}); + +setNonEnumerableReadOnly(Primitive.prototype, 'build', function () { + var i; + var j; + var temp; + // this._xlim = ut.getLims(this._x); + // this._ylim = ut.getLims(this._y); + + var sx = []; + var sy = []; + + // this.drawFrame(); + + for (i = 0; i < this._x.length; i++) { + // sx.push(ut.scale_for_canva(this._x[i], this._rows - this._padTop - this._padBottom, this._xlim, this._padBottom)); + sx.push( this._x[i] ); + } + for (i = 0; i < this._y.length; i++) { + // sy.push(ut.scale_for_canva(this._y[i], this._cols - this._padLeft - this._padRight, this._ylim , this._padLeft)); + sy.push( this._y[i] ); + } + + var finalC =[]; + + + for ( i = 0 ; i < sx.length; i++ ) { + if ( this._isFill) { + finalC.push(ut.fillCord(sx[i], sy[i])); + } + + if ( this._isLine ) { + finalC.push(ut.fillLine(sx[i], sy[i])) + } + } + // for( i = 0; i < sx.length; i++ ) { + // temp = []; + // for( j = 0; j < sx[i].length-1; j++ ) { + // temp2 = ut.fillLine( [ sx[i][j], sx[i][j+1] ], [ sy[i][j], sy[i][j+1] ] ); + // temp.push( ...temp2 ); + // } + // finalC.push(temp); + // } + var temp; + for ( i = 0; i < finalC.length; i++ ){ + temp = finalC[i]; + for ( j = 0; j < temp.length; j++ ) { + this._palt.addElement( temp[j][0], temp[j][1] ) + } + } +}); + +setNonEnumerableReadOnly(Primitive.prototype, 'show', function () { + var canva = this._palt.setcanvas(); + // console.log(canva); + process.stdout.write(canva) +}); + +setNonEnumerableReadOnly(Primitive.prototype, 'draw', function (x, y, color, marker) { + this._x.push(x); + this._y.push(y); + this._marker.push(marker || ' '); + this._color.push(color || 'wh'); + this._signals += 1; +}); + +setNonEnumerableReadOnly(Primitive.prototype, 'draw_rectangle', function (xb, yb, color, marker) { + var xm = Math.min(...xb); + var xM = Math.max(...xb); + var ym = Math.min(...yb); + var yM = Math.max(...yb); + var x = [xm, xm, xM, xM, xm ]; + var y = [ym, yM, yM, ym, ym ]; + + this.draw(x, y, color, marker); +}); + +setNonEnumerableReadOnly(Primitive.prototype, 'addTic', function ( x, y, z, w ) { + var gap; + var curr; + var i; + + if (x && x.length > 0 ) { + for ( i = 0; i < x.length; i++ ) { + this._palt.addElement( this._padBottom - 1, x[i][1], 'HorTic' ); + this._palt.addHorizontelString( x[i][0], x[i][1], x[i][2].toString() ); + } + } + if ( z && z.length > 0 ) { + for ( i = 0; i < z.length; i++ ) { + this._palt.addElement( this._padBottom - 1, z[i][1], 'HorTic' ); + this._palt.addHorizontelString( z[i][0], z[i][1], z[i][2].toString() ); + } + } + if ( y && y.length > 0 ) { + for ( i = 0; i < y.length; i++ ) { + this._palt.addElement( y[i][0], this._padLeft - 1, 'VerTic' ); + this._palt.addHorizontelString( y[i][0], y[i][1], y[i][2].toString() ); + } + } + if ( w && w.length > 0 ) { + for ( i = 0; i < w.length; i++ ) { + this._palt.addElement( w[i][0], his._padLeft - 1, 'VerTic' ); + this._palt.addHorizontelString( w[i][0], w[i][1], w[i][2].toString() ); + } + // for ( i = this._padBottom ; i < w.length && i < this._rows; i++ ) { + // this._palt.addElement( i , this._rows - 1, 'VerTic'); + // // this._palt.setColor( i , this._rows - 1, 'Fbl'); + // this._palt.addHorizontelString( i , 0, w[i].toString() ); + // } + } +}); + + +setNonEnumerableReadOnly(Primitive.prototype, 'draw_bar', function (data, color = undefined, marker = undefined) { + this.setSize(); + var x = data[0]; + var y = data[1]; + var [ybar, xbar] = ut.scale_bar(x, y, this._cols - this._padLeft - this._padRight , x.length); + + for (let i = 0; i < xbar.length; i++) { + this.draw_rectangle(xbar[i], ybar[i], color, marker); + } +}); + +setNonEnumerableReadOnly( Primitive.prototype, 'drawFrame', function drawFrame() { + var i; + + for ( i = this._padBottom-1 ; i < this._rows; i++ ){ + this._palt.addElement( i , this._padLeft - 1 , 'vertical'); + this._palt.addElement( i , this._cols-1 , 'vertical'); + this._palt.setColor( i, this._padLeft - 1 , 'Fbl') + this._palt.setColor( i, this._cols-1, 'Fbl') + } + + for ( i = this._padLeft-1 ; i < this._cols; i++ ){ + this._palt.addElement( this._padBottom - 1 , i , 'horizontal'); + this._palt.addElement( this._rows-1 , i , 'horizontal'); + this._palt.setColor( this._padBottom - 1, i, 'Fbl') + this._palt.setColor( this._rows-1, i, 'Fbl') + } + + // corners + + this._palt.addElement( this._padBottom - 1 , this._padLeft - 1 , 'LBcorner') + this._palt.addElement( this._padBottom - 1 , this._cols-1 , 'RBcorner') + this._palt.addElement( this._rows-1 , this._padLeft - 1 , 'LTcorner') + this._palt.addElement( this._rows-1 , this._cols-1 , 'RTcorner') +} ) + +defineProperty( Primitive.prototype, 'heightscale', { + 'configurable': false, + 'enumerable': true, + 'set': setHeight, + 'get': getHeight +}); + +defineProperty( Primitive.prototype, 'widthscale', { + 'configurable': false, + 'enumerable': true, + 'set': setWidth, + 'get': getWidth +}); + +defineProperty( Primitive.prototype, 'hpos', { + 'configurable': false, + 'enumerable': true, + 'set': setHpos, + 'get': getHpos +}); + +defineProperty( Primitive.prototype, 'vpos', { + 'configurable': false, + 'enumerable': true, + 'set': setVpos, + 'get': getVpos +}); + +defineProperty( Primitive.prototype, 'isfill', { + 'configurable': false, + 'enumerable': true, + 'set': setIsFill, + 'get': getIsFill +}); + +defineProperty( Primitive.prototype, 'isline', { + 'configurable': false, + 'enumerable': true, + 'set': setIsLine, + 'get': getIsLine +}); + +module.exports= Primitive; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js new file mode 100644 index 000000000000..6542a732655a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {number} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._heightscale; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js new file mode 100644 index 000000000000..bc3e5bee6cc1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {number} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); + } + if ( num <= 1 && num >=0 ) { + this._heightscale = num; + } + else { + throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); + } + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js new file mode 100644 index 000000000000..64bb22874efa --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {number} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._hpos; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js new file mode 100644 index 000000000000..49d6f6f25ce4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {number} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); + } + if ( num <= 1 && num >=0 ) { + this._hpos = num; + } + else { + throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); + } + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js new file mode 100644 index 000000000000..92897d0ad81d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {boolean} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._isFill; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js new file mode 100644 index 000000000000..e0b55b7647f7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {boolean} bool - boolean indicating whether to re-render on a change event +* @throws {TypeError} must be a boolean +*/ +function set( bool ) { + /* eslint-disable no-invalid-this */ + if ( !isBoolean( bool ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); + } + this._isFill = bool; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js new file mode 100644 index 000000000000..a354ce712c8b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {boolean} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._isLine; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js new file mode 100644 index 000000000000..82db022b60e0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {boolean} bool - boolean indicating whether to re-render on a change event +* @throws {TypeError} must be a boolean +*/ +function set( bool ) { + /* eslint-disable no-invalid-this */ + if ( !isBoolean( bool ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); + } + this._isLine = bool; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js new file mode 100644 index 000000000000..61825174c3ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {number} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._vpos; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js new file mode 100644 index 000000000000..b06b30c6c405 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {number} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); + } + if ( num <= 1 && num >=0 ) { + this._vpos = num; + } + else { + throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); + } + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js new file mode 100644 index 000000000000..442d39beea1b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Returns the rendering mode. +* +* @private +* @returns {number} rendering mode +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._widthscale; +} + + +// EXPORTS // + +module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js new file mode 100644 index 000000000000..f7e1156d26d9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 logger = require( 'debug' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var debug = logger( 'sparkline:set:auto-render' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {number} num - num indicate scale value of the height. +* @throws {TypeError} must be a number +* @throws {RangeError} must be in range of 0 to 1 +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); + } + if ( num <= 1 && num >=0 ) { + this._widthscale = num; + } + else { + throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); + } + +} + + +// EXPORTS // + +module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js new file mode 100644 index 000000000000..eabe049e9047 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js @@ -0,0 +1,35 @@ +var Primitive = require('./primitive') + + +var options = { + heightscale : 0.7, + widthscale : 0.5, + hpos : 0.5, + vpos : 0.3 + +} +var options2 = { + heightscale : 0.7, + widthscale : 0.5, + // hpos : 0.5, + vpos : 0.3 + +} +var inst = new Primitive(options); +var inst2 = new Primitive(options2); +var data = [ + [ 1 , 2, 3, 4, 5, 6, 7 , 8, 9, 10, 11, 12, 13 + // ,11, 12, 13, 14, 15, 16 + ], + [ 10, 1, 5, 20, 25, 23, 35, 40, 10, 11, 12, 13, 15 + // , 10, 10, 10, 10, 10, 10 + ] +] +inst.draw_bar(data); +inst2.draw_bar(data); +inst.build(); +inst2.build(); +inst.show(); +inst2.show(); + +// process.stdout.write("this is my text") diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js new file mode 100644 index 000000000000..93e7217ceff4 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js @@ -0,0 +1,130 @@ +var utilites = { + scale_bar: function (x, y, containerWidth, dataPoints ) { + var width = 0.5; + + // width_half = width_half * ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); + width = width * ( ( 10 / dataPoints ) * ( containerWidth / 101 ) ); + // 0.8 is the max width we can use because we also need to care about the spaces between bars + width = Math.min( width , 0.8 ) + + // var actualWidth = containerWidth / dataPoints ; + // width *= ( Math.floor(actualWidth) / actualWidth ); + + var bins = x.length; + + var width_half = width / 2; + var xbar = []; + var ybar = []; + + // if (bins > 1) { + // width_half *= ( ( (Math.max(...x) - Math.min(...x)) / (bins - 1) ) ) ; + // } + + for (let i = 0; i < bins; i++) { + xbar.push([x[i] - width_half, x[i] + width_half]); + ybar.push([0, y[i]]); + } + + return [xbar, ybar]; + }, + + scale_for_canva: function (elms, bins, lim, pad) { + var elm; + var arr=[]; + var i; + var sElm; + for ( i = 0; i < elms.length; i++ ) { + elm = elms[i]; + sElm = ( elm - lim[0] ) / ( lim[1] - lim[0] ); + arr.push( Math.round( pad + ( ( bins - 1 ) * sElm ) ) ) + // arr.push( ) + } + return arr; + }, + + + getLims: function (elms) { + var min = Infinity; + var max = -Infinity; + + elms.forEach(arr => { + min = Math.min(min, ...arr); + max = Math.max(max, ...arr); + }); + + return [min, max]; + }, + + fill: function (x, y) { + var filledcords = []; + for (let i = x[0]; i < x[1]; i++) { + for (let j = y[0]; j < y[1]; j++) { + filledcords.push([i, j]); + } + } + return filledcords; + }, + + getTermSize: function () { + return [process.stdout.rows, process.stdout.columns]; + }, + + fillCord : function ( sx, sy ) { + if ( sx[0] != sx[sy.length - 1] || sx.length < 3 ) { + return + } + var lcord =[]; + var L1 = []; + var L2 = []; + var temp; + var i; + var j; + var k; + + L1 = this.fillLine( [sx[0], sx[1]], [sy[0], sy[1]] ); + L2 = this.fillLine( [sx[2], sx[3]], [sy[2], sy[3]] ); + + for ( i = 0 ; i < L1.length; i++ ) { + temp = this.fillLine( [ L1[i][0], L2[i][0] ] , [ L1[i][1], L2[i][1] ] ); + lcord.push( ...temp ); + } + return lcord; + }, + + fillLine : function ( sx, sy ) { + if ( sx.length < 2 ) { + return; + } + var lcord =[]; + var slop; + var mx; + var Mx; + var my; + var My; + var i; + + mx = Math.min( sx[0], sx[1] ); + Mx = Math.max( sx[0], sx[1] ); + my = Math.min( sy[0], sy[1] ); + My = Math.max( sy[0], sy[1] ); + if ( Mx-mx == 0 ) { + for( i = my; i <= My; i++ ){ + lcord.push([ mx, i]); + } + return lcord; + } + if ( My-my== 0 ) { + for( i = mx; i <= Mx; i++ ) { + lcord.push( [ i, my] ); + } + return lcord; + } + slop = (My-my)/(Mx-mx); + for( i = mx; i <= Mx; i++ ) { + lcord.push([ i, Math.floor( i * slop )]); + } + return lcord; + } +}; + +module.exports = utilites; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js new file mode 100644 index 000000000000..2f9f72de2b1a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js @@ -0,0 +1,11 @@ +function fill (x, y) { + var filledcords = []; + for (let i = x[0]; i < x[1]; i++) { + for (let j = y[0]; j < y[1]; j++) { + filledcords.push([i, j]); + } + } + return filledcords; +} + +module.exports = fill; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js new file mode 100644 index 000000000000..682579c33fc6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js @@ -0,0 +1,3 @@ +function getTermSize() { + return [process.stdout.rows, process.stdout.columns]; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js new file mode 100644 index 000000000000..0e0a829ce154 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js @@ -0,0 +1,34 @@ +function line ( sx, sy ) { + if ( sx.length < 2 ) { + return; + } + var lcord =[]; + var slop; + var mx; + var Mx; + var my; + var My; + var i; + + mx = Math.min( sx[0], sx[1] ); + Mx = Math.max( sx[0], sx[1] ); + my = Math.min( sy[0], sy[1] ); + My = Math.max( sy[0], sy[1] ); + if ( Mx-mx == 0 ) { + for( i = my; i <= My; i++ ){ + lcord.push([ mx, i]); + } + return lcord; + } + if ( My-my== 0 ) { + for( i = mx; i <= Mx; i++ ) { + lcord.push( [ i, my] ); + } + return lcord; + } + slop = (My-my)/(Mx-mx); + for( i = mx; i <= Mx; i++ ) { + lcord.push([ i, Math.floor( i * slop )]); + } + return lcord; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js new file mode 100644 index 000000000000..1cf819d1a85d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js @@ -0,0 +1,12 @@ +function scale_for_canva (elms, bins, lim, pad) { + var elm; + var arr=[]; + var i; + for ( i = 0; i < elms.length; i++ ) { + elm = elms[i]; + arr.push(Math.floor( pad + Math.round( (bins - 1) * ((elm - lim[0]) / (lim[1] - lim[0]))))) + } + return arr; +} + +module.exports = scale_for_canva; \ No newline at end of file From 9c952832516cc7e79b4989c078500a922585ca10 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 25 Feb 2025 16:45:21 +0000 Subject: [PATCH 2/4] feat: add draft implementation for interaface of unicode plot and bar plot --- 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 --- --- .../plot/unicode/static_plots/bar/default.js | 10 +- .../unicode/static_plots/bar/example/index.js | 66 ++ .../plot/unicode/static_plots/bar/index.js | 37 ++ .../plot/unicode/static_plots/bar/main.js | 627 +++++++++++------- .../isfill => bar/props/barColor}/get.js | 4 +- .../isline => bar/props/barColor}/set.js | 16 +- .../static_plots/bar/props/cols/get.js | 2 +- .../static_plots/bar/props/cols/set.js | 10 +- .../hpos => bar/props/labelColor}/get.js | 6 +- .../static_plots/bar/props/labelColor/set.js | 47 ++ .../props/isline => bar/props/marker}/get.js | 4 +- .../props/isfill => bar/props/marker}/set.js | 16 +- .../static_plots/bar/props/rows/get.js | 2 +- .../static_plots/bar/props/rows/set.js | 15 +- .../static_plots/bar/props/vertical/set.js | 57 -- .../static_plots/bar/props/xaxis/get.js | 2 +- .../static_plots/bar/props/xaxis/set.js | 12 +- .../static_plots/bar/props/yaxis/get.js | 2 +- .../static_plots/bar/props/yaxis/set.js | 12 +- .../plot/unicode/static_plots/bar/test.js | 26 - .../static_plots/bar/utils/scale_bar.js | 30 - .../unicode/static_plots/base/lib/default.js | 23 +- .../unicode/static_plots/base/lib/index.js | 12 +- .../unicode/static_plots/base/lib/markers.js | 34 - .../unicode/static_plots/base/lib/pallete.js | 384 +++++++---- .../unicode/static_plots/base/lib/plotbase.js | 456 +++++++++++++ .../static_plots/base/lib/primitive.js | 320 --------- .../lib/props/{height => padBottom}/get.js | 10 +- .../base/lib/props/{vpos => padBottom}/set.js | 23 +- .../base/lib/props/padLeft/get.js | 35 + .../base/lib/props/{width => padLeft}/set.js | 23 +- .../lib/props/padRight}/get.js | 10 +- .../lib/props/{height => padRight}/set.js | 23 +- .../static_plots/base/lib/props/padTop/get.js | 35 + .../static_plots/base/lib/props/padTop/set.js | 47 ++ .../base/lib/props/{vpos => setSize}/get.js | 7 +- .../base/lib/props/{hpos => setSize}/set.js | 24 +- .../static_plots/base/lib/props/width/get.js | 35 - .../unicode/static_plots/base/lib/test.js | 35 - .../unicode/static_plots/base/lib/utilies.js | 130 ---- .../static_plots/base/lib/utils/fill.js | 11 - .../base/lib/utils/getTerminalSize.js | 3 - .../static_plots/base/lib/utils/line.js | 34 - .../base/lib/utils/scale_for_canva.js | 12 - .../unicode/static_plots/marker/colors.js | 33 + .../unicode/static_plots/marker/markers.js | 62 ++ 46 files changed, 1548 insertions(+), 1276 deletions(-) create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js rename lib/node_modules/@stdlib/plot/unicode/static_plots/{base/lib/props/isfill => bar/props/barColor}/get.js (93%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/{base/lib/props/isline => bar/props/barColor}/set.js (64%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/{base/lib/props/hpos => bar/props/labelColor}/get.js (90%) create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js rename lib/node_modules/@stdlib/plot/unicode/static_plots/{base/lib/props/isline => bar/props/marker}/get.js (93%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/{base/lib/props/isfill => bar/props/marker}/set.js (64%) delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js rename lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/{height => padBottom}/get.js (81%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/{vpos => padBottom}/set.js (67%) create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/get.js rename lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/{width => padLeft}/set.js (67%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/{bar/props/vertical => base/lib/props/padRight}/get.js (81%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/{height => padRight}/set.js (67%) create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/get.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/set.js rename lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/{vpos => setSize}/get.js (90%) rename lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/{hpos => setSize}/set.js (70%) delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js delete mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js create mode 100644 lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js index 743c797337ff..77984729fcad 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js @@ -32,10 +32,12 @@ function defaults() { var out = {}; out.rows = void 0; - out.cols = void 0; - out.vertical = false; - out.xaxis = []; - out.yaxis = []; + out.cols = void 0; + out.xaxis = []; + out.yaxis = []; + out.barColor = 'Fbl'; + out.labelColor = 'Fbl'; + out.marker = 'block'; return out; } diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js new file mode 100644 index 000000000000..fa15746e817a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 barchart = require( '@stdlib/plot/unicode/static_plots/bar' ); + +/* +1) some blocks are not generating Ex : 8th bar +2) labelColor is not working +*/ +var options = { + 'xaxis': [ 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + 'yaxis': [ 10, + 1, + 5, + 6, + 7, + 22, + 10, + 35, + 40, + 10, + 11, + 12, + 13, + 15 + ], + 'rows': 20, + 'cols': 100, + 'barColor': 'Frd', + 'labelColor': 'Frd' +}; +var inst = new barchart(options); + +inst.draw(); +inst.render(); diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js new file mode 100644 index 000000000000..f9ab413a4e36 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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'; + +/** +* Base class for unicode bar chart. +* +* @module @stdlib/plot/unicode/static_plot/bar +* +* @example +* var base = require( '@stdlib/plot/unicode/static_plot/bar' ); +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js index 115c1e2e93cc..71c5eb947a56 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js @@ -1,26 +1,56 @@ -var setNonEnumerableReadOnly = require('@stdlib/utils/define-nonenumerable-read-only-property'); -var defineProperty = require('@stdlib/utils/define-property'); +/* eslint-disable max-len */ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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-restricted-syntax, no-underscore-dangle, no-invalid-this */ + +'use strict'; + +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var defineProperty = require( '@stdlib/utils/define-property' ); +var min = require( '@stdlib/math/base/special/min' ); +var round = require( '@stdlib/math/base/special/round' ); +var max = require( '@stdlib/math/base/special/max' ); +var minmaxn = require( '@stdlib/math/base/special/minmaxn' ); var mergeFcn = require( '@stdlib/utils/merge' ).factory; var objectKeys = require( '@stdlib/utils/keys' ); -var defaults = require('./default.js'); +var ceil = require( '@stdlib/math/base/special/ceil' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var defaults = require( './default.js' ); var setXaxis = require( './props/xaxis/set.js' ); var getXaxis = require( './props/xaxis/get.js' ); var setYaxis = require( './props/yaxis/set.js' ); var getYaxis = require( './props/yaxis/get.js' ); -var setRows = require( './props/rows/set.js' ) -var getRows = require( './props/rows/get.js' ) -var setCols = require( './props/cols/set.js' ) +var setRows = require( './props/rows/set.js' ); +var getRows = require( './props/rows/get.js' ); +var setCols = require( './props/cols/set.js' ); var getCols = require( './props/cols/get.js' ); -var setVertical = require( './props/vertical/set.js' ); -var getVertical = require( './props/vertical/get.js' ); -var primitive = require( '../base/lib' ); -// var scale_bar = require( './utils/scale_bar.js' ) +var setBarColor = require( './props/barColor/set.js' ); +var getBarColor = require( './props/barColor/get.js' ); +var setLabelColor = require( './props/labelColor/set.js' ); +var getLabelColor = require( './props/labelColor/get.js' ); +var setMarker = require( './props/marker/set.js' ); +var getMarker = require( './props/marker/get.js' ); +var primitive = require( './../base/lib' ); + + +// VARIABLES // -/** - * xpos - * ypos - * - */ var merge = mergeFcn({ 'extend': false }); @@ -28,276 +58,409 @@ var merge = mergeFcn({ // List of private properties (note: keep in alphabetical order): var PRIVATE_PROPS = [ '_x', - '_y', - '_primitive', - '_rows', - '_cols', - '_vertical' + '_y', + '_rows', + '_cols', + '_barColor', + '_marker', + '_labelColor' ]; -var options = { - 'isFill' : true +var Poptions = { + 'padBottom': 2 +}; -} -function barplot() { - for( i = 0; i < PRIVATE_PROPS; i++ ) { - defineProperty( this, PRIVATE_PROPS[ i ], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - } ) - } +// MAIN // - this._x = []; - this._y = []; - this._primitive = new primitive(); - var options; +/** +* BarPlot constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {number} [rows] - number of character in height for plot +* @param {number} [cols] - number of character in width for plot +* @param {Array} [xaxis] - xaxis data +* @param {Array} [yaxis] - yaxis data +* @throws {TypeError} must provide valid options +* @returns {Plot} Plot instance +* +* @example +* var barplot = new BarPlot(); +*/ +function BarPlot() { + var options; var nargs; + var keys; var opts; + var key; + var i; - nargs = arguments.length; - opts = defaults(); - if ( nargs ) { - options = arguments[ 0 ]; - } - else { - options = {} - } - opts = merge( opts, options ); - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[i]; - this[ key ] = opts[ key ]; - } - - // initilize primitive class - - this._primitive.setSize(this._rows, this.cols ) - return this; + for ( i = 0; i < PRIVATE_PROPS; i++ ) { + defineProperty( this, PRIVATE_PROPS[ i ], { + 'configurable': false, + 'enumerable': false, + 'writable': true, + 'value': null + }); + } + defineProperty( this, '_primitive', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': new primitive(Poptions) + }); + nargs = arguments.length; + opts = defaults(); + if ( nargs ) { + options = arguments[ 0 ]; + } + else { + options = {}; + } + opts = merge( opts, options ); + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + key = keys[ i ]; + this[ key ] = opts[ key ]; + } + + // Initilize primitive class + + this._primitive.setSize = { + 'rows': this._rows, + 'cols': this._cols + }; + return this; } -setNonEnumerableReadOnly(barplot.prototype, 'draw', function draw() { - this.addLableX(); - var ybar; - var xbar; - var temp; - var i; - if ( this._vertical ) { - temp = scale_bar_vertical(this._x, this._y, this._rows - this._primitive._padTop - this._primitive._padBottom ); - xbar = temp[1]; - ybar = temp[0]; - } - else { - temp = scale_bar(this._x, this._y, this._cols - this._primitive._padLeft - this._primitive._padRight ); - xbar = temp[0]; - ybar = temp[1]; - } - var xlim = getLim(xbar) - var ylim = getLim(ybar) - // var finalCordx = scale( xbar, this._x.length - this._primitive._padLeft - this._primitive._padRight, getLim(xbar), this._ ) - var finalCordx = []; - var finalCordy = []; - - for ( i = 0; i < xbar.length; i++ ) { - finalCordx.push( scale( xbar[i], this._cols - this._primitive._padLeft - this._primitive._padRight, xlim, this._primitive._padLeft ) ); - } - this.addCategory( finalCordx ); - for ( i = 0; i < ybar.length; i++ ) { - finalCordy.push( scale( ybar[i], this._rows - this._primitive._padBottom - this._primitive._padTop, ylim, this._primitive._padBottom ) ); - } - for ( i = 0; i < xbar.length; i++ ) { - this._primitive.draw_rectangle( finalCordy[i], finalCordx[i] ); - } +/** + * Main method which add label, draw bars according to the requirement. + * + * @name draw + * @memberof Primitive.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(BarPlot.prototype, 'draw', function draw() { + var finalCordx; + var finalCordy; + var ybar; + var xbar; + var xlim; + var ylim; + var temp; + var i; + + finalCordx = []; + finalCordy = []; + this.addLableX(); + this._primitive.drawFrame(); + temp = scaleBar( this._x, this._y, this._cols - this._primitive._padLeft - this._primitive._padRight ); + xbar = temp[ 0 ]; + ybar = temp[ 1 ]; + xlim = getLim( xbar ); + ylim = getLim( ybar ); + for ( i = 0; i < xbar.length; i++ ) { + finalCordx.push( scale( xbar[ i ], this._cols - this._primitive._padLeft - this._primitive._padRight, xlim, this._primitive._padLeft ) ); + } + this.addCategory( finalCordx ); + for ( i = 0; i < ybar.length; i++ ) { + finalCordy.push( scale( ybar[ i ], this._rows - this._primitive._padBottom - this._primitive._padTop, ylim, this._primitive._padBottom ) ); + } + for ( i = 0; i < xbar.length; i++ ) { + this._primitive.drawRectangle( finalCordy[ i ], finalCordx[ i ], this._barColor, this._marker ); + } }); -setNonEnumerableReadOnly(barplot.prototype, 'render', function render() { - this._primitive.build(); - this._primitive.show(); +/** + * Render and display the result. + * + * @name render + * @memberof Primitive.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(BarPlot.prototype, 'render', function render() { + this._primitive.build(); + this._primitive.show(); }); -setNonEnumerableReadOnly(barplot.prototype, 'addLableX', function addLableX() { - var xpos = this._primitive._padBottom; - var pointGap = 1; - var y = []; - var mx; - var i; - var gap; - - x = [ ...this._x ]; - mx = minmax( this._y ); - - this._primitive._padLeft += mx[1].toString().length ; - this._primitive.drawFrame(); - if ( this._vertical ) { - gap = ( mx[1] - mx[0] ) / ( this._cols - this._primitive._padLeft - this._primitive._padRight ); - } - else { - gap = ( mx[1] - mx[0]) / (this._rows - this._primitive._padTop - this._primitive._padBottom ); - } - - gap = Math.ceil(gap * 10) / 10; - i = mx[0]; - while ( i <= mx[1] ) { - var elm = new Array(3); - elm[1] = 0; - elm[0] = xpos; - elm[2] = i.toString(); - y.push(elm); - i += gap; - i = Math.round(i * 10) / 10; - xpos += pointGap; - } - - this._primitive.addTic( [], y ); - +/** + * Add x label and tics. + * + * @name addLableX + * @memberof Primitive.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(BarPlot.prototype, 'addLableX', function addLableX() { + var pointGap; + var xpos; + var step; + var elm; + var mx; + var y; + var i; + + pointGap = 1; + xpos = this._primitive._padBottom; + y = []; + mx = minmaxn.apply( null, this._y ); + + // Adding extra padding on left according to the number range of the tics + this._primitive.padLeft += mx[ 1 ].toString().length + 2; + + // Calculating steps of number according the rows + step = ( mx[ 1 ] - mx[ 0 ] ) / ( this._rows - this._primitive._padTop - this._primitive._padBottom ); + + // Changing precision of step to 1 dig after decimal + step = ceil( step * 10 ) / 10; + i = mx[ 0 ]; + while ( i <= mx[ 1 ] ) { + elm = new Array( 3 ); + elm[ 1 ] = 0; + elm[ 0 ] = xpos; + elm[ 2 ] = i.toString(); + y.push( elm ); + i += step; + i = round( i * 10 ) / 10; + xpos += pointGap; + } + this._primitive.addTic( false, this._labelColor, [], y ); }); -setNonEnumerableReadOnly(barplot.prototype, 'addCategory', function addCategory( BarPositions ) { - var i; - var cat = []; - var elm; - var temp; - for ( i = 0; i < BarPositions.length; i++ ) { - elm = new Array(3); - temp = Math.floor( ( BarPositions[i][1] + BarPositions[i][0] ) / 2 ); - elm[ 0 ] = 0; - elm[ 1 ] = temp; - elm[ 2 ] = ( i + 1 ).toString(); - cat.push(elm); - } - - this._primitive.addTic(cat); - +/** + * Add categories for the bars. + * + * @name addCategory + * @memberof Primitive.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(BarPlot.prototype, 'addCategory', function addCategory( BarPositions ) { + var temp; + var cat; + var elm; + var i; + + cat = []; + for ( i = 0; i < BarPositions.length; i++ ) { + // row, col, str + elm = new Array( 3 ); + + // Taking middle + temp = floor( ( BarPositions[i][1] + BarPositions[i][0] ) / 2 ); + elm[ 0 ] = 0; + elm[ 1 ] = temp; + elm[ 2 ] = ( i + 1 ).toString(); + cat.push( elm ); + } + this._primitive.addTic( true, this._labelColor, cat ); }); - - -defineProperty( barplot.prototype, 'xaxis', { +/** + * @name xaxis + * @memberof Primitive.prototype + * @type {Array} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'xaxis', { 'configurable': false, 'enumerable': true, 'set': setXaxis, 'get': getXaxis }); -defineProperty( barplot.prototype, 'yaxis', { +/** + * @name yaxis + * @memberof Primitive.prototype + * @type {Array} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'yaxis', { 'configurable': false, 'enumerable': true, 'set': setYaxis, 'get': getYaxis }); -defineProperty( barplot.prototype, 'rows', { +/** + * @name rows + * @memberof Primitive.prototype + * @type {number} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'rows', { 'configurable': false, 'enumerable': true, 'set': setRows, 'get': getRows }); -defineProperty( barplot.prototype, 'cols', { +/** + * @name cols + * @memberof Primitive.prototype + * @type {number} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'cols', { 'configurable': false, 'enumerable': true, 'set': setCols, 'get': getCols }); -defineProperty( barplot.prototype, 'vertical', { +/** + * @name barColor + * @memberof Primitive.prototype + * @type {string} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'barColor', { 'configurable': false, 'enumerable': true, - 'set': setVertical, - 'get': getVertical + 'set': setBarColor, + 'get': getBarColor }); +/** + * @name labelColor + * @memberof Primitive.prototype + * @type {string} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'labelColor', { + 'configurable': false, + 'enumerable': true, + 'set': setLabelColor, + 'get': getLabelColor +}); -function scale_bar ( x, y, containerWidth ) { - var width = 0.8; - var dataPoints = x.length; - var awidth = Math.floor( containerWidth / dataPoints ); - width = width * ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); - // 0.8 is the max width we can use because we also need to care about the spaces between bars - width = Math.min( width , 0.8 ) - - - // this normalization is done to reduce the rounding error, effect of this can be seen when the width is of 16 char or less and there is 14 plot - var widthWG = Math.floor( awidth * width ); - width = width * ( widthWG / ( awidth * width ) ); - - var bins = x.length; - - var width_half = width / 2; - var xbar = []; - var ybar = []; - - for (let i = 0; i < bins; i++) { - xbar.push([x[i] - width_half, x[i] + width_half]); - ybar.push([0, y[i]]); - } - - return [xbar, ybar]; -} - - -function scale_bar_vertical ( x, y, containerWidth ) { - var width = 0.2; - var dataPoints = x.length; - var awidth = Math.floor( containerWidth / dataPoints ); - width = width * ( ( containerWidth / dataPoints ) * ( 7 / 12 ) ); - width = Math.min( width , 0.8 ) - - var bins = x.length; - - var width_half = width / 2; - var xbar = []; - var ybar = []; - - for (let i = 0; i < bins; i++) { - xbar.push( [ i - width_half + 1, i + width_half + 1]); - ybar.push([0, y[i]]); - } +/** + * @name marker + * @memberof Primitive.prototype + * @type {string} + * @throws {TypeError} + * + */ +defineProperty( BarPlot.prototype, 'marker', { + 'configurable': false, + 'enumerable': true, + 'set': setMarker, + 'get': getMarker +}); - return [xbar, ybar]; +/** +* Find the best suitable width of the bars according to the width. +* +* @private +* +* @type {Function} +* @param {Array} x - date of x axis +* @param {Array} y - data of y axis +* @param {number} containerWidth - width of the container +* @returns {Array} array of scale represent width and height of bar +* */ +function scaleBar( x, y, containerWidth ) { + var dataPoints; + var widthHalf; + var barWidth; + var awidth; + var width; + var bins; + var xbar; + var ybar; + var i; + + width = 0.8; + dataPoints = x.length; + awidth = floor( containerWidth / dataPoints ); + + // Scaling the width scale, with 101 character width and 10 data points bar width scale of 0.8 works great, so scale is realtive to it, by scale them with the ratio of ( containerWidht / dataPoints ) / ( 101 / 10 ) + width *= ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); + + // 0.8 is the max width we can use because we also need to care about the spaces between bars + width = min( width, 0.8 ); + + // This normalization is done to reduce the rounding error, effect of this can be seen when the width is of 16 char or less and atleast 14 bars + barWidth = floor( awidth * width ); + width *= ( barWidth / ( awidth * width ) ); + bins = x.length; + widthHalf = width / 2; + xbar = []; + ybar = []; + for ( i = 0; i < bins; i++ ) { + xbar.push( [ x[ i ] - widthHalf, x[ i ] + widthHalf ] ); + ybar.push( [ 0, y[ i ] ] ); + } + return [ xbar, ybar ]; } -function minmax( elms ) { - - - var min = Infinity ; - var max = -Infinity; - var elm; - for ( elm of elms ) { - min = Math.min( elm, min ); - max = Math.max(elm , max); - } - - return [min, max]; +/** +* Convert the elms value in scale of between bins and pad. +* +* @private +* +* @type {Function} +* @param {Array} elms - array of value need to scale +* @param {Number} bins - upper value under which we have to scale +* @param {Array} lim - array of high and low value of data +* @param {number} pad - pading from left +* @returns {Array} array of range value +* */ +function scale( elms, bins, lim, pad ) { + var sElm; + var elm; + var arr; + var i; + + arr = []; + for ( i = 0; i < elms.length; i++ ) { + elm = elms[i]; + + // Converting value in range of 0 to 1 + sElm = ( elm - lim[ 0 ] ) / ( lim[ 1 ] - lim[ 0 ] ); + arr.push( round( pad + ( ( bins - 1 ) * sElm ) ) ); + } + return arr; } -function scale (elms, bins, lim, pad) { - var elm; - var arr=[]; - var i; - var sElm; - for ( i = 0; i < elms.length; i++ ) { - elm = elms[i]; - sElm = ( elm - lim[0] ) / ( lim[1] - lim[0] ); - arr.push( Math.round( pad + ( ( bins - 1 ) * sElm ) ) ) - // arr.push( ) - } - return arr; +/** +* Helper function which give the higher and lower value of the bars. +* +* @private +* +* @name getLim +* @type {Function} +* @param {Array} elms - target elements +* @returns {Array} return min and max value of elms +* */ +function getLim( elms ) { + var temp; + var mn; + var mx; + var i; + + for ( i = 0; i < elms.length; i++ ) { + temp = elms[i]; + mn = min( mn, temp[ 0 ] ); + mx = max( mx, temp[ 1 ] ); + } + return [ mn, mx ]; } -function getLim(elms) { - var min = Infinity; - var max = -Infinity; - - elms.forEach(arr => { - min = Math.min(min, ...arr); - max = Math.max(max, ...arr); - }); - - return [min, max]; -} +// EXPORTS // -module.exports = barplot \ No newline at end of file +module.exports = BarPlot; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js similarity index 93% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js index 92897d0ad81d..4a1fc2694848 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js @@ -22,11 +22,11 @@ * Returns the rendering mode. * * @private -* @returns {boolean} rendering mode +* @returns {Array} rendering mode */ function get() { /* eslint-disable no-invalid-this */ - return this._isFill; + return this._barColor; } diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js similarity index 64% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js index 82db022b60e0..47d6b13446a1 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js @@ -20,14 +20,12 @@ // MODULES // -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var format = require( '@stdlib/string/format' ); // VARIABLES // -var debug = logger( 'sparkline:set:auto-render' ); +var colors = require( '@stdlib/plot/unicode/static_plots/marker/colors.js' ); // MAIN // @@ -36,15 +34,15 @@ var debug = logger( 'sparkline:set:auto-render' ); * Sets the rendering mode. * * @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean +* @param {string} color - indicate the color code. +* @throws {TypeError} must be a number */ -function set( bool ) { +function set( color ) { /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); + if ( !( color in colors ) ) { + throw new TypeError( format( 'invalid color code.' ) ); } - this._isLine = bool; + this._barColor = color; } diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js index 4d6b12927581..a9b2212b063a 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js @@ -32,4 +32,4 @@ function get() { // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js index c5d8efaef2d3..c210b614208c 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js @@ -20,17 +20,10 @@ // MODULES // -var logger = require( 'debug' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isArray = require( '@stdlib/assert/is-array' ); var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** @@ -51,10 +44,9 @@ function set( num ) { throw new TypeError( format( 'invalid assignment. must be a array.' ) ); } this._cols = num; - } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js similarity index 90% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js index 64bb22874efa..ed0c46ed7f78 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js @@ -22,14 +22,14 @@ * Returns the rendering mode. * * @private -* @returns {number} rendering mode +* @returns {Array} rendering mode */ function get() { /* eslint-disable no-invalid-this */ - return this._hpos; + return this._labelColors; } // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js new file mode 100644 index 000000000000..8c28597e2f9f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 format = require( '@stdlib/string/format' ); +var colors = require( '@stdlib/plot/unicode/static_plots/marker/colors.js' ); + + +// MAIN // + +/** +* Sets the rendering mode. +* +* @private +* @param {string} color - indicate the color code. +* @throws {TypeError} must be a number +*/ +function set( color ) { + /* eslint-disable no-invalid-this */ + if ( !( color in colors ) ) { + throw new TypeError( format( 'invalid color code.' ) ); + } + this._labelColor = color; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js similarity index 93% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js index a354ce712c8b..a9b2212b063a 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isline/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js @@ -22,11 +22,11 @@ * Returns the rendering mode. * * @private -* @returns {boolean} rendering mode +* @returns {Array} rendering mode */ function get() { /* eslint-disable no-invalid-this */ - return this._isLine; + return this._cols; } diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js similarity index 64% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js index e0b55b7647f7..2d1e70760b41 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/isfill/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js @@ -20,14 +20,12 @@ // MODULES // -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var format = require( '@stdlib/string/format' ); // VARIABLES // -var debug = logger( 'sparkline:set:auto-render' ); +var markers = require( '@stdlib/plot/unicode/static_plots/marker/markers.js' ); // MAIN // @@ -36,15 +34,15 @@ var debug = logger( 'sparkline:set:auto-render' ); * Sets the rendering mode. * * @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean +* @param {string} marker - indicate the marker code. +* @throws {TypeError} must be a number */ -function set( bool ) { +function set( marker ) { /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); + if ( !( marker in markers ) ) { + throw new TypeError( format( 'invalid color code.' ) ); } - this._isFill = bool; + this._marker = marker; } diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js index ff5cc5b151b5..abe1e41beed7 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js @@ -32,4 +32,4 @@ function get() { // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js index e2869ce3c3de..6dfb4c411c0b 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js @@ -20,17 +20,10 @@ // MODULES // -var logger = require( 'debug' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isArray = require( '@stdlib/assert/is-array' ); var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** @@ -44,18 +37,16 @@ var debug = logger( 'sparkline:set:auto-render' ); function set( num ) { /* eslint-disable no-invalid-this */ if ( !num ) { - this._rows = process.stdout.rows ; + this._rows = process.stdout.rows; return; } - if ( !isNumber( num ) ) { + if ( !isNumber( num ) ) { throw new TypeError( format( 'invalid assignment. must be a array.' ) ); } this._rows = num; - - } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js deleted file mode 100644 index e42b102fe65f..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/set.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); -const isBoolean = require('@stdlib/assert/is-boolean').isPrimitive; - - -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} num - num indicate scale value of the height. -* @throws {TypeError} must be a number -* @throws {RangeError} must be in range of 0 to 1 -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. must be a array.' ) ); - } - this._vertical = bool; - -} - - -// EXPORTS // - -module.exports = set; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js index d20731021564..4bcc8ea568f0 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js @@ -32,4 +32,4 @@ function get() { // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js index 83cc5e4f3cf8..51753b8d1f0d 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js @@ -20,17 +20,10 @@ // MODULES // -var logger = require( 'debug' ); -// var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var isArray = require( '@stdlib/assert/is-array' ); var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** @@ -46,11 +39,10 @@ function set( num ) { if ( !isArray( num ) ) { throw new TypeError( format( 'invalid assignment. `%s` must be a array. Value: `%s`.', 'autoRender', num ) ); } - this._x = num; - + this._x = num; } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js index fcf2a1102b43..bc47a4e150d3 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js @@ -32,4 +32,4 @@ function get() { // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js index 69f8c16a783a..f019328c2b6d 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js @@ -20,17 +20,10 @@ // MODULES // -var logger = require( 'debug' ); -// var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var isArray = require( '@stdlib/assert/is-array' ); var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** @@ -46,11 +39,10 @@ function set( num ) { if ( !isArray( num ) ) { throw new TypeError( format( 'invalid assignment. `%s` must be a array. Value: `%s`.', 'autoRender', num ) ); } - this._y = num; - + this._y = num; } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js deleted file mode 100644 index 53903d280546..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/test.js +++ /dev/null @@ -1,26 +0,0 @@ -var barchart = require('./main'); - - -// var options = { -// xaxis : [ 1 , 2, 3, 4, 5, 6, 7 , 8, 9, 10, 11, 12, 13], -// yaxis : [10, 1, 5, 20, 25, 23, 35, 40, 10, 11, 12, 13, 15], -// rows : 40, -// cols: 40, -// vertical : true -// } -var options = { - xaxis : [ 1 , 2, 3, 4, 5,6, - 7 , 8, 9, 10, 11, 12, 13,14 - ], - yaxis : [10, 1, 5, 6, 7, 22, 10, - 35, 40, 10, 11, 12, 13, 15 - ], - rows : 10, - cols: 70, - // vertical : true -} -var inst = new barchart(options) - - -inst.draw(); -inst.render(); diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js deleted file mode 100644 index a128717ebf98..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/utils/scale_bar.js +++ /dev/null @@ -1,30 +0,0 @@ -function scale_bar () { - var width = 0.8; - - // width_half = width_half * ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); - width = width * ( ( 10 / dataPoints ) * ( containerWidth / 101 ) ); - // 0.8 is the max width we can use because we also need to care about the spaces between bars - width = Math.min( width , 0.8 ) - - // var actualWidth = containerWidth / dataPoints ; - // width *= ( Math.floor(actualWidth) / actualWidth ); - - var bins = x.length; - - var width_half = width / 2; - var xbar = []; - var ybar = []; - - // if (bins > 1) { - // width_half *= ( ( (Math.max(...x) - Math.min(...x)) / (bins - 1) ) ) ; - // } - - for (let i = 0; i < bins; i++) { - xbar.push([x[i] - width_half, x[i] + width_half]); - ybar.push([0, y[i]]); - } - - return [xbar, ybar]; -} - -module.exports = scale_bar \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js index d30903a56b64..ef46804748c3 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js @@ -18,11 +18,6 @@ 'use strict'; -// MODULES // - - - - // MAIN // /** @@ -30,15 +25,21 @@ * * @private * @returns {Object} default options +* +* @example +* var opts = defaults(); +* // returns {...} */ function defaults() { var out = {}; - out.heightscale = 1; - out.widthscale = 1; - out.hpos = 0; - out.vpos = 0; - out.isline = false; - out.isfill = true; + out.padBottom = 1; + out.padLeft = 1; + out.padRight = 1; + out.padTop = 1; + out.setSize = { + 'rows': 0, + 'cols': 0 + }; return out; } diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js index 80d2e5d92411..7bb193f45018 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js @@ -19,21 +19,17 @@ 'use strict'; /** -* Base class for sparklines. +* Base class for base constructure for unicode. * -* @module @stdlib/plot/sparklines/base/ctor +* @module @stdlib/plot/unicode/static_plots/base * * @example -* var Sparkline = require( '@stdlib/plot/sparklines/base/ctor' ); -* -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = Sparkline( data ); +* var base = require( '@stdlib/plot/unicode/static_plots/base' ); */ // MODULES // -var main = require( './primitive' ); +var main = require( './plotbase.js' ); // EXPORTS // diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js deleted file mode 100644 index 6b35e4e308d2..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/markers.js +++ /dev/null @@ -1,34 +0,0 @@ - -const elms = { - 'sp' : ' ', - 'null' : '', - 'block' : '█' , - 'vertical': '│', - 'horizontal' : '─', - 'LBcorner' : '└', - 'RBcorner' : '┘', - 'LTcorner' : '┌', - 'RTcorner' : '┐', - 'Fwh' : '\x1b[37m', - 'Fbl' : '\x1b[30m', - 'Frd' : '\x1b[31m', - 'Fbu' : '\x1b[94m', - 'Bwh' : '\x1b[47m', - 'Bbl' : '\x1b[40m', - 'Bbu' : '\x1b[104m', - 'Byl' : '\x1b[43m', - // 'Bbu' : '\x1b[33m', - 'def': '\x1b[0m', - 'HorTic' : '┬' , - 'VerTic' : '┤' - -} -var i = 0; -for ( i = 0 ; i < 10; i++ ) { - elms[`${i}`] = `${i}` -} - -elms['.'] = '.'; - - -module.exports = elms; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js index 26d8694ced22..183c66d5c070 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js @@ -1,152 +1,254 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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-underscore-dangle */ +/* eslint-disable no-invalid-this */ +/* eslint-disable max-len */ +/* eslint-disable no-restricted-syntax */ + +'use strict'; + var defineProperty = require( '@stdlib/utils/define-property' ); -var setNonEnumerable = require( '@stdlib/utils/define-nonenumerable-property' ); var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var dfs = require('@stdlib/plot/unicode/static_plots/base/lib/markers') -function Pallete () { - this.counter = 0; - this.rows = 0; - this.cols = 0; - this.top = 0; - this.left = 0; - this.canva; - this.sketch; - this.colors; - this.backgrounds; - this.terminalWidth = process.stdout.columns; - this.setSize(0,0); - this.set_matrices(); +var markers = require( '@stdlib/plot/unicode/static_plots/marker/markers.js' ); +var ansiColors = require( '@stdlib/plot/unicode/static_plots/marker/colors.js' ); + + +// VARIABLES // + +var defaults = { + 'backgroundColor': 'Bwh', + 'forwardColor': 'Frd', + 'marker': 'sp' +}; + + +// MAIN // + +/** +* Pallete constructor. +* +* @constructor +* @param {PlotBase} PlotBase - PlotBase instance +* @throws {TypeError} must provide valid options +* @returns {Pallete} Pallete instance +* +* @example +* var pallete = new Pallete(); +*/ +function Pallete( PlotBase ) { + defineProperty( this, '_sketch', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + defineProperty( this, '_colors', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + defineProperty( this, '_backgrounds', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + defineProperty( this, '_plotBase', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': PlotBase + }); + + return this; } /** - * set size - * set backColor - * set fontColor - * set marker - * - * + * Weather row and col is legal or not. + * + * @name isLegal + * @memberof Primitive.prototype + * @type {Function} + * @param {number} row + * @param {number} col + * @returns {void} + * + */ +setNonEnumerableReadOnly( Pallete.prototype, 'isLegal', function isLegal( row, col ) { + return row < this._sketch.length && col < this._sketch[0].length && row >= 0 && col >=0; +} ); + +/** + * Set the ansi character on specific row and column. + * + * @name setSketch + * @memberof Primitive.prototype + * @type {Function} + * @param {number} row + * @param {number} col + * @param {number} mark + * @param {boolean} overwrite + * @returns {void} + * */ +setNonEnumerableReadOnly( Pallete.prototype, 'setSketch', function setSketch( row, col, mark, overwrite ) { + if ( this.isLegal( row, col ) && ( overwrite || ( this._sketch[ row ][ col ] === defaults[ 'marker' ] ) ) ) { + this._sketch[ row ][ col ] = mark; + } +} ); -setNonEnumerableReadOnly( Pallete.prototype, 'setSize', function setSize( row, col ) { - this.rows = row; - this.cols = col; -} ) +/** + * Add horizontel String on matrix. + * + * @name addHorizontelString + * @memberof Primitive.prototype + * @type {Function} + * @param {number} row + * @param {number} col + * @param {string} str + * @param {string} color + * @param {boolean} overwrite + * @returns {void} + * + */ +setNonEnumerableReadOnly( Pallete.prototype, 'addHorizontelString', function addHorizontelString( row, col, str, color, overwrite ) { + var ch; + var c; -setNonEnumerableReadOnly( Pallete.prototype, 'setSpawnPosition', function setPosition( top, left ) { - this.top = top; - this.left = left; -} ) + c = col; + for ( ch of str ) { + this.setElement( row, c, ch, color, overwrite || false ); + c += 1; + } +} ); -setNonEnumerableReadOnly( Pallete.prototype, 'isLegal', function isLegal( row, col ) { - return row < this.sketch.length && col < this.sketch[0].length && row >= 0 && col >=0; -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'setSketch', function setSketch( row, col, mark ) { - if (this.isLegal( row, col)) { - this.sketch[row][col] = mark; - } -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'addHorizontelString', function addHorizontelString( row, col, mark) { - var c = col; - for(ch of mark) { - this.setColor( row , c , 'Fbl' ); - this.addElement(row , c, ch ); - c++; - } -} ) -setNonEnumerableReadOnly( Pallete.prototype, 'setColor', function setColor(row, col, color) { - if (this.isLegal( row, col)) { - this.colors[row][col] = color; - } -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'addVerticalString', function addHorizontelString() { - -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'addElement', function addElement( row, col, marker = 'block' ) { - this.setSketch( row, col, marker ); - // console.log(this.setcanvas()) - // console.log(this.counter++); -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'creatCanva', function creatCanva() { - -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'drawFrame', function drawFrame() { - var i; - - for ( i = 0 ; i < this.rows; i++ ){ - this.addElement( i , 0 , 'vertical'); - this.addElement( i , this.cols-1 , 'vertical'); - this.setColor( i, 0, 'Fbl') - this.setColor( i, this.cols-1, 'Fbl') - } - - for ( i = 0 ; i < this.cols; i++ ){ - this.addElement( 0 , i , 'horizontal'); - this.addElement( this.rows-1 , i , 'horizontal'); - this.setColor( 0, i, 'Fbl') - this.setColor( this.rows-1, i, 'Fbl') - } - - // corners - - this.addElement( 0 , 0 , 'LBcorner') - this.addElement( 0 , this.cols-1 , 'RBcorner') - this.addElement( this.rows-1 , 0 , 'LTcorner') - this.addElement( this.rows-1 , this.cols-1 , 'RTcorner') -} ) +/** + * Set color on the color matrix on specific row and col. + * + * @name setColor + * @memberof Primitive.prototype + * @type {Function} + * @param {number} row + * @param {number} col + * @param {string} color + * @param {boolean} overwrite + * @returns {void} + * + */ +setNonEnumerableReadOnly( Pallete.prototype, 'setColor', function setColor(row, col, color, overwrite ) { + if ( this.isLegal( row, col ) && ( overwrite || ( this._colors[ row ][ col ] === defaults[ 'forwardColor' ] ) ) ) { + this._colors[ row ][ col ] = color; + } +}); +/** + * Set ansi element and color in matrix. + * + * @name setElement + * @memberof Primitive.prototype + * @type {Function} + * @param {number} row + * @param {number} col + * @param {string} marker + * @param {string} color + * @param {boolean} overwrite + * @returns {void} + * + */ +setNonEnumerableReadOnly( Pallete.prototype, 'setElement', function setElement( row, col, marker, color, overwrite ) { + if ( marker ) { + this.setSketch( row, col, marker, overwrite ); + } + if ( color) { + this.setColor( row, col, color, overwrite ); + } +} ); + +/** + * Final render the code name by convert them to ansiCode. + * + * @name setcanvas + * @memberof Primitive.prototype + * @type {Function} + * @returns {void} + * + */ setNonEnumerableReadOnly( Pallete.prototype, 'setcanvas', function setcanvas() { - var canva = ''; - var color ; - var background; - var remainwidth = this.terminalWidth - this.left; - var i; - var j; - // console.log(this.sketch) - // console.log(this.colors) - // console.log(this.backgrounds) - - // canva += '\x1b[47m\x1b[94m'; - if ( this.top > 0 ) { - canva += `\x1b[${this.top}B` - } - for( i = this.sketch.length - 1 ; i >= 0; i-- ) { - canva += '\r'; - if ( this.left > 0 ) { - canva += `\x1b[${this.left}C`; - } - for ( j = 0; j < this.sketch[0].length && j < remainwidth; j++ ) { - if ( !this.isLegal( i , j - 1 ) || this.backgrounds[i][j] != this.backgrounds[i][j-1] ) { - background = dfs[this.backgrounds[i][j]]; - if( background == undefined){ - console.log("bck") - } - canva += background; - } - if ( !this.isLegal( i , j - 1 ) || this.colors[i][j] != this.colors[i][j-1] ) { - color = dfs[this.colors[i][j]]; - // if( color == undefined){ - // console.log("bck") - // } - canva += color; - } - canva += dfs[this.sketch[i][j]]; - } - canva += dfs['def'] - canva += '\n'; - } - this.canva = canva ; - return this.canva; -} ) - -setNonEnumerableReadOnly( Pallete.prototype, 'set_matrices', function set_matrices() { - this.sketch = Array.from({length: this.rows}, ()=> Array(this.cols).fill('sp') ); - this.colors = Array.from({length: this.rows}, ()=> Array(this.cols).fill('Frd') ); - this.backgrounds = Array.from({length: this.rows}, ()=> Array(this.cols).fill('Bbu') ); -} ) - -module.exports = Pallete; \ No newline at end of file + var remainwidth = process.stdout.columns - 0; + var background; + var canva = ''; + var color; + var i; + var j; + + for ( i = this._sketch.length - 1; i >= 0; i-- ) { + canva += '\r'; + for ( j = 0; j < this._sketch[ 0 ].length && j < remainwidth; j++ ) { + // If background color is not same as previous then only we need to change it + if ( !this.isLegal( i, j - 1 ) || this._backgrounds[ i ][ j ] !== this._backgrounds[ i ][ j - 1 ] ) { + background = ansiColors[ this._backgrounds[ i ][ j ] ]; + canva += background; + } + // If forward color is not same as previous then only we need to change it + if ( !this.isLegal( i, j - 1 ) || this._colors[ i ][ j ] !== this._colors[ i ][ j - 1 ] ) { + color = ansiColors[ this._colors[ i ][ j ] ]; + canva += color; + } + canva += markers[ this._sketch[ i ][ j ] ]; + } + canva += ansiColors[ 'def' ]; + canva += '\n'; + } + this.canva = canva; + return canva; +} ); + +/** + * Initilize the matrices according to the row and column size. + * + * @name set_matrices + * @memberof Primitive.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly( Pallete.prototype, 'setMatrices', function setMatrices() { + var temp1; + var temp2; + var temp3; + var i; + var j; + + for ( i = 0; i < this._plotBase._rows; i++ ) { + temp1 = []; + temp2 = []; + temp3 = []; + for ( j = 0; j < this._plotBase._cols; j++ ) { + temp1.push( defaults[ 'marker' ] ); + temp2.push( defaults[ 'forwardColor' ] ); + temp3.push( defaults[ 'backgroundColor' ] ); + } + this._sketch.push( temp1 ); + this._colors.push( temp2 ); + this._backgrounds.push( temp3 ); + } +} ); + +module.exports = Pallete; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js new file mode 100644 index 000000000000..b114342f9203 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js @@ -0,0 +1,456 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 max-len */ +/* eslint-disable no-invalid-this */ +/* eslint-disable no-restricted-syntax */ + +'use strict'; + +// MODULES // + +var defineProperty = require( '@stdlib/utils/define-property' ); +var minn = require( '@stdlib/math/base/special/minn' ); +var maxn = require( '@stdlib/math/base/special/maxn' ); +var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var mergeFcn = require( '@stdlib/utils/merge' ).factory; +var objectKeys = require( '@stdlib/utils/keys' ); +var min = require( '@stdlib/math/base/special/min' ); +var max = require( '@stdlib/math/base/special/max' ); +var setSize= require( './props/setSize/set.js' ); +var getSize = require( './props/setSize/get.js' ); +var setpadTop= require( './props/padTop/set.js' ); +var getpadTop = require( './props/padTop/get.js' ); +var setpadBottom= require( './props/padBottom/set.js' ); +var getpadBottom = require( './props/padBottom/get.js' ); +var setpadLeft = require( './props/padLeft/set.js' ); +var getpadLeft = require( './props/padLeft/get.js' ); +var setpadRight = require( './props/padRight/set.js' ); +var getpadRight = require( './props/padRight/get.js' ); +var Pallete = require( './pallete.js' ); +var defaults = require( './default.js' ); + + +// VARIABLES // + +// List of private properties (note: keep in alphabetical order): +var PRIVATE_PROPS = [ + '_cols', + '_padBottom', + '_padLeft', + '_padRight', + '_padTop', + '_rows', + '_setSize' +]; + + +// FUNCTIONS // + +var merge = mergeFcn({ + 'extend': false +}); + + +// MAIN // + +/** +* PlotBase constructor. +* +* @constructor +* @param {Options} options - constructor options +* @param {number} [Options.padBottom] - padding bottom +* @param {number} [Options.padLeft] - padding left +* @param {number} [Options.padRight] - padding right +* @param {number} [Options.padTop] - padding top +* @param {Object} [Options.setSize] - size object with character width and height +* @throws {TypeError} must provide valid options +* @returns {PlotBase} PlotBase instance +* +* @example +* var PlotBase = new PlotBase(); +*/ +function PlotBase( ) { + var options; + var nargs; + var keys; + var opts; + var key; + var i; + + defineProperty( this, '_x', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + + defineProperty( this, '_y', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + + defineProperty( this, '_marker', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + + defineProperty( this, '_color', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': [] + }); + + defineProperty( this, '_palt', { + 'configurable': false, + 'enumerable': false, + 'writable': false, + 'value': new Pallete(this) + }); + + for ( i = 0; i < PRIVATE_PROPS; i++ ) { + defineProperty( this, PRIVATE_PROPS[ i ], { + 'configurable': false, + 'enumerable': false, + 'writable': true, + 'value': null + }); + } + + nargs = arguments.length; + opts = defaults(); + if ( nargs ) { + options = arguments[ 0 ]; + } + else { + options = {}; + } + opts = merge( opts, options ); + keys = objectKeys( opts ); + for ( i = 0; i < keys.length; i++ ) { + key = keys[ i ]; + this[ key ] = opts[ key ]; + } + return this; +} + +/** + * Add all the ansi codes to the matrix. + * + * @name build + * @memberof PlotBase.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(PlotBase.prototype, 'build', function build() { + var finalC =[]; + var temp; + var i; + var j; + + for ( i = 0; i < this._x.length; i++ ) { + finalC.push( fillCord( this._x[ i ], this._y[ i ] ) ); + } + + for ( i = 0; i < finalC.length; i++ ) { + temp = finalC[ i ]; + for ( j = 0; j < temp.length; j++ ) { + this._palt.setElement( temp[ j ][ 0 ], temp[ j ][ 1 ], this._marker[ i ], this._color[ i ] ); + } + } +}); + +/** + * Display the rendered plots. + * + * @name show + * @memberof PlotBase.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(PlotBase.prototype, 'show', function show() { + var canva = this._palt.setcanvas(); + process.stdout.write( canva ); +}); + +/** + * Fill all the metrices representing the each structure of plot. + * + * @name draw + * @memberof PlotBase.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(PlotBase.prototype, 'draw', function draw( x, y, color, marker ) { + this._x.push( x ); + this._y.push( y ); + this._marker.push( marker || ' ' ); + this._color.push( color || 'wh' ); +}); + +/** + * Logic for rectangle structure. + * + * @name drawRectangle + * @memberof PlotBase.prototype + * @type {Function} + * @returns {void} + * + */ +setNonEnumerableReadOnly(PlotBase.prototype, 'drawRectangle', function drawRectangle( xb, yb, color, marker ) { + var xm = minn.apply( null, xb ); + var xM = maxn.apply( null, xb ); + var ym = minn.apply( null, yb ); + var yM = maxn.apply( null, yb ); + var x = [ xm, xm, xM, xM, xm ]; + var y = [ ym, yM, yM, ym, ym ]; + this.draw( x, y, color, marker ); +}); + +/** + * Add label and tics to the axis. + * + * @name addTic + * @memberof PlotBase.prototype + * @type {Function} + * @param {boolean} overwrite // weather overwrite is enable or not + * @param {string} color // color code for the tics + * @param {Array} x // tics and label for the bottom horizontel axis + * @param {Array} y // tics and label for the left vertical axis + * @param {Array} z // tics and label for the top horizontel axis + * @param {Array} w // tics and label for the right horizontel axis + * @param {boolean} overwrite + * @returns {void} + * + */ +setNonEnumerableReadOnly(PlotBase.prototype, 'addTic', function addTic( overwrite, color, x, y, z, w ) { + var i; + + if ( x && x.length > 0 ) { + for ( i = 0; i < x.length; i++ ) { + this._palt.setElement( this._padBottom - 1, x[ i ][ 1 ], 'HorTic', color, overwrite ); + this._palt.addHorizontelString( x[ i ][ 0 ], x[ i ][ 1 ], x[ i ][ 2 ].toString(), color, overwrite ); + } + } + if ( z && z.length > 0 ) { + for ( i = 0; i < z.length; i++ ) { + this._palt.setElement( this._padBottom - 1, z[ i ][ 1 ], 'HorTic', color, overwrite ); + this._palt.addHorizontelString( z[ i ][ 0 ], z[ i ][ 1 ], z[ i ][ 2 ].toString(), color, overwrite ); + } + } + if ( y && y.length > 0 ) { + for ( i = 0; i < y.length; i++ ) { + this._palt.setElement( y[ i ][ 0 ], this._padLeft - 1, 'VerTic', color, overwrite ); + this._palt.addHorizontelString( y[ i ][ 0 ], y[ i ][ 1 ], y[ i ][ 2 ].toString(), color, overwrite ); + } + } + if ( w && w.length > 0 ) { + for ( i = 0; i < w.length; i++ ) { + this._palt.setElement( w[ i ][ 0 ], this._padLeft - 1, 'VerTic', color, overwrite ); + this._palt.addHorizontelString( w[ i ][ 0 ], w[ i ][ 1 ], w[ i ][ 2 ].toString(), color, overwrite ); + } + } +}); + +/** + * Draw the frame. + * + * @name drawFrame + * @memberof PlotBase.prototype + * @type {Function} + * @param {boolean} overwrite // overwrite is enable or not + * @param {string} color // color code for the frame + * @returns {void} + * + */ +setNonEnumerableReadOnly( PlotBase.prototype, 'drawFrame', function drawFrame( overwrite, color ) { + var i; + + for ( i = this._padBottom-1; i < this._rows; i++ ) { + this._palt.setElement( i, this._padLeft - 1, 'vertical', color, overwrite ); + this._palt.setElement( i, this._cols-1, 'vertical', color, overwrite ); + } + + for ( i = this._padLeft-1; i < this._cols; i++ ) { + this._palt.setElement( this._padBottom - 1, i, 'horizontal', color, overwrite ); + this._palt.setElement( this._rows-1, i, 'horizontal', color, overwrite ); + } + + // Corners + + this._palt.setElement( this._padBottom - 1, this._padLeft - 1, 'LBcorner', color, true ); + this._palt.setElement( this._padBottom - 1, this._cols-1, 'RBcorner', color, true ); + this._palt.setElement( this._rows-1, this._padLeft - 1, 'LTcorner', color, true ); + this._palt.setElement( this._rows-1, this._cols-1, 'RTcorner', color, true ); +}); + +/** + * @name setSize + * @memberof PlotBase.prototype + * @type {Object} + * @throws {TypeError} + * + */ +defineProperty( PlotBase.prototype, 'setSize', { + 'configurable': false, + 'enumerable': true, + 'set': setSize, + 'get': getSize +}); + +/** + * @name padBottom + * @memberof PlotBase.prototype + * @type {number} + * @throws {TypeError} + * + */ +defineProperty( PlotBase.prototype, 'padBottom', { + 'configurable': false, + 'enumerable': true, + 'set': setpadBottom, + 'get': getpadBottom +}); + +/** + * @name padTop + * @memberof PlotBase.prototype + * @type {number} + * @throws {TypeError} + * + */ +defineProperty( PlotBase.prototype, 'padTop', { + 'configurable': false, + 'enumerable': true, + 'set': setpadTop, + 'get': getpadTop +}); + +/** + * @name padLeft + * @memberof PlotBase.prototype + * @type {number} + * @throws {TypeError} + * + */ +defineProperty( PlotBase.prototype, 'padLeft', { + 'configurable': false, + 'enumerable': true, + 'set': setpadLeft, + 'get': getpadLeft +}); + +/** + * @name padRight + * @memberof PlotBase.prototype + * @type {number} + * @throws {TypeError} + * + */ +defineProperty( PlotBase.prototype, 'padRight', { + 'configurable': false, + 'enumerable': true, + 'set': setpadRight, + 'get': getpadRight +}); + +/** +* Provide the cordinate under the closed structure to fill them. +* @private +* @name fillCord +* @type {Function} +* @param {Array} sx - vertices x cordinate of structure +* @param {Array} sy - vertices y cordinate of structure +* @returns {Array} cordinate of filled structure +* */ +function fillCord( sx, sy ) { + var lcord; + var temp; + var L1; + var L2; + var i; + + lcord = []; + L1 = []; + L2 = []; + + // If not closed structure fill is not possible + if ( sx[ 0 ] !== sx[ sy.length - 1 ] || sx.length < 3 ) { + return; + } + + L1 = fillLine( [ sx[ 0 ], sx[ 1 ] ], [ sy[ 0 ], sy[ 1 ] ] ); + L2 = fillLine( [sx[ 2 ], sx[ 3 ] ], [ sy[ 2 ], sy[ 3 ] ] ); + + for ( i = 0; i < L1.length; i++ ) { + temp = fillLine( [ L1[ i ][ 0 ], L2[ i ][ 0 ] ], [ L1[ i ][ 1 ], L2[ i ][ 1 ] ] ); + lcord = lcord.concat(temp); + } + return lcord; +} + +/** +* Provide the coordinates between 2 points for line. +* +* @private +* +* @name fillLine +* @type {Function} +* @param {Array} sx - x coordinates of points of line +* @param {Array} sy - y coordinates of points of line +* @returns {Array} Array of all coordinates of line +* */ +function fillLine( sx, sy ) { + var lcord =[]; + var mx; + var Mx; + var my; + var My; + var i; + + if ( sx.length < 2 ) { + return; + } + + mx = min( sx[ 0 ], sx[ 1 ] ); + Mx = max( sx[ 0 ], sx[ 1 ] ); + my = min( sy[ 0 ], sy[ 1 ] ); + My = max( sy[ 0 ], sy[ 1 ] ); + if ( Mx-mx === 0 ) { + for ( i = my; i <= My; i++ ) { + lcord.push( [ mx, i ] ); + } + return lcord; + } + if ( My-my === 0 ) { + for ( i = mx; i <= Mx; i++ ) { + lcord.push( [ i, my ] ); + } + return lcord; + } + return lcord; +} +module.exports= PlotBase; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js deleted file mode 100644 index 5785b4cc6d34..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/primitive.js +++ /dev/null @@ -1,320 +0,0 @@ -var defineProperty = require('@stdlib/utils/define-property'); -var setNonEnumerable = require('@stdlib/utils/define-nonenumerable-property'); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHpos = require( './props/hpos/set.js' ); -var getHpos = require( './props/hpos/get.js' ); -var setVpos = require( './props/vpos/set.js' ); -var getVpos = require( './props/vpos/get.js' ); -var setIsFill = require( './props/isfill/set.js' ); -var getIsFill = require( './props/isfill/get.js' ); -var setIsLine = require( './props/isline/set.js' ); -var getIsLine = require( './props/isline/get.js' ); -var setNonEnumerableReadOnly = require('@stdlib/utils/define-nonenumerable-read-only-property'); -var dfs = require('@stdlib/plot/unicode/static_plots/base/lib/markers.js'); -var Pallete = require('./pallete'); -var ut = require('./utilies'); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var objectKeys = require( '@stdlib/utils/keys' ); -var defaults = require('./default.js') - -// VARIABLES // - -var merge = mergeFcn({ - 'extend': false -}); - -// List of private properties (note: keep in alphabetical order): -var PRIVATE_PROPS = [ - '_heightscale', - '_widthscale', - '_hpos', - '_vpos', - '_isFill', - '_isLine', - '_row', - '_col', - '_xlim', - '_ylim', - '_padTop', - '_padBottom', - '_padLeft', - '_padRight', - '_x', - '_y', - '_rows', - '_cols', - '_marker', - '_terminalHeight', - '_terminalWidth' -]; - -function Primitive() { - - for( i = 0; i < PRIVATE_PROPS; i++ ) { - defineProperty( this, PRIVATE_PROPS[ i ], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - } ) - } - - this._x = []; - this._y = []; - this._marker = []; - this._color = []; - this._palt = new Pallete(); - this._signals = 0; - this._xlim = [0, 0]; - this._ylim = [0, 0]; - this._cols = 0; - this._rows = 0; - var keys; - var key; - var i; - - // by defailt 1 padding for frame - this._padTop = 1; - this._padBottom = 2; - this._padLeft = 3; - this._padRight = 1; - - // this is positions decide the spawn positions for the - // horizontle position - this._hpscale = 1; - // vertical position - this._vpscale = 1; - - var options; - var nargs; - var opts; - - nargs = arguments.length; - opts = defaults(); - if ( nargs ) { - options = arguments[ 0 ]; - } - else { - options = {} - } - opts = merge( opts, options ); - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[i]; - this[ key ] = opts[ key ]; - } - return this; - - -} - -setNonEnumerableReadOnly(Primitive.prototype, 'setSize', function setSize( row , col) { - // this._terminalWidth = siz[1]; - // this._terminalHeight = siz[0]; - // this._palt.terminalHeight = siz[0]; - // this._palt.terminalWidth = siz[1]; - - - - this._cols = col; - this._rows = row; - console.log(` ${this._rows} , ${this._cols}` ); - // this._palt.setSpawnPosition(Math.floor( this._terminalHeight * this._vpos ), Math.floor ( this._terminalWidth * this._hpos ) ); - this._palt.setSize(this._rows, this._cols); - this._palt.set_matrices(); -}); - -setNonEnumerableReadOnly(Primitive.prototype, 'build', function () { - var i; - var j; - var temp; - // this._xlim = ut.getLims(this._x); - // this._ylim = ut.getLims(this._y); - - var sx = []; - var sy = []; - - // this.drawFrame(); - - for (i = 0; i < this._x.length; i++) { - // sx.push(ut.scale_for_canva(this._x[i], this._rows - this._padTop - this._padBottom, this._xlim, this._padBottom)); - sx.push( this._x[i] ); - } - for (i = 0; i < this._y.length; i++) { - // sy.push(ut.scale_for_canva(this._y[i], this._cols - this._padLeft - this._padRight, this._ylim , this._padLeft)); - sy.push( this._y[i] ); - } - - var finalC =[]; - - - for ( i = 0 ; i < sx.length; i++ ) { - if ( this._isFill) { - finalC.push(ut.fillCord(sx[i], sy[i])); - } - - if ( this._isLine ) { - finalC.push(ut.fillLine(sx[i], sy[i])) - } - } - // for( i = 0; i < sx.length; i++ ) { - // temp = []; - // for( j = 0; j < sx[i].length-1; j++ ) { - // temp2 = ut.fillLine( [ sx[i][j], sx[i][j+1] ], [ sy[i][j], sy[i][j+1] ] ); - // temp.push( ...temp2 ); - // } - // finalC.push(temp); - // } - var temp; - for ( i = 0; i < finalC.length; i++ ){ - temp = finalC[i]; - for ( j = 0; j < temp.length; j++ ) { - this._palt.addElement( temp[j][0], temp[j][1] ) - } - } -}); - -setNonEnumerableReadOnly(Primitive.prototype, 'show', function () { - var canva = this._palt.setcanvas(); - // console.log(canva); - process.stdout.write(canva) -}); - -setNonEnumerableReadOnly(Primitive.prototype, 'draw', function (x, y, color, marker) { - this._x.push(x); - this._y.push(y); - this._marker.push(marker || ' '); - this._color.push(color || 'wh'); - this._signals += 1; -}); - -setNonEnumerableReadOnly(Primitive.prototype, 'draw_rectangle', function (xb, yb, color, marker) { - var xm = Math.min(...xb); - var xM = Math.max(...xb); - var ym = Math.min(...yb); - var yM = Math.max(...yb); - var x = [xm, xm, xM, xM, xm ]; - var y = [ym, yM, yM, ym, ym ]; - - this.draw(x, y, color, marker); -}); - -setNonEnumerableReadOnly(Primitive.prototype, 'addTic', function ( x, y, z, w ) { - var gap; - var curr; - var i; - - if (x && x.length > 0 ) { - for ( i = 0; i < x.length; i++ ) { - this._palt.addElement( this._padBottom - 1, x[i][1], 'HorTic' ); - this._palt.addHorizontelString( x[i][0], x[i][1], x[i][2].toString() ); - } - } - if ( z && z.length > 0 ) { - for ( i = 0; i < z.length; i++ ) { - this._palt.addElement( this._padBottom - 1, z[i][1], 'HorTic' ); - this._palt.addHorizontelString( z[i][0], z[i][1], z[i][2].toString() ); - } - } - if ( y && y.length > 0 ) { - for ( i = 0; i < y.length; i++ ) { - this._palt.addElement( y[i][0], this._padLeft - 1, 'VerTic' ); - this._palt.addHorizontelString( y[i][0], y[i][1], y[i][2].toString() ); - } - } - if ( w && w.length > 0 ) { - for ( i = 0; i < w.length; i++ ) { - this._palt.addElement( w[i][0], his._padLeft - 1, 'VerTic' ); - this._palt.addHorizontelString( w[i][0], w[i][1], w[i][2].toString() ); - } - // for ( i = this._padBottom ; i < w.length && i < this._rows; i++ ) { - // this._palt.addElement( i , this._rows - 1, 'VerTic'); - // // this._palt.setColor( i , this._rows - 1, 'Fbl'); - // this._palt.addHorizontelString( i , 0, w[i].toString() ); - // } - } -}); - - -setNonEnumerableReadOnly(Primitive.prototype, 'draw_bar', function (data, color = undefined, marker = undefined) { - this.setSize(); - var x = data[0]; - var y = data[1]; - var [ybar, xbar] = ut.scale_bar(x, y, this._cols - this._padLeft - this._padRight , x.length); - - for (let i = 0; i < xbar.length; i++) { - this.draw_rectangle(xbar[i], ybar[i], color, marker); - } -}); - -setNonEnumerableReadOnly( Primitive.prototype, 'drawFrame', function drawFrame() { - var i; - - for ( i = this._padBottom-1 ; i < this._rows; i++ ){ - this._palt.addElement( i , this._padLeft - 1 , 'vertical'); - this._palt.addElement( i , this._cols-1 , 'vertical'); - this._palt.setColor( i, this._padLeft - 1 , 'Fbl') - this._palt.setColor( i, this._cols-1, 'Fbl') - } - - for ( i = this._padLeft-1 ; i < this._cols; i++ ){ - this._palt.addElement( this._padBottom - 1 , i , 'horizontal'); - this._palt.addElement( this._rows-1 , i , 'horizontal'); - this._palt.setColor( this._padBottom - 1, i, 'Fbl') - this._palt.setColor( this._rows-1, i, 'Fbl') - } - - // corners - - this._palt.addElement( this._padBottom - 1 , this._padLeft - 1 , 'LBcorner') - this._palt.addElement( this._padBottom - 1 , this._cols-1 , 'RBcorner') - this._palt.addElement( this._rows-1 , this._padLeft - 1 , 'LTcorner') - this._palt.addElement( this._rows-1 , this._cols-1 , 'RTcorner') -} ) - -defineProperty( Primitive.prototype, 'heightscale', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -defineProperty( Primitive.prototype, 'widthscale', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -defineProperty( Primitive.prototype, 'hpos', { - 'configurable': false, - 'enumerable': true, - 'set': setHpos, - 'get': getHpos -}); - -defineProperty( Primitive.prototype, 'vpos', { - 'configurable': false, - 'enumerable': true, - 'set': setVpos, - 'get': getVpos -}); - -defineProperty( Primitive.prototype, 'isfill', { - 'configurable': false, - 'enumerable': true, - 'set': setIsFill, - 'get': getIsFill -}); - -defineProperty( Primitive.prototype, 'isline', { - 'configurable': false, - 'enumerable': true, - 'set': setIsLine, - 'get': getIsLine -}); - -module.exports= Primitive; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padBottom/get.js similarity index 81% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padBottom/get.js index 6542a732655a..864af090b1ff 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padBottom/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. @@ -19,17 +19,17 @@ 'use strict'; /** -* Returns the rendering mode. +* Returns the bottom pading. * * @private -* @returns {number} rendering mode +* @returns {number} // bottom padding */ function get() { /* eslint-disable no-invalid-this */ - return this._heightscale; + return this._padBottom; } // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padBottom/set.js similarity index 67% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padBottom/set.js index b06b30c6c405..d4b20f3591e7 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padBottom/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. @@ -20,41 +20,28 @@ // MODULES // -var logger = require( 'debug' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** -* Sets the rendering mode. +* Sets the bottom pad. * * @private -* @param {number} num - num indicate scale value of the height. +* @param {number} num - bottom padding. * @throws {TypeError} must be a number -* @throws {RangeError} must be in range of 0 to 1 */ function set( num ) { /* eslint-disable no-invalid-this */ if ( !isNumber( num ) ) { throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); } - if ( num <= 1 && num >=0 ) { - this._vpos = num; - } - else { - throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); - } - + this._padBottom = num; } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/get.js new file mode 100644 index 000000000000..ad27dc94e0bc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/get.js @@ -0,0 +1,35 @@ +/** +* @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'; + +/** +* Returns the left pading. +* +* @private +* @returns {number} // left padings +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._padLeft; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/set.js similarity index 67% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/set.js index f7e1156d26d9..e673d7d63829 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padLeft/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. @@ -20,41 +20,28 @@ // MODULES // -var logger = require( 'debug' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** -* Sets the rendering mode. +* Sets the left pading. * * @private -* @param {number} num - num indicate scale value of the height. +* @param {number} num - num character pading from left. * @throws {TypeError} must be a number -* @throws {RangeError} must be in range of 0 to 1 */ function set( num ) { /* eslint-disable no-invalid-this */ if ( !isNumber( num ) ) { throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); } - if ( num <= 1 && num >=0 ) { - this._widthscale = num; - } - else { - throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); - } - + this._padLeft = num; } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padRight/get.js similarity index 81% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padRight/get.js index 144cd38d41d2..d87c72013466 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/vertical/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padRight/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. @@ -19,17 +19,17 @@ 'use strict'; /** -* Returns the rendering mode. +* Returns the right pading. * * @private -* @returns {boolean} rendering mode +* @returns {number} // right padding */ function get() { /* eslint-disable no-invalid-this */ - return this._vertical; + return this._padRight; } // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padRight/set.js similarity index 67% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padRight/set.js index bc3e5bee6cc1..1d394c5f8149 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/height/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padRight/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. @@ -20,41 +20,28 @@ // MODULES // -var logger = require( 'debug' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var format = require( '@stdlib/string/format' ); -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - // MAIN // /** -* Sets the rendering mode. +* Sets the right pading. * * @private -* @param {number} num - num indicate scale value of the height. +* @param {number} num - num character pading from right. * @throws {TypeError} must be a number -* @throws {RangeError} must be in range of 0 to 1 */ function set( num ) { /* eslint-disable no-invalid-this */ if ( !isNumber( num ) ) { throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); } - if ( num <= 1 && num >=0 ) { - this._heightscale = num; - } - else { - throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); - } - + this._padRight = num; } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/get.js new file mode 100644 index 000000000000..90c66808ee4f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/get.js @@ -0,0 +1,35 @@ +/** +* @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'; + +/** +* Returns the top pading. +* +* @private +* @returns {number} // top padding +*/ +function get() { + /* eslint-disable no-invalid-this */ + return this._padTop; +} + + +// EXPORTS // + +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/set.js new file mode 100644 index 000000000000..225c63d708e0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/padTop/set.js @@ -0,0 +1,47 @@ +/** +* @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 isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var format = require( '@stdlib/string/format' ); + + +// MAIN // + +/** +* Sets the top pading. +* +* @private +* @param {number} num - number of character pading from top. +* @throws {TypeError} must be a number +*/ +function set( num ) { + /* eslint-disable no-invalid-this */ + if ( !isNumber( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); + } + this._padTop = num; +} + + +// EXPORTS // + +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js similarity index 90% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js index 61825174c3ba..0f7f3bbcf4f3 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/vpos/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js @@ -26,10 +26,13 @@ */ function get() { /* eslint-disable no-invalid-this */ - return this._vpos; + return { + 'rows': this._rows, + 'cols': this._cols + }; } // EXPORTS // -module.exports = get; \ No newline at end of file +module.exports = get; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js similarity index 70% rename from lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js rename to lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js index 49d6f6f25ce4..958a3029c393 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/hpos/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js @@ -20,14 +20,8 @@ // MODULES // -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); +var isObject = require( '@stdlib/assert/is-object' ); // MAIN // @@ -42,19 +36,15 @@ var debug = logger( 'sparkline:set:auto-render' ); */ function set( num ) { /* eslint-disable no-invalid-this */ - if ( !isNumber( num ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'autoRender', num ) ); + if ( !isObject( num ) ) { + throw new TypeError( format( 'invalid assignment. `%s` must be a object. Value: `%s`.', 'autoRender', num ) ); } - if ( num <= 1 && num >=0 ) { - this._hpos = num; - } - else { - throw new RangeError( format( 'invakud asssignment. `%s` must be in range of 0 to 1.' ) ); - } - + this._rows = num['rows']; + this._cols = num['cols']; + this._palt.setMatrices(); } // EXPORTS // -module.exports = set; \ No newline at end of file +module.exports = set; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js deleted file mode 100644 index 442d39beea1b..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {number} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._widthscale; -} - - -// EXPORTS // - -module.exports = get; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js deleted file mode 100644 index eabe049e9047..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/test.js +++ /dev/null @@ -1,35 +0,0 @@ -var Primitive = require('./primitive') - - -var options = { - heightscale : 0.7, - widthscale : 0.5, - hpos : 0.5, - vpos : 0.3 - -} -var options2 = { - heightscale : 0.7, - widthscale : 0.5, - // hpos : 0.5, - vpos : 0.3 - -} -var inst = new Primitive(options); -var inst2 = new Primitive(options2); -var data = [ - [ 1 , 2, 3, 4, 5, 6, 7 , 8, 9, 10, 11, 12, 13 - // ,11, 12, 13, 14, 15, 16 - ], - [ 10, 1, 5, 20, 25, 23, 35, 40, 10, 11, 12, 13, 15 - // , 10, 10, 10, 10, 10, 10 - ] -] -inst.draw_bar(data); -inst2.draw_bar(data); -inst.build(); -inst2.build(); -inst.show(); -inst2.show(); - -// process.stdout.write("this is my text") diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js deleted file mode 100644 index 93e7217ceff4..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utilies.js +++ /dev/null @@ -1,130 +0,0 @@ -var utilites = { - scale_bar: function (x, y, containerWidth, dataPoints ) { - var width = 0.5; - - // width_half = width_half * ( ( containerWidth / dataPoints ) * ( 10 / 101 ) ); - width = width * ( ( 10 / dataPoints ) * ( containerWidth / 101 ) ); - // 0.8 is the max width we can use because we also need to care about the spaces between bars - width = Math.min( width , 0.8 ) - - // var actualWidth = containerWidth / dataPoints ; - // width *= ( Math.floor(actualWidth) / actualWidth ); - - var bins = x.length; - - var width_half = width / 2; - var xbar = []; - var ybar = []; - - // if (bins > 1) { - // width_half *= ( ( (Math.max(...x) - Math.min(...x)) / (bins - 1) ) ) ; - // } - - for (let i = 0; i < bins; i++) { - xbar.push([x[i] - width_half, x[i] + width_half]); - ybar.push([0, y[i]]); - } - - return [xbar, ybar]; - }, - - scale_for_canva: function (elms, bins, lim, pad) { - var elm; - var arr=[]; - var i; - var sElm; - for ( i = 0; i < elms.length; i++ ) { - elm = elms[i]; - sElm = ( elm - lim[0] ) / ( lim[1] - lim[0] ); - arr.push( Math.round( pad + ( ( bins - 1 ) * sElm ) ) ) - // arr.push( ) - } - return arr; - }, - - - getLims: function (elms) { - var min = Infinity; - var max = -Infinity; - - elms.forEach(arr => { - min = Math.min(min, ...arr); - max = Math.max(max, ...arr); - }); - - return [min, max]; - }, - - fill: function (x, y) { - var filledcords = []; - for (let i = x[0]; i < x[1]; i++) { - for (let j = y[0]; j < y[1]; j++) { - filledcords.push([i, j]); - } - } - return filledcords; - }, - - getTermSize: function () { - return [process.stdout.rows, process.stdout.columns]; - }, - - fillCord : function ( sx, sy ) { - if ( sx[0] != sx[sy.length - 1] || sx.length < 3 ) { - return - } - var lcord =[]; - var L1 = []; - var L2 = []; - var temp; - var i; - var j; - var k; - - L1 = this.fillLine( [sx[0], sx[1]], [sy[0], sy[1]] ); - L2 = this.fillLine( [sx[2], sx[3]], [sy[2], sy[3]] ); - - for ( i = 0 ; i < L1.length; i++ ) { - temp = this.fillLine( [ L1[i][0], L2[i][0] ] , [ L1[i][1], L2[i][1] ] ); - lcord.push( ...temp ); - } - return lcord; - }, - - fillLine : function ( sx, sy ) { - if ( sx.length < 2 ) { - return; - } - var lcord =[]; - var slop; - var mx; - var Mx; - var my; - var My; - var i; - - mx = Math.min( sx[0], sx[1] ); - Mx = Math.max( sx[0], sx[1] ); - my = Math.min( sy[0], sy[1] ); - My = Math.max( sy[0], sy[1] ); - if ( Mx-mx == 0 ) { - for( i = my; i <= My; i++ ){ - lcord.push([ mx, i]); - } - return lcord; - } - if ( My-my== 0 ) { - for( i = mx; i <= Mx; i++ ) { - lcord.push( [ i, my] ); - } - return lcord; - } - slop = (My-my)/(Mx-mx); - for( i = mx; i <= Mx; i++ ) { - lcord.push([ i, Math.floor( i * slop )]); - } - return lcord; - } -}; - -module.exports = utilites; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js deleted file mode 100644 index 2f9f72de2b1a..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/fill.js +++ /dev/null @@ -1,11 +0,0 @@ -function fill (x, y) { - var filledcords = []; - for (let i = x[0]; i < x[1]; i++) { - for (let j = y[0]; j < y[1]; j++) { - filledcords.push([i, j]); - } - } - return filledcords; -} - -module.exports = fill; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js deleted file mode 100644 index 682579c33fc6..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/getTerminalSize.js +++ /dev/null @@ -1,3 +0,0 @@ -function getTermSize() { - return [process.stdout.rows, process.stdout.columns]; -} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js deleted file mode 100644 index 0e0a829ce154..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/line.js +++ /dev/null @@ -1,34 +0,0 @@ -function line ( sx, sy ) { - if ( sx.length < 2 ) { - return; - } - var lcord =[]; - var slop; - var mx; - var Mx; - var my; - var My; - var i; - - mx = Math.min( sx[0], sx[1] ); - Mx = Math.max( sx[0], sx[1] ); - my = Math.min( sy[0], sy[1] ); - My = Math.max( sy[0], sy[1] ); - if ( Mx-mx == 0 ) { - for( i = my; i <= My; i++ ){ - lcord.push([ mx, i]); - } - return lcord; - } - if ( My-my== 0 ) { - for( i = mx; i <= Mx; i++ ) { - lcord.push( [ i, my] ); - } - return lcord; - } - slop = (My-my)/(Mx-mx); - for( i = mx; i <= Mx; i++ ) { - lcord.push([ i, Math.floor( i * slop )]); - } - return lcord; -} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js deleted file mode 100644 index 1cf819d1a85d..000000000000 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/utils/scale_for_canva.js +++ /dev/null @@ -1,12 +0,0 @@ -function scale_for_canva (elms, bins, lim, pad) { - var elm; - var arr=[]; - var i; - for ( i = 0; i < elms.length; i++ ) { - elm = elms[i]; - arr.push(Math.floor( pad + Math.round( (bins - 1) * ((elm - lim[0]) / (lim[1] - lim[0]))))) - } - return arr; -} - -module.exports = scale_for_canva; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js new file mode 100644 index 000000000000..a27119e11953 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 colors = { + 'Fwh': '\x1b[37m', + 'Fbl': '\x1b[30m', + 'Frd': '\x1b[31m', + 'Fbu': '\x1b[94m', + 'Bwh': '\x1b[47m', + 'Bbl': '\x1b[40m', + 'Bbu': '\x1b[104m', + 'Byl': '\x1b[43m', + 'def': '\x1b[0m' +}; + +module.exports = colors; diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js new file mode 100644 index 000000000000..2006c82ae9ba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 markers; +var temp; +var i; + +markers = { + 'sp': ' ', + 'null': '', + 'block': '█', + 'vertical': '│', + 'horizontal': '─', + 'LBcorner': '└', + 'RBcorner': '┘', + 'LTcorner': '┌', + 'RTcorner': '┐', + 'HorTic': '┬', + 'VerTic': '┤', + '[0,0,0,0]': ' ', + '[1,0,0,0]': '▘', + '[0,0,1,0]': '▖', + '[0,0,0,1]': '▗', + '[0,1,0,0]': '▝', + '[1,0,1,0]': '▌', + '[0,1,0,1]': '▐', + '[0,0,1,1]': '▄', + '[1,1,0,0]': '▀', + '[1,0,0,1]': '▚', + '[0,1,1,0]': '▞', + '[1,1,1,0]': '▛', + '[1,0,1,1]': '▙', + '[0,1,1,1]': '▟', + '[1,1,0,1]': '▜', + '[1,1,1,1]': '█' +}; + +for ( i = 0; i < 10; i++ ) { + temp = '' + i; + markers[temp] = temp; +} + +markers['.'] = '.'; + +module.exports = markers; From fbd5167185e8ed38343054cfa103ce33c914b64e Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 25 Feb 2025 17:22:04 +0000 Subject: [PATCH 3/4] refactor: remove unnessary folder --- 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: na - 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/plot/mine/bar/test.js | 11 -------- .../@stdlib/plot/mine/bar/test2.js | 25 ------------------- 2 files changed, 36 deletions(-) delete mode 100644 lib/node_modules/@stdlib/plot/mine/bar/test.js delete mode 100644 lib/node_modules/@stdlib/plot/mine/bar/test2.js diff --git a/lib/node_modules/@stdlib/plot/mine/bar/test.js b/lib/node_modules/@stdlib/plot/mine/bar/test.js deleted file mode 100644 index bd93dc17d757..000000000000 --- a/lib/node_modules/@stdlib/plot/mine/bar/test.js +++ /dev/null @@ -1,11 +0,0 @@ -// var palt = require('./pallete') - - -// var ins = new palt() - -// ins.setSize(5 , 5) - -// ins.set_matrices( ) - -// console.log(ins.setcanvas()) -console.log("\x1b[47m\x1b[94mThis text has a white background and light blue foreground\x1b[0m"); diff --git a/lib/node_modules/@stdlib/plot/mine/bar/test2.js b/lib/node_modules/@stdlib/plot/mine/bar/test2.js deleted file mode 100644 index 8e39390a5936..000000000000 --- a/lib/node_modules/@stdlib/plot/mine/bar/test2.js +++ /dev/null @@ -1,25 +0,0 @@ -var mon = require('@stdlib/plot/mine/bar/monitor'); -var palt = require('@stdlib/plot/mine/bar/pallete') - - - -var inst = new mon(); - -var data = [ - [ 1 , 2, 3, 4, 5, 6, 7 , 8, 9, 10, 11, 12, 13 - // ,11, 12, 13, 14, 15, 16 - ], - [ 10, 1, 5, 20, 25, 23, 35, 40, 10, 11, 12, 13, 15 - // , 10, 10, 10, 10, 10, 10 - ] -] -inst.draw_bar( data ); -inst.build(); -inst.show(); - -// var ins = new palt() -// ins.setSize( 5 , 5 ); -// ins.set_matrices(); - -// ins.addElement( 2, 4 ) -// console.log(ins.setcanvas()) \ No newline at end of file From e903ccf709a37fdcd41d2048af83ef41e6b529dc Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:05:02 +0000 Subject: [PATCH 4/4] chore: update copyright years --- .../@stdlib/plot/unicode/static_plots/bar/default.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/example/index.js | 2 +- lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js | 2 +- lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/cols/get.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/cols/set.js | 2 +- .../plot/unicode/static_plots/bar/props/labelColor/get.js | 2 +- .../plot/unicode/static_plots/bar/props/labelColor/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/marker/get.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/marker/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/rows/get.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/rows/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js | 2 +- .../@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/base/lib/default.js | 2 +- .../@stdlib/plot/unicode/static_plots/base/lib/index.js | 2 +- .../@stdlib/plot/unicode/static_plots/base/lib/pallete.js | 2 +- .../@stdlib/plot/unicode/static_plots/base/lib/plotbase.js | 2 +- .../plot/unicode/static_plots/base/lib/props/setSize/get.js | 2 +- .../plot/unicode/static_plots/base/lib/props/setSize/set.js | 2 +- .../@stdlib/plot/unicode/static_plots/marker/colors.js | 2 +- .../@stdlib/plot/unicode/static_plots/marker/markers.js | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js index 77984729fcad..9bfaabef3d98 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/default.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js index fa15746e817a..e3fed3fcd096 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/example/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js index f9ab413a4e36..0c9b1241daa2 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js index 71c5eb947a56..70dd49845563 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/main.js @@ -2,7 +2,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js index 4a1fc2694848..8d56889be0f2 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js index 47d6b13446a1..24b71ce7ef24 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/barColor/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js index a9b2212b063a..b5f96079a601 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js index c210b614208c..5c922543aa35 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/cols/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js index ed0c46ed7f78..ae05599b8659 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js index 8c28597e2f9f..14f8bc0906a6 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/labelColor/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js index a9b2212b063a..b5f96079a601 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js index 2d1e70760b41..1ec4295956cf 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/marker/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js index abe1e41beed7..40baa01c6474 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js index 6dfb4c411c0b..00efb5b5f697 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/rows/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js index 4bcc8ea568f0..7f66915fb99a 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js index 51753b8d1f0d..836361da4c75 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/xaxis/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js index bc47a4e150d3..8d7798e69fe7 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js index f019328c2b6d..2a5ab7263487 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/bar/props/yaxis/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js index ef46804748c3..7d42f457756d 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/default.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js index 7bb193f45018..f41cf103961c 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js index 183c66d5c070..9106fcb2261e 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/pallete.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js index b114342f9203..5dd7d8b06541 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/plotbase.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js index 0f7f3bbcf4f3..f0b8f237fad2 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/get.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js index 958a3029c393..e9ff5f88dc7f 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/base/lib/props/setSize/set.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js index a27119e11953..e849623febf1 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/colors.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js index 2006c82ae9ba..6bf4954f4986 100644 --- a/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js +++ b/lib/node_modules/@stdlib/plot/unicode/static_plots/marker/markers.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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.