Giter Club home page Giter Club logo

ervy's Introduction

Hi there

My name is chunqiuyiyu. I'm a frontend developer and love JavaScript & React.

ervy's People

Contributors

bokub avatar chunqiuyiyu avatar imgbotapp avatar jcubic avatar robtarr avatar styfle avatar vocalfan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ervy's Issues

Plots Scatter plot outside of the output

Check the conversation in jcubic/jquery.terminal#553 copy of the thread in xtermjs/xterm.js#2656

the problem is that scatter plot is broken because your code assume that if you move cursor to next line with \x1b[?B it move max to next line. which is not correct on clear terminal. B ANSI escape code can't move past last line. It will stay at the last line no matter how big the argument is.

To reproduce the issue, open your demo with just scatter plot on clear terminal.

This is how it look like

ervy5

it's only by accident that the plot works when there is more lines. In my processing of ANSI escapes it works if I use:

                            case 'B': // Down
                                //cursor.y += value;
                                cursor.y = Math.min(cursor.y + value, result.length);
                                break;

but this is not how terminal should work because it break other code. The proper is cursor.y += value and the plot look like the image above.

Interactive demo

I've found a link in your project in one of my old text note and I've used your library as demo for jQuery Terminal (will link it in example page).

https://codepen.io/jcubic/pen/gObPBdP?editors=0010

chart

this can be way to document the project, examples are always great way to showcase the API. You can add command one for each plot/chart. And code for the terminal don't add much boilerplate.

(the welcome message can of course showcase your project and version)

If you don't have time and want this, and if you confirm that you will include the demo with link to my project (terminal.jcubic.pl and my name in credit section or other place) I can take a time to create demo of all your plots.

Scatter plot issue

Last plot, I have some issue:

ervy3

command scatter Foo:0,0;1,1;2,2;3,2;4,2;5,6;6,6:red

that generates this data:

[{"key":"Foo","value":[0,0],"style":"\u001b[31m@\u001b[0m"},{"key":"Foo","value":[1,1],"style":"\u001b[31m@\u001b[0m"},{"key":"Foo","value":[2,2],"style":"\u001b[31m@\u001b[0m"},{"key":"Foo","value":[3,2],"style":"\u001b[31m@\u001b[0m"},{"key":"Foo","value":[4,2],"style":"\u001b[31m@\u001b[0m"},{"key":"Foo","value":[5,6],"style":"\u001b[31m@\u001b[0m"},{"key":"Foo","value":[6,6],"style":"\u001b[31m@\u001b[0m"}]

Big difference between 1ch and 2ch size plots

I have testing code like this:

// same imports as in demo/index.js
var size = +process.argv[2];
(function(ervy) {
    var chars = ['#', '+', '*', '#', '@', '%'];
    var colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'];
    var commands = {
        scatter: function(...args) {
            var data = args.map((x, i) => {
                var [key, value, style] = x.split(':');
                if (style) {
                    if (style.length === 1) {
                        style = ervy.fg(colors[i], style);
                    } else {
                        style = ervy.bg(style, size);
                    }
                } else {
                    style = chars[i];
                }
                return value.split(';').map(x => {
                    return {key, value: x.split(',').map(x => +x), style};
                });
            });
            data = [].concat.apply([], data);
            return ervy.scatter(data, {width: 15, legendGap: 18});
        }
    };
    console.log(commands.scatter('Foo:1,1;2,2;3,3;4,4;5,5;6,5;7,5;8,5:green','Bar:1,2;2,3;3,4;4,5;5,6;6,6;7,6;8,6:yellow','Baz:12,8;13,8;12,7;13,7:red','Quux:12,4;14,4:blue'));
})({fg,scatter,bg});

Below is output of pixel size 2 and 1. I think that they should look the same but the width of the dots,

ervy6

How to set both background and color?

I've noticed that the demo doesn't render properly when you select the text. The charts should be reversed.
To fix the issue the style should be both ervy.bg and ervy.fg. Is it possible to combine the styles?

Scatter chart doesn't print values of 1

Hi, I have a strange problem with the scatter chart. Somehow the Y Axis starts at 2 and not 1.

  • macOS version 10.15.7
  • Terminal.app version 2.10

The code:

const options = {
  legendGap: 4,
};

const data = [
  { key: "A", value: [1, 1] },
  { key: "A", value: [2, 2] },
  { key: "A", value: [3, 3] },
  { key: "A", value: [4, 4] },
];

console.log(ervy.scatter(data, options));

And this is the result:

Screenshot 2021-12-11 at 16 20 57

Am I missing something?
Thank you very much!

Autofocus into terminal

I'm checking all pages that use my library (I link to them from the examples page on my website).

And found that on your website you autofocus the terminal when opening. This doesn't look right.

You need to use the option:

enabled: false

so it does not automatically focus.

I can create a PR if you want.

Drawille integration?

I wrote drawille a few years ago, if you're interested, i can help adding support for it (with drawille, every character cell becomes 8 pixel that you can individually control).

drawille

Problematic 0A and 0C in scatter plot

Those codes in specification say it should not move the cursor some terminal move by one, others don't implementation is inconsistent.

Check my question on Unix stackExchange.

What you thing the code suppose to do if there is 0C or 0A?

Redundant spaces for each call to ervy.bar function

Check this code:

const ervy = require('ervy');

console.log(ervy.bar([
    { key: 'A', value: 30, style: ervy.bg('green') },
    { key: 'B', value: 10, style: ervy.bg('blue')},
    { key: 'C', value: 50, style: ervy.bg('red')}
]));
console.log(ervy.bar([
    { key: 'A', value: 30, style: ervy.bg('green') },
    { key: 'B', value: 10, style: ervy.bg('blue')},
    { key: 'C', value: 50, style: ervy.bg('red')}
]));

ervy

each time you call ervy.bar, next bar char is indented with one more additional space

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.