[Lazarus] TAChart - Logarithmic Transform fails for X Axis
Peter Thurner
pm.thurner at gmx.at
Fri Dec 13 22:18:58 CET 2013
Hello *,
here is an example which I use to try log transform for x-axis:
Can anybody try out please the code below which plots a sin(x)/x curve
between 1 ... 100 in linear scale.
(please see attached picture).
If I apply a log10 transform to the x axis, then I always get a "Range
Check Error"!
What do I do wrong here?
Thanks in advance for your help.
=======================================================
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, TAGraph, TATransformations, TASeries,
TAFuncSeries, TAIntervalSources, Forms, Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
Chart1: TChart;
ChartAxisTransformations1: TChartAxisTransformations;
LogarithmAxis: TLogarithmAxisTransform;
SincSeries: TLineSeries;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
const
N = 1000;
MIN = 0.1;
MAX = 100;
var
i: integer;
x: double;
begin
for i := 0 to N - 1 do
begin
x := MIN + (MAX - MIN) * i / (N - 1);
SincSeries.AddXY(x, sin(x)/x);
end;
end;
end.
=======================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tachart_logtrans_x.jpg
Type: image/jpeg
Size: 55868 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131213/4834f19f/attachment-0003.jpg>
More information about the Lazarus
mailing list