Roadmap Tutorial API's: XYGraph Axes etc Series Stats

THistogram Reference

THistogram is based on the code for TxyGraph. As such many of the design-time properties are very similar. This topic outlines the data methods of THistogram. The object inspector should tell you everything else you need to know.

Adding data to THistogram directly

You can add data directly to the THistogram using the following procedure:

  type
    PHistData = ^THistData;
    THistData = record
    freq:double;
    next:PHistData;
  end;
procedure adddata(xstart, xstep, Mean, SD:double; p:pHistData);

where p points to a linked list of frequencies and 1 bar will be drawn per node. The xstart and xstep properties are used to calculate the x axis labels. The mean and SD are used to draw the gaussian distribution for comparison if the property Appearance.plotnormal is set to true. Note that the normal distibution is scaled assuming that the sum of the frequencies is 1.

procedure cleardata;

clears any data previously added to the histogram

You can access the raw data using the readonly property data:pHistData

Hooking a Tseries/TDataSeries

You can hook a data series using the routine:

procedure HookDataSeries(ds:TDataSeries; ifhookx:boolean);

This hooks a TDataSeries (or TSeries) so that any changes in the data of the series will be updated on the histogram immediately. Ifhookx is to indicate whether the x or y data of the series is to be plotted.

procedure unhookDataSeries(wantclear:boolean);

this unhooks a series. Wantclear controls whether the histogram will be cleared or left as it is when the unhooking occurs.

The property Buckets:word; defines how many bars will be drawn for the hooked series.