Easy ASCII chart graphic library in java

I am looking for a solution to display the distribution of request time in our system.

I would like to plot a histogram and save it in a log file.

Is there a library in java graphics that can be displayed in ASCII / (asciiart)?

+4
source share
2 answers

I did not find a solution in pure java for this and wrote my own library:

java-ascii-render

An example of a generated chart:

┌──────────────────────────────────────┐ │ 1.00┼**** *****│ │ 0.75┼ *** *** │ │ 0.50┼ ** ** │ │ 0.25┼ ** ** │ │ 0.00┼ ** ** │ │-0.25┼ *** *** │ │-0.50┼ ********* │ │-0.75┼ * │ │-1.00┼───────┼───────┼───────┼───────┼│ │ 0 90 180 270 360│ └──────────────────────────────────────┘ 
+4
source

I'm not sure what your requirements are in terms of ease of distribution, but I know that gnuplot can create ASCII graphics. You can explore the use of one of the Java shells for gnuplot. http://jgnuplot.sourceforge.net/ or http://gnujavaplot.sourceforge.net/JavaPlot/ , maybe?

I did not study the API to find out if you can set the output format, but I think you can. It seems that gnujavaplot can do what you want. Use TextFileTerminal and use getTextOutput() or processOutput() to get an ASCII graph.

EDIT: There is also this option: Call gnuplot from java? (Ubunt) To force gnuplot into ASCII mode, install this in your GNUPlot script or on the command line:

 set term dumb 
0
source

Source: https://habr.com/ru/post/1379903/


All Articles