Skip to content

feat: add plot/table/unicode #2407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 38 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ec04cbd
feat: add `@stdlib/plot/table/unicode`
Snehil-Shah Jun 19, 2024
ee7dec3
Merge branch 'stdlib-js:develop' into table
Snehil-Shah Jul 20, 2024
8ab53e7
refactor: update table from code review
Snehil-Shah Jul 20, 2024
2c7c604
docs: update jsdoc
Snehil-Shah Jul 20, 2024
8d36829
docs: add events to README
Snehil-Shah Jul 27, 2024
f4502df
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into pr…
kgryte Feb 10, 2025
9ea8bad
refactor: update implementation and clean-up
kgryte Feb 11, 2025
2fe6d53
chore: update copyright years
stdlib-bot Feb 11, 2025
68986f4
chore: update copyright years
stdlib-bot Feb 11, 2025
4a4b5ec
refactor: implement a FIFO array and refactor `push` logic
kgryte Feb 13, 2025
2738a64
Merge branch 'table' of https://github.com/Snehil-Shah/stdlib into pr…
kgryte Feb 13, 2025
db9d55b
docs: update example
kgryte Feb 13, 2025
478b462
docs: add streaming example
kgryte Feb 13, 2025
d1b8126
docs: add complex number example
kgryte Feb 13, 2025
b11a2c9
feat: add support for getting and setting individual data elements
kgryte Feb 13, 2025
c045e40
docs: document methods
kgryte Feb 13, 2025
274f158
feat: add support for specifying a format string
kgryte Feb 13, 2025
3509f9d
docs: update example
kgryte Feb 13, 2025
7e1b3a0
style: disable lint rule
kgryte Feb 13, 2025
a130400
feat!: rename property/option and support separate header alignment
kgryte Feb 14, 2025
38bbb32
feat: add support for specifying fixed column width(s)
kgryte Feb 14, 2025
d2d519c
refactor: compute columns rather than number of graphemes due to term…
kgryte Feb 14, 2025
de57031
refactor: rename internal properties and add initial ANSI escape support
kgryte Feb 17, 2025
a2510d5
fix: add specialized logic for joining strings
kgryte Feb 17, 2025
2d0eb37
docs: update comment
kgryte Feb 17, 2025
2dc3f6f
refactor: move normalization of cell data to separate module
kgryte Feb 17, 2025
2c1654a
refactor: support ANSI escape sequences in table characters
kgryte Feb 17, 2025
e13e98e
docs: add example demonstrating value-dependent styling
kgryte Feb 17, 2025
dcdab1e
docs: add example demonstrating value-dependent styling
kgryte Feb 17, 2025
c06b4c4
Merge branch 'table' of https://github.com/Snehil-Shah/stdlib into pr…
kgryte Feb 17, 2025
558b87e
refactor: remove character length restriction
kgryte Feb 18, 2025
0b7b7ff
docs: add note
kgryte Feb 18, 2025
1138b9c
refactor: restrict corners and joints to one grapheme cluster
kgryte Feb 19, 2025
26caefa
fix: support grapheme clusters for joints, corners, and borders
kgryte Feb 19, 2025
cbbe6ec
docs: update example
kgryte Feb 19, 2025
ae6a4cd
refactor: add internal width "units" property
kgryte Feb 19, 2025
e378881
docs: add comments
kgryte Feb 19, 2025
03b8157
refactor: ensure normalization uses consistent units
kgryte Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,162 changes: 1,162 additions & 0 deletions lib/node_modules/@stdlib/plot/table/unicode/README.md

Large diffs are not rendered by default.

1,433 changes: 1,433 additions & 0 deletions lib/node_modules/@stdlib/plot/table/unicode/benchmark/benchmark.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/**
* @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 bench = require( '@stdlib/bench' );
var random = require( '@stdlib/random/array/discrete-uniform' );
var pow = require( '@stdlib/math/base/special/pow' );
var array = require( '@stdlib/ndarray/array' );
var pkg = require( './../package.json' ).name;
var UnicodeTable = require( './../lib' );


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {PositiveInteger} rows - number of rows
* @param {PositiveInteger} columns - number of columns
* @param {UnicodeTable} table - table instance
* @returns {Function} benchmark function
*/
function createBenchmark( rows, columns, table ) {
var data;

data = random( rows*columns, 0, 100, {
'dtype': 'float64'
});
table.data = array( data, {
'shape': [ rows, columns ]
});
table.headers = random( columns, 0, columns, {
'dtype': 'generic'
});
return benchmark;

/**
* Benchmark function.
*
* @private
* @param {Benchmark} b - benchmark instance
*/
function benchmark( b ) {
var str;
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
str = table.render();
if ( typeof str !== 'string' ) {
b.fail( 'should return a string' );
}
}
b.toc();
if ( typeof str !== 'string' ) {
b.fail( 'should return a string' );
}
b.pass( 'benchmark finished' );
b.end();
}
}


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var columns;
var table;
var rows;
var min;
var max;
var f;
var i;
var j;

min = 1; // 5^min
max = 3; // 5^max

for ( i = min; i <= max; i++ ) {
for ( j = min; j <= max; j++ ) {
rows = pow( 5, i );
columns = pow( 5, j );

table = new UnicodeTable();
table.bufferSize = rows;
f = createBenchmark( rows, columns, table );
bench( pkg+':render:rows='+rows+',columns='+columns, f );
}
}
}

main();
Loading
Loading