Class HistogramSeries


public class HistogramSeries extends BarSeries

A histogram: samples counted into equal width bins and drawn as touching bars.

double[] latencies = {120, 135, 150, 180, 240, 95, 160};
new HistogramSeries("Response time").setSamples(latencies, 0);

A histogram

  • Constructor Details

    • HistogramSeries

      public HistogramSeries(String name)

      Creates an empty histogram.

      Parameters
      • name: the series name
  • Method Details

    • setSamples

      public HistogramSeries setSamples(double[] samples, int bins)

      Bins the samples.

      Parameters
      • samples: the raw values; NaN values are ignored

      • bins: the number of bins, at most 10000, or 0 or less to choose one with Sturges' rule

      Returns

      this series

      Throws
      • IllegalArgumentException: if bins is above 10000, which no chart can show and whose arrays would only exhaust memory
    • getBinWidth

      public double getBinWidth()
      The width of one bin in data units.