program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, tachartlazaruspkg
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, TAGraph, TASeries, TATransformations, Forms,
Controls, Graphics, Dialogs, Math;
type
{ TForm1 }
TForm1 = class(TForm)
Chart1: TChart;
ChartAxisTransformations1: TChartAxisTransformations;
ChartAxisTransformations1LogarithmAxisTransform1: TLogarithmAxisTransform;
Series1: TLineSeries;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
Frequency: array[1..12] of Integer;
begin
for I := 1 to 12 do
Frequency[I] := 1;
Frequency[1] := 2;
for I := 1 to 12 do begin
//Series1.AddXY(Log2(I), Log2(Frequency[I]));
Series1.AddXY(I, Frequency[I]);
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Chart1.SaveToFile(TPortableNetworkGraphic, 'project1.png');
end;
end.
object Form1: TForm1
Left = 237
Height = 398
Top = 120
Width = 775
Caption = 'Form1'
ClientHeight = 398
ClientWidth = 775
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '1.6.0.4'
object Chart1: TChart
Left = 0
Height = 398
Top = 0
Width = 775
AxisList = <
item
Grid.Visible = False
Intervals.Count = 2
Intervals.Tolerance = 100
Marks.Format = '%0.0e'
Marks.Style = smsCustom
Minors = <>
Title.LabelFont.Height = -13
Title.LabelFont.Orientation = 900
Title.Visible = True
Title.Caption = 'frequency (log)'
Transformations = ChartAxisTransformations1
end
item
Grid.Visible = False
Alignment = calBottom
Marks.Format = '%0.0e'
Marks.Style = smsCustom
Minors = <>
Title.LabelFont.Height = -13
Title.Visible = True
Title.Caption = 'rank (log)'
Transformations = ChartAxisTransformations1
end>
BackColor = clWhite
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlack
Title.Font.Height = -16
Title.Font.Style = [fsBold]
Title.Text.Strings = (
'Plot of word frequency'
)
Title.Visible = True
Align = alClient
Color = clWhite
object Series1: TLineSeries
LinePen.Color = clTeal
LinePen.Width = 2
Pointer.Brush.Color = clTeal
Pointer.Pen.Color = clTeal
Pointer.Style = psCircle
ShowPoints = True
end
end
object ChartAxisTransformations1: TChartAxisTransformations
left = 200
top = 8
object ChartAxisTransformations1LogarithmAxisTransform1: TLogarithmAxisTransform
Base = 10
end
end
end