Class LineChart

java.lang.Object
org.aesh.charts.linechart.LineChart
Direct Known Subclasses:
TimeSeriesChart

public class LineChart extends Object
A line chart that plots one or more data series on a 2D grid.

Supports multiple rendering modes (ASCII, Unicode, Braille), multiple series with colors and line styles, and viewport scrolling for data that exceeds the terminal width.

Example:

 LineChart chart = LineChart.builder()
         .width(60).height(15)
         .style(ChartStyle.BRAILLE)
         .xLabel("Time").yLabel("CPU %")
         .build();
 chart.addSeries(cpuData);
 System.out.println(chart.render());
 
  • Constructor Details

  • Method Details

    • builder

      public static LineChart.Builder builder()
    • addSeries

      public LineChart addSeries(DataSeries series)
    • seriesList

      public List<DataSeries> seriesList()
    • addMarker

      public LineChart addMarker(Marker marker)
      Add a marker to highlight a specific data point. Used for change detection alerts, regression markers, etc.
    • addHorizontalLine

      public LineChart addHorizontalLine(HorizontalLine line)
      Add a horizontal reference line (threshold, baseline, target).
    • scrollLeft

      public void scrollLeft(int amount)
    • scrollRight

      public void scrollRight(int amount)
    • scrollToStart

      public void scrollToStart()
    • scrollToEnd

      public void scrollToEnd()
    • setViewportSize

      public void setViewportSize(int size)
    • render

      public String render()
      Render the chart to a multi-line string.
    • plotSeries

      protected void plotSeries(Canvas canvas, DataSeries series, Axis xAxis, Axis yAxis, int plotLeft, int plotRight, int plotTop, int plotBottom)
      Plot a single data series onto the canvas.