[Lazarus] tachart legend colorbar
Dear all, I would like to know if it is possible to add to a TAChart a legend as a colorbar (see http://www.google.it/imgres?imgurl=http%3A%2F%2Fi45.tinypic.com%2F2qsqvrk.pngimgrefurl=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F2925806%2Ffixing-color-in-scatter-plots-in-matplotlibh=407w=978tbnid=458f2PJaHo4RkM%3Azoom=1docid=Ycay3CVBtNtDgMei=gC45U5nKEIaLtAbpyYGAAQtbm=ischved=0CGIQhBwwBAiact=rcdur=349page=1start=0ndsp=36) I would like to add a serie where points are coloured depending on a value (e.g. 0 - blue, 1 - red and values between 0 and 1 coloured changing gradually between blue and red) and I would like to display the legend accordingly in a gradient colorbar manner. Is it possible? Best regards, Andrea Mauri -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Some articles on Lazarus/Free Pascal.
On Saturday, 29 March, 2014 11:52 PM, Michael Van Canneyt wrote: Hello, Since many years I have been writing articles about Object Pascal (both in Delphi/Kylix and FPC/Lazarus), as well as some other things. These articles were published - in the main - in a German magazine called Toolbox. Some articles appeared in FreeX, a unix magazine by the same Publishers (CL). Both magazines no longer exist. Thank you for your work. I hope you can make one for the BSD magazine that we discussed before... :) Version 1.0.12 works fine on my FreeBSD 10 vm. Lately, I have started writing for Blaise Pascal magazine. The editors of these magazines have given me permission to publish the original english texts of the articles, in PDF. There are almost 120 articles. They span a long period (almost 15 years), so some of them will be quite outdated or are not relevant for Lazarus/FPC, but nevertheless I thought some of them might be interesting, as they explain some of the components available in FPC/Lazarus. A couple of them are translated to dutch (and hence not readable by the majority of users). So, if you want, you can visit and download what you like from here: http://www.freepascal.org/~michael/articles/ If you want some of the sample source code, feel free to contact me, and I will try to send it if it still exists - and subsequently publish the sources on the same page. Enjoy, Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus smime.p7s Description: S/MIME Cryptographic Signature -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TTimer woes (newbie)
On 03/31/2014 01:44 AM, Bob Axtell wrote: can someone show a newbie how to use the two system timers? What do you mean by system timers ? In a normal GUI based application you normally use TTimer for time-based actions. You easily can create as many TTimers as you like (as well visually using the Lazarus GUI designer) as dynamically by having your program do myTimerN := TTimer.Create(Self); ) -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Crosscompile Target Win32 error : ( /units/i386-win32/win32] Error 1)
On Friday, 28 March, 2014 05:36 PM, Mattias Gaertner wrote: On Fri, 28 Mar 2014 17:02:44 +0800 Allan E. Registos allan.regis...@smpc.steniel.com.ph wrote: [...] and can't locate the correct fpcsrc version What is the correct fpcsrc version? During Lazarus startup, cannot find the correct location, I must say location of the fpcsrc installed. The IDE searches all common places. Is one common place missing? I have .lazarus v 1.0.14 in my home directory. Uninstalled Lazarus 1.0.14 and install v 1.2, during startup, it uses that directory for environmental setup and now generates an error for locating FPC. My mistake of saying 'location', it still find the directory but failed to recognize that it was the correct directory, that prompted me to move .lazarus. I did not take a screenshot of the error, so I cannot recall of the exact wording, but I think anyone can reproduce the error generated by: 1. Install Lazarus 1.0.14(fpc/fpcsrc). 2. Uninstall only lazarus 1.0.14 3. Install 1.2 version 4. Run Lazarus and wait for the prompt and error at fpc tab during startup. [...] make: Entering directory `/usr/share/lazarus/1.2.0' /usr/bin/make -C ide idepkg make[1]: Entering directory `/usr/share/lazarus/1.2.0/ide' /bin/mkdir -p ../units/i386-win32/win32 /bin/mkdir: cannot create directory `../units/i386-win32': Permission denied make[1]: *** [../units/i386-win32/win32] Error 1 Thanks. The debian packages do not support cross compiling the IDE. Why do you want that? Thank you.. I see. I am thinking that the (IDE) to get recompiled in order to support win32 objects. You can cross compile the packages, which the IDE does automatically when you cross compile your project. No need to use make manually. I see. Try to target win32 and now it works. Thank you for your help... Solved... Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus smime.p7s Description: S/MIME Cryptographic Signature -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TTimer woes (newbie)
On 31/03/2014 10:25, Michael Schnell wrote: On 03/31/2014 01:44 AM, Bob Axtell wrote: can someone show a newbie how to use the two system timers? What do you mean by system timers ? I think he means the TTimer and TIdleTimer found on the System page of the Component Palette. If you drop one of each on the main form of a new project with a label and a memo, and add this code, it should give you an idea of how to use them. -- code begin -- unit Unit1; {$mode objfpc}{$H+} interface uses SysUtils, Forms, ExtCtrls, StdCtrls; type { TForm1 } TForm1 = class(TForm) IdleTimer1: TIdleTimer; LAverageSoFar: TLabel; MNumbers: TMemo; Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure IdleTimer1Timer(Sender: TObject); procedure Timer1Timer(Sender: TObject); private FNumber: integer; FRunningTotal: integer; FCount: integer; end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin Randomize; MNumbers.Clear; Timer1.Interval:=500; Timer1.OnTimer:=@Timer1Timer; Timer1.Enabled:=True; IdleTimer1.Interval:=1000; IdleTimer1.OnTimer:=@IdleTimer1Timer; IdleTimer1.Enabled:=True; end; procedure TForm1.IdleTimer1Timer(Sender: TObject); begin LAverageSoFar.Caption:= Format('Average of random numbers so far is %n',[FRunningTotal/FCount]); end; procedure TForm1.Timer1Timer(Sender: TObject); begin FNumber:=Random(101); MNumbers.Lines.Add(IntToStr(FNumber)); Inc(FCount); Inc(FRunningTotal, FNumber); end; end. -- code end -- Howard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TTimer woes (newbie)
mine (a morse-code blinker) just doesn't work: unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls; type { TForm1 } TForm1 = class(TForm) Panel1: TPanel; Timer1: TTimer; procedure FormKeyPress(Sender: TObject; var Key: char); procedure Timer1Timer(Sender: TObject); private { private declarations } procedure morse; procedure dash; procedure dot; procedure wait(x: longint); { public declarations } end; var Form1: TForm1; a,b,i: byte; count,dat, ms,ls,mchar: byte; tick: integer; col: integer = clblue; mtbl: string[16] = #$bf#$be#$bc#$b8#$b0#$a0#$a1#$a3#$a7#$af#$42#$81#$85#$61#$20#$84; implementation {$R *.lfm} { TForm1 } procedure TForm1.Timer1Timer(Sender: TObject); begin timer1.enabled:= false; end; procedure TForm1.wait(x: longint); begin tick:= x; while tick 0 do begin timer1.enabled:= true; repeat until not timer1.enabled; dec(tick) end; end; procedure Tform1.dash; begin Panel1.color:= col; wait(30); Panel1.color:= clwhite; wait(10); end; procedure Tform1.dot; begin panel1.color:= col; wait(10); panel1.color:= clwhite; wait(10); end; procedure tform1.morse; begin mchar:= $33; ms:= ord(mtbl[succ((mchar shr 4) and 15)]); ls:= ord(mtbl[succ(mchar and 15)]); count:= (ms shr 5) and 7; dat:= ms and 31; for i:= 1 to count do begin if ((dat and 1) 0) then dash else dot; wait(10); dat:= dat shr 1; end; wait(50); { ms done, ls begins} count:= (ls shr 5) and 7; dat:= ls and 31; for i:= 1 to count do begin if ((dat and 1) 0) then dash else dot; wait(10); end; wait(100); end; procedure TForm1.FormKeyPress(Sender: TObject; var Key: char); begin case key of 'r': begin col:= clred; wait(15); end; 'g': begin col:= clgreen; wait(15); end; 'b': begin col:= clblue; wait(15); end; ' ': morse; end; end; end. any ideas? using v1.0.14 under WinXP. --Bob A On Mon, Mar 31, 2014 at 2:35 AM, Howard Page-Clark h...@talktalk.netwrote: On 31/03/2014 10:25, Michael Schnell wrote: On 03/31/2014 01:44 AM, Bob Axtell wrote: can someone show a newbie how to use the two system timers? What do you mean by system timers ? I think he means the TTimer and TIdleTimer found on the System page of the Component Palette. If you drop one of each on the main form of a new project with a label and a memo, and add this code, it should give you an idea of how to use them. -- code begin -- unit Unit1; {$mode objfpc}{$H+} interface uses SysUtils, Forms, ExtCtrls, StdCtrls; type { TForm1 } TForm1 = class(TForm) IdleTimer1: TIdleTimer; LAverageSoFar: TLabel; MNumbers: TMemo; Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure IdleTimer1Timer(Sender: TObject); procedure Timer1Timer(Sender: TObject); private FNumber: integer; FRunningTotal: integer; FCount: integer; end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin Randomize; MNumbers.Clear; Timer1.Interval:=500; Timer1.OnTimer:=@Timer1Timer; Timer1.Enabled:=True; IdleTimer1.Interval:=1000; IdleTimer1.OnTimer:=@IdleTimer1Timer; IdleTimer1.Enabled:=True; end; procedure TForm1.IdleTimer1Timer(Sender: TObject); begin LAverageSoFar.Caption:= Format('Average of random numbers so far is %n',[FRunningTotal/FCount]); end; procedure TForm1.Timer1Timer(Sender: TObject); begin FNumber:=Random(101); MNumbers.Lines.Add(IntToStr(FNumber)); Inc(FCount); Inc(FRunningTotal, FNumber); end; end. -- code end -- Howard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TTimer woes (newbie)
On Mon, Mar 31, 2014 at 2:24 PM, Bob Axtell bob.axt...@gmail.com wrote: mine (a morse-code blinker) just doesn't work: unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls; type { TForm1 } TForm1 = class(TForm) Panel1: TPanel; Timer1: TTimer; procedure FormKeyPress(Sender: TObject; var Key: char); procedure Timer1Timer(Sender: TObject); private { private declarations } procedure morse; procedure dash; procedure dot; procedure wait(x: longint); { public declarations } end; var Form1: TForm1; a,b,i: byte; count,dat, ms,ls,mchar: byte; tick: integer; col: integer = clblue; mtbl: string[16] = #$bf#$be#$bc#$b8#$b0#$a0#$a1#$a3#$a7#$af#$42#$81#$85#$61#$20#$84; implementation {$R *.lfm} { TForm1 } procedure TForm1.Timer1Timer(Sender: TObject); begin timer1.enabled:= false; end; procedure TForm1.wait(x: longint); begin tick:= x; while tick 0 do begin timer1.enabled:= true; repeat until not timer1.enabled; dec(tick) end; end; procedure Tform1.dash; begin Panel1.color:= col; wait(30); Panel1.color:= clwhite; wait(10); end; procedure Tform1.dot; begin panel1.color:= col; wait(10); panel1.color:= clwhite; wait(10); end; procedure tform1.morse; begin mchar:= $33; ms:= ord(mtbl[succ((mchar shr 4) and 15)]); ls:= ord(mtbl[succ(mchar and 15)]); count:= (ms shr 5) and 7; dat:= ms and 31; for i:= 1 to count do begin if ((dat and 1) 0) then dash else dot; wait(10); dat:= dat shr 1; end; wait(50); { ms done, ls begins} count:= (ls shr 5) and 7; dat:= ls and 31; for i:= 1 to count do begin if ((dat and 1) 0) then dash else dot; wait(10); end; wait(100); end; procedure TForm1.FormKeyPress(Sender: TObject; var Key: char); begin case key of 'r': begin col:= clred; wait(15); end; 'g': begin col:= clgreen; wait(15); end; 'b': begin col:= clblue; wait(15); end; ' ': morse; end; end; end. any ideas? using v1.0.14 under WinXP. --Bob A TTimer in Windows (and the basic timer support in Windows ) is implemented using window messages and you're not allowing the app to process messages inside your loop. I guess simply changing your loop to: +++ repeat Application.ProcessMessages; until not timer1.enabled; +++ should make it work. If it's no problem that your app freezes the UI during the wait (like it does right now) you could just use Sleep() and abandon TTimer. OTOH the usual way to use TTimer is to do processing in the OnTimer handler, but then you'd have to change your code to store some state. Regards, Flávio -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus