File: main.pas

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (100 lines) | stat: -rw-r--r-- 2,895 bytes parent folder | download | duplicates (2)
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
unit main;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
  TAGraph, TATools, TAChartAxis, TASeries, TASources, TATransformations, Types;

type

  { TForm1 }

  TForm1 = class(TForm)
    Bevel1: TBevel;
    Chart: TChart;
    cbShowGrid_LeftAxis2: TCheckBox;
    cbShowGrid_LeftAxis1: TCheckBox;
    cbShowGrid_RightAxis: TCheckBox;
    cbShowGrid_BottomAxis: TCheckBox;
    RedSeries: TLineSeries;
    BlueSeries: TLineSeries;
    RedAxisTransformations: TChartAxisTransformations;
    RedAxisTransformationsAutoScaleAxisTransform: TAutoScaleAxisTransform;
    BlueAxisTransformations: TChartAxisTransformations;
    BlueAxisTransformationsAutoScaleAxisTransform: TAutoScaleAxisTransform;
    ChartToolset: TChartToolset;
    ChartToolsetAxisClickTool1: TAxisClickTool;
    ChartToolsetUserDefinedTool1: TUserDefinedTool;
    Label1: TLabel;
    Label2: TLabel;
    lblClickedAxis: TLabel;
    lblClickedAxisPart: TLabel;
    BottomPanel: TPanel;
    RedChartSource: TRandomChartSource;
    BlueChartSource: TRandomChartSource;
    procedure ChartToolsetAxisClickTool1Click(ASender: TChartTool;
      Axis: TChartAxis; AHitInfo: TChartAxisHitTests);
    procedure ChartToolsetUserDefinedTool1AfterMouseDown(ATool: TChartTool;
      APoint: TPoint);
    procedure cbShowGrid_LeftAxis2Change(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.ChartToolsetAxisClickTool1Click(ASender: TChartTool;
  Axis: TChartAxis; AHitInfo: TChartAxisHitTests);
var
  s: String;
begin
  s := '';
  if ahtGrid in AHitInfo then s := s + ', Axis grid';
  if ahtTitle in AHitInfo then s := s + ', Axis title';
  if ahtLine in AHitInfo then s := s + ', Axis line';
  if ahtLabels in AHitInfo then s := s + ', Axis labels';
  if ahtAxisStart in AHitInfo then s := s + ', begin of axis';
  if ahtAxisCenter in AHitInfo then s := s + ', center of axis';
  if ahtAxisEnd in AHitInfo then s := s + ', end of axis';
  if s <> '' then
  begin
    Delete(s, 1, 2);
    lblClickedAxis.Caption := Axis.Title.Caption;
    lblClickedAxisPart.Caption := s;
  end;
end;

procedure TForm1.ChartToolsetUserDefinedTool1AfterMouseDown(ATool: TChartTool;
  APoint: TPoint);
begin
  lblClickedAxis.Caption := '(none)';
  lblClickedAxisPart.Caption := '(none)';
  ATool.Handled;
end;

procedure TForm1.cbShowGrid_LeftAxis2Change(Sender: TObject);
begin
  if Sender = cbShowGrid_LeftAxis2 then
    Chart.LeftAxis.Grid.Visible := TCheckbox(Sender).Checked
  else if Sender = cbShowGrid_LeftAxis1 then
    Chart.AxisList[3].Grid.Visible := TCheckbox(Sender).Checked
  else if Sender = cbShowGrid_RightAxis then
    Chart.AxisList[2].Grid.Visible := TCheckbox(Sender).Checked
  else if Sender = cbShowGrid_BottomAxis then
    Chart.BottomAxis.Grid.Visible := TCheckbox(Sender).Checked;
end;

end.