Skip to content

feat: add plot/unicode/base #6750

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

Vinit-Pandit
Copy link
Contributor

Progress #2010

Description

This pull request:

  • Added base implementation of Unicode plots.
  • The base plot provides the interface for other plots and handles fundamental tasks such as adding glyphs and colors.
  • It includes features like a safe area plot, which allows adding glyphs and colors without colliding with axes or labels. This feature is extremely helpful and reduces the need to manually recalculate the correct row and column positions.

Related Issues

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Yes

2025-04-20_16 01 32_screenshot
Four axis

2025-04-20_15 36 57_screenshot
Note: There is safeArea mode which allow us to add glyph and color without colliding with the axis and its labels area

2025-04-20_16 25 15_screenshot
Bar without safe area mode

2025-04-20_16 08 56_screenshot

Initialization event

There is one more event in this base plot which trigger in change of the plotAreaHeight or plotAreaWidth in short anything which require to change the Array size of the matrices( backgroundColorMatrix, glyphMatrix ... ) require to reInitialize

Example

var basePlot = require( './../lib' );
var str;
var opt = {
	'plotAreaHeight': 12,
	'plotAreaWidth': 102,
	'axisTicsLabels': [ [1, 10], [ 1, 2 ], [ 2, 66, 666, 666 ], [ 9666, 55, 5 ] ],
	'labelFormate': [ '%s', '%s', '%s', '%s' ],
	'zAxis': false,
	'wAxis': false,
	'backgroundColor': 'Bwhite',
	'foregroundColor': 'Fblack',
	'xTicsLabelSpace': 2,
	'yTicsLabelSpace': 1,
	'zTicsLabelSpace': 3,
	'wTicsLabelSpace': 4,
	'ticsLabelsBckColor': 'Byellow',
	'xAxisPos': 40,
	'yAxisPos': 5,
	'zAxisPos': 101,
	'xTicsSpacing': 9,
	'yTicsSpacing': 9,
	'zTicsSpacing': 9,
	'wTicsSpacing': 9,
	'wAxisPos': 11
};
var instance = basePlot( opt );
instance.initialize();
str = instance.render();
console.log( str );

Output:

2025-04-20_17 30 38_screenshot

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

---
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
---
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 20, 2025
@Vinit-Pandit
Copy link
Contributor Author

I am using normalize method from the #2407 unicode/table

@Vinit-Pandit
Copy link
Contributor Author

@kgryte , @Planeshifter

---
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
---
---
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: passed
  - 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
---
@Vinit-Pandit
Copy link
Contributor Author

will add the tests and benchmark after the feedback and green flag from the mentors .

---
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
---
---
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
---
return new PlotBase( arguments[ 0 ] );
}

defineProperty( this, '_axisDataObjs', {
Copy link
Contributor Author

@Vinit-Pandit Vinit-Pandit Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be good if i just add one file ( like private-variables-value ) which use the defaults.js and define all private variables and output the object which we are going to use ? , because here i am using the object which is the collection many props .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review A pull request which needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants