From b1c425d8fe02024410523b09004f7659b07642d2 Mon Sep 17 00:00:00 2001 From: Sachinn-64 Date: Wed, 28 Oct 2026 21:53:10 +0530 Subject: [PATCH 1/7] feat: add docs to plot/charts/line/ctor --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/plot/charts/line/ctor/README.md | 117 ++++++++++++++++ .../charts/line/ctor/benchmark/benchmark.js | 49 +++++++ .../plot/charts/line/ctor/docs/repl.txt | 29 ++++ .../charts/line/ctor/docs/types/index.d.ts | 126 ++++++++++++++++++ .../plot/charts/line/ctor/docs/types/test.ts | 66 +++++++++ .../plot/charts/line/ctor/test/test.js | 41 ++++++ 6 files changed, 428 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/charts/line/ctor/README.md create mode 100644 lib/node_modules/@stdlib/plot/charts/line/ctor/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md b/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md new file mode 100644 index 000000000000..043cce967f7f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md @@ -0,0 +1,117 @@ + + +# LineChart + +> Line chart constructor. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var LineChart = require( '@stdlib/plot/charts/line/ctor' ); +``` + +#### LineChart( \[x, y,] \[options] ) + +Returns a line chart instance. + +```javascript +var chart = new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ] ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var uniform = require( '@stdlib/random/uniform' ); +var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +var LineChart = require( '@stdlib/plot/charts/line/ctor' ); + +var a = new Float64Vector( [ 10.0, 20.0, 30.0, 40.0, 50.0 ] ); +var b = new Float64Vector( [ 20.0, 30.0, 40.0, 50.0, 60.0 ] ); + +var y = uniform( [ 100, 5 ], a, b ); + +var chart = new LineChart( y, { + 'lineStyle': [ '-', '-.' ], + 'lineOpacity': [ 1.0, 0.4 ], + 'lineWidth': [ 3, 1 ], + 'legend': true +}); +console.log( chart.toJSON() ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/benchmark/benchmark.js b/lib/node_modules/@stdlib/plot/charts/line/ctor/benchmark/benchmark.js new file mode 100644 index 000000000000..1eb276dcf99a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/benchmark/benchmark.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var LineChart = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::instantiation', pkg ), function benchmark( b ) { + var v; + var i; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = new LineChart(); + if ( !( v instanceof LineChart ) ) { + b.fail( 'should return an instance' ); + } + } + b.toc(); + if ( !( v instanceof LineChart ) ) { + b.fail( 'should return an instance' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +// TODO: add benchmarks diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt new file mode 100644 index 000000000000..8a41b405fe70 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt @@ -0,0 +1,29 @@ + +{{alias}}( [x, y,] [options] ) + Returns a line chart instance. + + Parameters + ---------- + x: ArrayLike|ndarray (optional) + An array-like object or ndarray containing x-coordinate values. + + y: ArrayLike|ndarray|Array (optional) + An array-like object, an ndarray, or an array of such values + containing y-coordinate values. + + options: Object (optional) + Options. + + Returns + ------- + chart: LineChart + Line chart instance. + + Examples + -------- + > var chart = new {{alias}}( [ 1, 2, 3 ], [ 4, 5, 6 ] ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts new file mode 100644 index 000000000000..e2d78693dc06 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts @@ -0,0 +1,126 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Collection } from '@stdlib/types/array'; +import { ndarray } from '@stdlib/types/ndarray'; + +/** +* Chart data (either an array-like object or an ndarray). +*/ +type Data = Collection | ndarray; + +/** +* Interface describing constructor options. +*/ +interface Options { + /** + * Line colors. + */ + colors?: string | Array; + + /** + * Boolean indicating whether to display a chart legend. + */ + legend?: boolean; + + /** + * Line opacity. + */ + lineOpacity?: number | Array; + + /** + * Line style(s). + */ + lineStyle?: string | Array; + + /** + * Line symbol(s). + */ + lineSymbol?: string | Array; + + /** + * Line width(s) in pixels. + */ + lineWidth?: number | Array; +} + +/** +* Line chart. +*/ +declare class LineChart { + /** + * Line chart constructor. + * + * @param options - constructor options + * @returns line chart instance + * + * @example + * var chart = new LineChart(); + * // returns + */ + constructor( options?: Options ); + + /** + * Line chart constructor. + * + * @param y - y-values + * @param options - constructor options + * @returns line chart instance + * + * @example + * var chart = new LineChart( [ 4, 5, 6 ] ); + * // returns + */ + constructor( y: Data | Array, options?: Options ); + + /** + * Line chart constructor. + * + * @param x - x-values + * @param y - y-values + * @param options - constructor options + * @returns line chart instance + * + * @example + * var chart = new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ] ); + * // returns + */ + constructor( x: Data | Array, y: Data | Array, options?: Options ); + + /** + * Serializes a chart to a JSON object. + * + * @returns JSON object + * + * @example + * var chart = new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ] ); + * + * var v = chart.toJSON(); + * // returns {...} + */ + toJSON(): Record; +} + + +// EXPORTS // + +export = LineChart; diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/test.ts b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/test.ts new file mode 100644 index 000000000000..a4c7eefc23a1 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/test.ts @@ -0,0 +1,66 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable @typescript-eslint/no-unused-expressions */ + +import LineChart = require( './index' ); + + +// TESTS // + +// The constructor returns a line chart instance... +{ + new LineChart(); // $ExpectType LineChart + new LineChart( [ 4, 5, 6 ] ); // $ExpectType LineChart + new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ] ); // $ExpectType LineChart + new LineChart( {} ); // $ExpectType LineChart + new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ], {} ); // $ExpectType LineChart +} + +// The compiler throws an error if the constructor is provided an invalid first argument... +{ + new LineChart( 5 ); // $ExpectError + new LineChart( true ); // $ExpectError + new LineChart( null ); // $ExpectError +} + +// The compiler throws an error if the constructor is provided an invalid options argument... +{ + new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ], 5 ); // $ExpectError + new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ], 'abc' ); // $ExpectError + new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ], null ); // $ExpectError +} + +// The compiler throws an error if the constructor is provided an unsupported number of arguments... +{ + new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ], {}, {} ); // $ExpectError +} + +// The `toJSON` method returns a JSON object... +{ + const chart = new LineChart( [ 1, 2, 3 ], [ 4, 5, 6 ] ); + + chart.toJSON(); // $ExpectType Record +} + +// The compiler throws an error if the `toJSON` method is provided any arguments... +{ + const chart = new LineChart(); + + chart.toJSON( {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js b/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js new file mode 100644 index 000000000000..da25ad9e536e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var LineChart = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof LineChart, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the export is a class constructor', function test( t ) { + var chart = new LineChart(); + t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); + t.end(); +}); + +// TODO: add tests From 2c7fc77274f35fc0253355f26fa91e9ebe6a2b17 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 29 Oct 2026 02:44:16 +0100 Subject: [PATCH 2/7] docs: update description Signed-off-by: Athan --- .../@stdlib/plot/charts/line/ctor/docs/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts index e2d78693dc06..45d28b5c85d8 100644 --- a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/types/index.d.ts @@ -24,7 +24,7 @@ import { Collection } from '@stdlib/types/array'; import { ndarray } from '@stdlib/types/ndarray'; /** -* Chart data (either an array-like object or an ndarray). +* Chart data. */ type Data = Collection | ndarray; From cd79cdf8b7ddfc19bf08359c5d0212638c881ce6 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 29 Oct 2026 02:50:39 +0100 Subject: [PATCH 3/7] Apply batched suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt index 8a41b405fe70..85746fcf4aa4 100644 --- a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt @@ -1,11 +1,12 @@ -{{alias}}( [x, y,] [options] ) +{{alias}}( [x[, y],] [options] ) Returns a line chart instance. Parameters ---------- x: ArrayLike|ndarray (optional) - An array-like object or ndarray containing x-coordinate values. + An array-like object, an ndarray, or an array of such values + containing x-coordinate values. y: ArrayLike|ndarray|Array (optional) An array-like object, an ndarray, or an array of such values From fb14f91f7221dc84e7ad7742643475e71e7c4e9f Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 29 Oct 2026 02:51:12 +0100 Subject: [PATCH 4/7] docs: update type Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt index 85746fcf4aa4..139fe9c6b666 100644 --- a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt @@ -4,7 +4,7 @@ Parameters ---------- - x: ArrayLike|ndarray (optional) + x: ArrayLike|ndarray|Array (optional) An array-like object, an ndarray, or an array of such values containing x-coordinate values. From a79740dcc1a77ee2394712ccd33c632330b3e6e0 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 29 Oct 2026 02:53:59 +0100 Subject: [PATCH 5/7] docs: update description Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt index 139fe9c6b666..eb56b1ea8d42 100644 --- a/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/docs/repl.txt @@ -5,8 +5,9 @@ Parameters ---------- x: ArrayLike|ndarray|Array (optional) - An array-like object, an ndarray, or an array of such values - containing x-coordinate values. + An array-like object, an ndarray, or an array of such values. If not + provided a `y` argument, this specifies y-coordinate values. If provided + a `y` argument, this specifies x-coordinate values. y: ArrayLike|ndarray|Array (optional) An array-like object, an ndarray, or an array of such values From 4e1c3958eccb406a7b151a26039e17dae93d7deb Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 29 Oct 2026 02:54:47 +0100 Subject: [PATCH 6/7] test: update assertion message Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js b/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js index da25ad9e536e..68dcd0602044 100644 --- a/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/test/test.js @@ -34,7 +34,7 @@ tape( 'main export is a function', function test( t ) { tape( 'the export is a class constructor', function test( t ) { var chart = new LineChart(); - t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); + t.strictEqual( chart instanceof LineChart, true, 'returns expected value' ); t.end(); }); From 89de942559e7fca8208f5ae53df89da289c7e7ef Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 29 Oct 2026 02:55:58 +0100 Subject: [PATCH 7/7] docs: fix heading Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/charts/line/ctor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md b/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md index 043cce967f7f..2e13e44bf555 100644 --- a/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md +++ b/lib/node_modules/@stdlib/plot/charts/line/ctor/README.md @@ -40,7 +40,7 @@ limitations under the License. var LineChart = require( '@stdlib/plot/charts/line/ctor' ); ``` -#### LineChart( \[x, y,] \[options] ) +#### LineChart( \[x\[, y],] \[options] ) Returns a line chart instance.