1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, TAGraph, TASources, TASeries, Forms, Controls,
Graphics, Dialogs, Spin, StdCtrls, ExtCtrls, ComCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
ChartTop: TChart;
ChartTopLineSeries1: TLineSeries;
Chart1LineSeries2: TLineSeries;
ChartBottom: TChart;
ChartBottomLineSeries1: TLineSeries;
Chart2LineSeries2: TLineSeries;
ChartRight: TChart;
ChartLeft: TChart;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
PageControl1: TPageControl;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
RandomChartSource1: TRandomChartSource;
RandomChartSource2: TRandomChartSource;
EdLabelSizeLeft: TSpinEdit;
EdLabelSizeRight: TSpinEdit;
EdPositionLeft: TSpinEdit;
EdLabelSizeBottom: TSpinEdit;
EdLabelSizeTop: TSpinEdit;
EdPositionBottom: TSpinEdit;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
procedure EdLabelSizeTopChange(Sender: TObject);
procedure EdPositionBottomChange(Sender: TObject);
procedure EdLabelSizeLeftChange(Sender: TObject);
procedure EdLabelSizeRightChange(Sender: TObject);
procedure EdPositionLeftChange(Sender: TObject);
procedure EdLabelSizeBottomChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure PageControl1Change(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
PageControl1Change(nil);
end;
procedure TForm1.PageControl1Change(Sender: TObject);
const
AXIS_NAMES: array[0..1] of String = ('left and right', 'top and bottom');
begin
Panel3.Caption := Format('The %s axis lines are at different ' +
'positions. Increase "LabelSize" to align them.', [AXIS_NAMES[PageControl1.PageIndex]]);
end;
{ Charts on page "stacked" }
procedure TForm1.EdLabelSizeLeftChange(Sender: TObject);
begin
ChartTop.LeftAxis.LabelSize := EdLabelSizeLeft.Value;
ChartBottom.LeftAxis.LabelSize := EdLabelSizeLeft.Value;
end;
procedure TForm1.EdLabelSizeRightChange(Sender: TObject);
begin
ChartTop.AxisList[2].LabelSize := EdLabelSizeRight.Value;
ChartBottom.AxisList[2].LabelSize := EdLabelSizeRight.Value;
end;
procedure TForm1.EdPositionLeftChange(Sender: TObject);
begin
ChartTop.LeftAxis.Position := EdPositionLeft.Value;
ChartBottom.LeftAxis.Position := EdPositionLeft.Value;
end;
{ Charts on page "side-by-side" }
procedure TForm1.EdLabelSizeBottomChange(Sender: TObject);
begin
ChartLeft.BottomAxis.LabelSize := EdLabelSizeBottom.Value;
ChartRight.BottomAxis.LabelSize := EdLabelSizeBottom.Value;
end;
procedure TForm1.EdLabelSizeTopChange(Sender: TObject);
begin
ChartLeft.AxisList[2].LabelSize := EdLabelSizeTop.Value;
ChartRight.AxisList[2].LabelSize := EdLabelSizeTop.Value;
end;
procedure TForm1.EdPositionBottomChange(Sender: TObject);
begin
ChartLeft.BottomAxis.Position := EdPositionBottom.Value;
ChartRight.BottomAxis.Position := EdPositionBottom.Value;
end;
end.
|