Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-12

TAChart - Logarithmic Transform fails for X Axis

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Thurner

Hello *,

This is the first time that I post something, so please be patient with me :-)

I have been using Plotpanel now for a while to plot Bode diagrams within Lazarus GUIs.
Now I would like to switch to TAChart which seems very powerfull too. I tried it out with linear graphs and it works very well.

But If I try to plot a bode diagram with a logarithmic x Axis then it crashes.
I followed the tutorial about logarithmic transform: http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_Axis,_Fitting and I did all the steps successfully.

BUT If I try to apply a logarithmic transform to the bottom axis (x-axis) then it crashes.
It displays the graph but the grid lines are gone. Has anybody tried already to apply log transform to bottom axis? It works for left axis.

Thanks
PeterT

Reply by email

Salvatore Coppola
to Peter Thurner

Have you checked data (>0)?
Salvatore

2013/12/7 Peter Thurner

Show quoted text 32 lines
Hello *, This is the first time that I post something, so please be patient with me :-) I have been using Plotpanel now for a while to plot Bode diagrams within Lazarus GUIs. Now I would like to switch to TAChart which seems very powerfull too. I tried it out with linear graphs and it works very well. But If I try to plot a bode diagram with a logarithmic x Axis then it crashes. I followed the tutorial about logarithmic transform: http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_ Axis,_Fitting and I did all the steps successfully. BUT If I try to apply a logarithmic transform to the bottom axis (x-axis) then it crashes. It displays the graph but the grid lines are gone. Has anybody tried already to apply log transform to bottom axis? It works for left axis. Thanks PeterT -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131208/5dc69b82/attachment.html>

Reply by email

Peter Thurner
to Salvatore Coppola

Hello Salvatore,
Thanks for the reply.
Yes, I used the same dataset and switched x and y. It worked when I did log transform with left-axis.
the same dataset fails if I switch x and y and do transform on bottom axis. BR Peter

Salvatore Coppola wrote 46 lines
Have you checked data (>0)? Salvatore 2013/12/7 Peter Thurner < <mailto:>> Hello *, This is the first time that I post something, so please be patient with me :-) I have been using Plotpanel now for a while to plot Bode diagrams within Lazarus GUIs. Now I would like to switch to TAChart which seems very powerfull too. I tried it out with linear graphs and it works very well. But If I try to plot a bode diagram with a logarithmic x Axis then it crashes. I followed the tutorial about logarithmic transform: http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_Axis,_Fitting and I did all the steps successfully. BUT If I try to apply a logarithmic transform to the bottom axis (x-axis) then it crashes. It displays the graph but the grid lines are gone. Has anybody tried already to apply log transform to bottom axis? It works for left axis. Thanks PeterT -- _______________________________________________ Lazarus mailing list <mailto:> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131209/9e445bf0/attachment.html>

Reply by email

Peter Thurner

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.freepascal.org/pipermail/lazarus/attachments/20131213/4834f19f/attachment-0001.jpg>

Reply by email

Peter Thurner
to Peter Thurner

Hello again,

I changed now from Lazarus 64 Bit to 32 Bit version and there it works as expected.
BR Peter

Peter Thurner wrote 73 lines
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. ======================================================= -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131213/a5208c40/attachment.html>

Reply by email