Git Product home page Git Product logo

ascii-data's Introduction

ASCII-Data

GitHub license Build Status GitHub issues

A small Java library for producing nice looking text-based line-graphs and tables. (Not necessarily in ASCII).

Installation, Usage, Help, and more!

Please view the Wiki! You'll find everything you need to get started using this library. :)

ascii-data's People

Contributors

chrisgleissner avatar mitchtalmadge avatar sebkur 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

ascii-data's Issues

Padding malfunction for full-width characters

Hi, I suggest some improvement for this great library.

In East Asian languages, including Japanese, characters are represented with a width twice that of ASCII. This is expressed as full width in Unicode.

This library seems to calculate the amount of padding simply by character count, so if input that includes full-width characters is given, the table display will be corrupted.

Since there are libraries that determine whether Unicode characters are full-width or not[1], it would be possible to render the table accurately by improving the algorithm that calculates the amount of padding.

Actual output:

image

Thanks!

[1] https://unicode-org.github.io/icu-docs/apidoc/dev/icu4j/com/ibm/icu/lang/UCharacter.html#getIntPropertyValue-int-int-

setForzeZeroInRange

I'm using this library mostly for debugging trading bots. The problem is that the prices never go to 0, but instead hang around, let's say, 8000. The charts force the zero to be in range of the Y axis, which flattens my chart to a point where I can't see movements anymore. Can you add an option to not force zero in range on the Y axis? Or better yet, allow us to determine our own ranges?

NPE for null data values

An NPE is thrown when some of the data cells are null. It would be good if these could be rendered in a special way (e.g. as "null" or configurable via a new method withNullValue(String) ) to differentiate them from empty strings.

Example to reproduce the NPE:

System.out.println(ASCIITable.fromData(new String[]{"ID", "Name"}, new String[][]{{"1", null},}).toString());

This results in:

Exception in thread "main" java.lang.NullPointerException
	at com.mitchtalmadge.asciidata.table.ASCIITable.<init>(ASCIITable.java:79)

I appreciate that I could convert the data before passing it into ASCIITable, but having absent values is quite a common scenario and I think your library would be improved by handling this gracefully.

Support omitting header

I would like an option to generate a table without a header. Sometimes there is no meaning to the columns of the table, so the header cells are empty. As a workaround, I strip the first two lines of the generated table and fix the corner and column separator characters.

Table align option

For the tables, it would be really useful to have an option on the ASCIITable class to set a column's justification, so that we can create tables with centered or right-aligned content. What do you think about it?

Examples

Instead of this:

╔═══════════╤══════════╗
║ FirstName │ LastName ║
╠═══════════╪══════════╣
║ Foo       │ Bar      ║
╟───────────┼──────────╢
║ Kit       │ Kat      ║
╚═══════════╧══════════╝

I sometimes prefer this:

╔═══════════╤══════════╗
║ FirstName │ LastName ║
╠═══════════╪══════════╣
║ Foo       │      Bar ║
╟───────────┼──────────╢
║ Kit       │      Kat ║
╚═══════════╧══════════╝

Escpecially when numbers are involved:

╔═══════════╤══════════╗
║ Name      │ Score    ║
╠═══════════╪══════════╣
║ Foo       │        5 ║
╟───────────┼──────────╢
║ Kit       │      123 ║
╚═══════════╧══════════╝

ArrayIndexOutOfBoundsException

ASCIIGraph.fromSeries(new double[]{14280.0, 2.93811E8}).withNumRows(10).plot()
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at com.mitchtalmadge.asciidata.graph.ASCIIGraph.drawTicksAndAxis(ASCIIGraph.java:181)
	at com.mitchtalmadge.asciidata.graph.ASCIIGraph.plot(ASCIIGraph.java:157)

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.