Skip to content

ASCIIGraph | Options

Mitch Talmadge edited this page Oct 2, 2017 · 3 revisions

You can modify certain properties of the graph to change its appearance. These can be configured in-line like everything else, and can even be changed after plotting the graph if you want to make more graphs based on the same data with different configurations.

Number of Rows

Use the method ASCIIGraph#withNumRows(int) to change the number of rows on the graph. By default, the library will choose the number of rows by incrementing between the minimum and maximum values in steps of 1.

ASCIIGraph
    .fromSeries(data)
    .plot()

Default Rows

ASCIIGraph
    .fromSeries(data)
    .withNumRows(8)
    .plot()

8 Rows

ASCIIGraph
    .fromSeries(data)
    .withNumRows(3)
    .plot()

3 Rows

Tick Formatting

You can adjust the appearance of the tick marks (the numbers on the side of the axis) in two ways.

  • You can change how they are formatted, using a custom DecimalFormat.
  • You can change their padding width. For example, a padding width of 8 will left-pad the number 10.00 with 3 spaces, since it only takes up 5 characters.
ASCIIGraph
    .fromSeries(data)
    .withTickFormat(new DecimalFormat("##0.000000"))
    .withTickWidth(12)
    .plot()

Tick Formatted Graph