net.i2p.router.web

## Class GraphListener

- java.lang.Object
- - net.i2p.router.web.GraphListener

- All Implemented Interfaces:
    RateSummaryListener

      public class GraphListener
      extends Object
      implements RateSummaryListener

  Creates and updates the in-memory or on-disk RRD database, and provides methods to generate graphs of the data

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) static ConsolFun` | `CF`
    `(package private) static DsType` | `DS`
    `static int` | `MAX_ROWS`
    `(package private) static int` | `PERIODS`
    `static String` | `PROP_PERSISTENT`
    `(package private) static String` | `RRD_DIR` note that .jrb files are NOT compatible with .rrd files
    `(package private) static String` | `RRD_PREFIX`
    `(package private) static String` | `RRD_SUFFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GraphListener(Rate r)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(double totalValue, long eventCount, double totalEventTime, long period)` Called to add rate statistics for a period.
    `(package private) static String` | `createName(I2PAppContext ctx, String wanted)` JRobin can only deal with 20 character data source names, so we need to create a unique, munged version from the user/developer-visible name.
    `boolean` | `equals(Object obj)`
    `(package private) RrdBackendFactory` | `getBackendFactory()`
    `(package private) RrdDb` | `getData()`
    `(package private) String` | `getEventName()`
    `(package private) String` | `getName()`
    `Rate` | `getRate()`
    `(package private) int` | `getRows()`
    `int` | `hashCode()`
    `(package private) long` | `now()`
    `void` | `renderPng(OutputStream out)`
    `void` | `renderPng(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, int end, boolean showCredit)` Single graph.
    `void` | `renderPng(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, int end, boolean showCredit, GraphListener lsnr2, String titleOverride)` Single or two-data-source graph.
    `boolean` | `startListening()`
    `void` | `stopListening()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CF

          static final ConsolFun CF

    - #### DS

          static final DsType DS

    - #### MAX_ROWS

          public static final int MAX_ROWS

      See Also:
        Constant Field Values

    - #### PERIODS

          static final int PERIODS

      See Also:
        Constant Field Values

    - #### PROP_PERSISTENT

          public static final String PROP_PERSISTENT

      See Also:
        Constant Field Values

    - #### RRD_DIR

          static final String RRD_DIR

      note that .jrb files are NOT compatible with .rrd files
      See Also:
        Constant Field Values

    - #### RRD_PREFIX

          static final String RRD_PREFIX

      See Also:
        Constant Field Values

    - #### RRD_SUFFIX

          static final String RRD_SUFFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GraphListener

          public GraphListener(Rate r)

  - ### Method Detail

    - #### add

          public void add(double totalValue,
                          long eventCount,
                          double totalEventTime,
                          long period)

      Description copied from interface: `RateSummaryListener`
      Called to add rate statistics for a period.
      Specified by:
        `add` in interface `RateSummaryListener`
      Parameters:
        `totalValue` - sum of all event values in the most recent period
        `eventCount` - how many events occurred
        `totalEventTime` - how long the events were running for
        `period` - how long this period is

    - #### createName

          static String createName(I2PAppContext ctx,
                                   String wanted)

      JRobin can only deal with 20 character data source names, so we need to create a unique, munged version from the user/developer-visible name.

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### getBackendFactory

          RrdBackendFactory getBackendFactory()

    - #### getData

          RrdDb getData()

    - #### getEventName

          String getEventName()

    - #### getName

          String getName()

    - #### getRate

          public Rate getRate()

    - #### getRows

          int getRows()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### now

          long now()

    - #### renderPng

          public void renderPng(OutputStream out)
                         throws IOException

      Throws:
        `IOException`

    - #### renderPng

          public void renderPng(OutputStream out,
                                int width,
                                int height,
                                boolean hideLegend,
                                boolean hideGrid,
                                boolean hideTitle,
                                boolean showEvents,
                                int periodCount,
                                int end,
                                boolean showCredit)
                         throws IOException

      Single graph.
      Parameters:
        `end` - number of periods before now
      Throws:
        `IOException`

    - #### renderPng

          public void renderPng(OutputStream out,
                                int width,
                                int height,
                                boolean hideLegend,
                                boolean hideGrid,
                                boolean hideTitle,
                                boolean showEvents,
                                int periodCount,
                                int end,
                                boolean showCredit,
                                GraphListener lsnr2,
                                String titleOverride)
                         throws IOException

      Single or two-data-source graph.
      Parameters:
        `lsnr2` - 2nd data source to plot on same graph, or null. Not recommended for events.
        `titleOverride` - If non-null, overrides the title
      Throws:
        `IOException`

    - #### startListening

          public boolean startListening()

      Returns:
        success

    - #### stopListening

          public void stopListening()