YOUSEFUL / DELPHI / COMPONENTS
TAtlasFinPane
One horizontal pane of a TAtlasFinChart: a title, a height weight, its own value scale and the studies drawn in it.
Description
Panes are items of TAtlasFinPanes, the chart's Panes collection, and are created with Chart.Panes.Add(Title, Weight). All panes share the chart's bars and horizontal axis; each has its own vertical scale, computed at every render from the visible bars of its visible studies (see TAtlasFinChart for the rules). The pane is stored in the form file with its Title, Weight, Logarithmic and Studies.
A pane without visible studies, or without values in view, is drawn with a 0..1 scale.
Members
| Member | Kind | What it does |
|---|---|---|
Create | constructor | Creates an empty pane with Weight 100, a linear scale and no studies. |
Destroy | destructor | Frees the pane's studies and scale. |
Assign | method | Copies the title, weight, logarithmic setting and all studies of another pane. |
Axis | property | The pane's value scale as of the most recent render: Axis.ViewMin and Axis.ViewMax are the values at the bottom and top of the plot area. |
Title | property | The bold text at the start of the pane's header line; empty shows no title. |
Weight | property | The pane's share of the chart height relative to the other panes: panes weighted 300, 100 and 100 get three fifths, one fifth and one fifth. |
Logarithmic | property | Draws the pane on a logarithmic scale. |
Studies | property | What the pane draws, in order: later studies are drawn over earlier ones and listed after them in the header. |
Constructors
Create constructor
constructor Create(Collection: TCollection); override;Creates an empty pane with Weight 100, a linear scale and no studies. Use Chart.Panes.Add rather than calling it directly.
Destructors
Destroy destructor
destructor Destroy; override;Frees the pane's studies and scale. Chart.Panes.Delete(Index) or Pane.Free removes a pane from the chart.
Properties
Axis property
property Axis: TAtlasPlotAxis read FAxis;The pane's value scale as of the most recent render: Axis.ViewMin and Axis.ViewMax are the values at the bottom and top of the plot area. It is an Atlas Plot TAtlasPlotAxis. The chart sets its range at every render, so its Automatic, Minimum, Maximum, Inverted and Grid settings have no effect here. Axis.LabelFormat does change the tick labels (below 100000), but it is neither stored in the form file nor copied by Assign.
var Low, High: Double;
Chart.CreateBitmap(800, 600).Free; // any render updates the scale
Low := Chart.Panes[0].Axis.ViewMin;
High := Chart.Panes[0].Axis.ViewMax;Title property
property Title: string read FTitle write SetTitle;The bold text at the start of the pane's header line; empty shows no title. Also the name shown in the collection editor.
Weight property
property Weight: Integer read FWeight write SetWeight default 100;The pane's share of the chart height relative to the other panes: panes weighted 300, 100 and 100 get three fifths, one fifth and one fifth. Values are clamped to 1..100000. Every pane keeps at least three text lines, and the last pane takes whatever height is left. Dragging the border between two panes changes both weights and keeps their sum.
Chart.Panes[0].Weight := 400; // a taller price paneLogarithmic property
property Logarithmic: Boolean read GetLogarithmic write SetLogarithmic default False;Draws the pane on a logarithmic scale. The range is rounded out to whole powers of ten (for prices between 99 and 121 the scale runs from 10 to 1000), so it helps only with data that spans a large range. Values of zero or below are not drawn. A pane holding only RSI studies stays fixed at 0..100.
Chart.Panes[0].Logarithmic := True;Studies property
property Studies: TAtlasFinStudies read FStudies write SetStudies;What the pane draws, in order: later studies are drawn over earlier ones and listed after them in the header.
Pane.Studies.Add(skCandles);
Pane.Studies.Add(skEMA, 50).LineWidth := 2;Methods
Assign method
procedure Assign(Source: TPersistent); override;Copies the title, weight, logarithmic setting and all studies of another pane.
Examples
A price pane with two moving averages over a volume pane
Builds the layout in one update so the chart repaints once.
uses Vcl.Graphics, Atlas.FinChart;
procedure BuildPanes(Chart: TAtlasFinChart);
var
Price: TAtlasFinPane;
begin
Chart.Panes.BeginUpdate;
try
Chart.Panes.Clear;
Price := Chart.Panes.Add('Price', 300);
Price.Studies.Add(skCandles);
Price.Studies.Add(skSMA, 50).Color := clNavy;
Price.Studies.Add(skSMA, 200).Color := clMaroon;
Chart.Panes.Add('Volume', 80).Studies.Add(skVolume);
finally
Chart.Panes.EndUpdate;
end;
end;Related
TAtlasFinPanes · TAtlasFinStudy · TAtlasFinChart