| Class THistogram (unit Xyhist) |
TCustomPanel
-------------------------- THistogram ------------------------------
| Constructors |
constructor Create(AOwner: TComponent);| Functions |
procedure adddata(xstart, xstep, Mean, SD:double; p:pHistData);--------------------------------------------------------------------- #5e.
procedure Addmark(id: Integer; x1,y1, x2,y2: Double;
c: Tcolor; name: string;
marktype:et_marktype; status:boolean);
function CheckScales: Boolean;
procedure cleardata;
procedure ClearMarks;--------------------------------------------------------------------- #5h.
procedure Debug(i: Integer; fn: String);
function DeleteMark(id: Integer): Boolean;
destructor Destroy;
procedure DrawFunction(F: PlotFunction; var parms; x1, x2: Double;
color: TColor; style: TPenStyle; steps: Word);
procedure HookDataSeries(ds:TDataSeries; ifhookx:boolean);
procedure mycleardata;
procedure Print;
procedure PrintOnPage;
procedure unhookDataSeries(wantclear:boolean);
procedure CalcMetrics;
procedure CalcXMetrics;
procedure CalcYMetrics;
procedure ClipGraph;
procedure ColorBackground;
procedure DoRescaleEvent;
function DoResize: Boolean;
function DoResizeX: Boolean;
function DoResizeY: Boolean;
procedure DrawAxes;
procedure drawbars;
procedure DrawGraphTitle;
procedure DrawLineSegment(x1, y1, x2, y2: Integer);
procedure DrawMarks(when: Boolean);
procedure drawnormal;
procedure DrawXAxis;
procedure DrawXLabels;
procedure DrawXTickMarks;
procedure DrawYAxis;
procedure DrawYGridlines;
procedure DrawYLabels;
procedure DrawYTickMarks;
function fx(v: Double): Integer;
function fy(v: Double): Integer;
procedure Paint;
procedure PaintGraph;
procedure UnclipGraph;
procedure readhistogram;
procedure SetBuckets(v:word);
procedure WhenSeriesDataChanges(Sender:TObject; TheMessage:TDSChangeType);| Properties |
property Align :
property Appearance : THAppearance
property BevelInner :
property BevelOuter :
property BevelWidth :
property BorderStyle :
property BorderWidth :
property Color :
property Ctl3D :
property Cursor :
property Dimensions : THDimensions
property Font :
property ParentColor :
property ParentCtl3D :
property ParentFont :
property Visible :
property XAxis : THAxis
property YAxis : THAxis
property Buckets : word
property data : pHistData| Events |
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnDrawXLabel : TDrawLabelEvent
event OnDrawYLabel : TDrawLabelEvent
event OnEndDrag :
event OnEnter :
event OnExit :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnPaintEnd : TPaintEvent
event OnRescale : TNotifyEvent
event OnResize :
event OnScaleError : TNotifyEvent| Variables |
FAppearance : THAppearance;
FBuckets : word;
FCanvas : TCanvas;
Fdata : PHistData;
FDataIsX : boolean;
FDataSeries : TDataSeries;
FDimensions : THDimensions;
FFirstTime : Boolean;
FMarks : pMark;
FMean : double;
FOnDrawXLabel : TDrawLabelEvent;
FOnDrawYLabel : TDrawLabelEvent;
FOnPaintEnd : TPaintEvent;
FOnRescale : TNotifyEvent;
FOnScaleError : TNotifyEvent;
FScale : Double;
FSD : double;
FXAxis : THAxis;
FXcount : word;
FXOffset : Word;
FXStart : double;
FXStep : double;
FYAxis : THAxis;
FYOffset : Word;| Constructors |
constructor Create(AOwner: TComponent);--------------------------------------------------------------------- #5a. THistogram - administration ---------------------------------------------------------------------
| Functions |
procedure adddata(xstart, xstep, Mean, SD:double; p:pHistData);data routines
--------------------------------------------------------------------- #5e. THistogram - property servers ---------------------------------------------------------------------} {--------------------------------------------------------------------- #5g. THistogram - data manipulation ---------------------------------------------------------------------
procedure Addmark(id: Integer; x1,y1, x2,y2: Double;
c: Tcolor; name: string;
marktype:et_marktype; status:boolean);
function CheckScales: Boolean;
procedure cleardata;
procedure ClearMarks;Marks
--------------------------------------------------------------------- #5h. THistogram - Marks routines ---------------------------------------------------------------------
procedure Debug(i: Integer; fn: String);--------------------------------------------------------------------- #5i. THistogram - debug routine ---------------------------------------------------------------------
function DeleteMark(id: Integer): Boolean;
destructor Destroy;Create
procedure DrawFunction(F: PlotFunction; var parms; x1, x2: Double;
color: TColor; style: TPenStyle; steps: Word);A convenient way to graph a function; automatically fills graph; handles singularities in the function. F must be far; parms may be of any type (usu. array of Double) -- no error checks; the graph of the function will be drawn from x=x1 to x=x2; if x1=x2, will be set to XMin, XMax; if larger, will be clipped to XMin, XMax if steps=0, will choose "enough" to be smooth
if abs((x - mean) / sd) > no_sds then result := 0
procedure HookDataSeries(ds:TDataSeries; ifhookx:boolean);
procedure mycleardata;
procedure Print;Paint
procedure PrintOnPage;PrintOnPage allows more than one graph to be printed on a page; calls to it must be preceded by BeginDoc amd followed by EndDoc. Print prints only the current graph on its own sheet. The graph is printed without change in aspect ratio. The size of the printed graph is controlled by PrintScalePct, which makes the dimension of the printed graph a percentage of the page dimension (on the axis with the larger Screen/Page ratio) The location of the upper left corner of the graph is controlled by PrintX(Y)OffsetPct, which locate the corner as percentages of the page height and width
procedure unhookDataSeries(wantclear:boolean);
procedure CalcMetrics;
procedure CalcXMetrics;
procedure CalcYMetrics;
procedure ClipGraph;--------------------------------------------------------------------- #5d. THistogram - painting routines ---------------------------------------------------------------------
procedure ColorBackground;DrawMarks
procedure DoRescaleEvent;--------------------------------------------------------------------- #5c. THistogram - metrics routines ---------------------------------------------------------------------
function DoResize: Boolean;
function DoResizeX: Boolean;---------------------- graph scaling ------------------------------------
function DoResizeY: Boolean;
procedure DrawAxes;DrawYAxis
procedure drawbars;ColorBackground
procedure DrawGraphTitle;DrawYLabels
procedure DrawLineSegment(x1, y1, x2, y2: Integer);note for confused readers: the shortcut to unclip that is valid for screen metrics is not valid for printers :)
procedure DrawMarks(when: Boolean);DrawGraphTitle
procedure drawnormal;skip out-of-support x's
procedure DrawXAxis;
procedure DrawXLabels;very small or very large
procedure DrawXTickMarks;DrawYGridlines
procedure DrawYAxis;DrawXAxis
procedure DrawYGridlines;
procedure DrawYLabels;DrawXLabels
procedure DrawYTickMarks;DrawXTickMarks
function fx(v: Double): Integer;
function fy(v: Double): Integer;20000 is large compared with device pixel size; this avoids range error if some points are far outside the axis range
procedure Paint;Printing: linewidth for series, points thinner than for axes
procedure PaintGraph;
procedure UnclipGraph;
procedure readhistogram;
procedure SetBuckets(v:word);don't care: dsRegressionChange, dsZeroChange not consulted: dsChangeLook
procedure WhenSeriesDataChanges(Sender:TObject; TheMessage:TDSChangeType);| Properties |
property Align :
property Appearance : THAppearance
property BevelInner :
property BevelOuter :
property BevelWidth :
property BorderStyle :
property BorderWidth :
property Color :
property Ctl3D :
property Cursor :
property Dimensions : THDimensions
property Font :
property ParentColor :
property ParentCtl3D :
property ParentFont :
property Visible :
property XAxis : THAxis
property YAxis : THAxis
property Buckets : word
property data : pHistData| Events |
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnDrawXLabel : TDrawLabelEvent
event OnDrawYLabel : TDrawLabelEvent
event OnEndDrag :
event OnEnter :
event OnExit :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnPaintEnd : TPaintEvent
event OnRescale : TNotifyEvent
event OnResize :
event OnScaleError : TNotifyEvent| Variables |
FAppearance : THAppearance;
FBuckets : word;
FCanvas : TCanvas;Private declarations
Fdata : PHistData;
FDataIsX : boolean;
FDataSeries : TDataSeries;
FDimensions : THDimensions;
FFirstTime : Boolean;
FMarks : pMark;
FMean : double;
FOnDrawXLabel : TDrawLabelEvent;
FOnDrawYLabel : TDrawLabelEvent;
FOnPaintEnd : TPaintEvent;
FOnRescale : TNotifyEvent;Events:
FOnScaleError : TNotifyEvent;
FScale : Double;Graph property data:
FSD : double;
FXAxis : THAxis;
FXcount : word;
FXOffset : Word;
FXStart : double;
FXStep : double;
FYAxis : THAxis;
FYOffset : Word;