Recent

Author Topic: [SOLVED] TAChart - lineColor - what property to use  (Read 3909 times)

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: TAChart - lineColor - what property to use
« Reply #15 on: August 07, 2020, 11:53:56 pm »
Now I found the missing piece: it is clipping. Series are drawn within a clipped rectangle. And when I activate Canvas.Clipping in my simple demo the clipped line turns into black and - even more - forgets the line width and the pen style. Of course, cocoa only, win32 is fine.

[EDIT]
Bugreport submitted: https://bugs.freepascal.org/view.php?id=37520

« Last Edit: August 08, 2020, 11:13:31 am by wp »

bnl

  • New Member
  • *
  • Posts: 15
Re: TAChart - lineColor - what property to use
« Reply #16 on: August 08, 2020, 12:07:29 am »
Yes , when I click the clipping checkbox, the red dotted line turns into a (shorter) black line

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: [SOLVED/Work-around] TAChart - lineColor - what property to use
« Reply #17 on: August 09, 2020, 03:20:32 pm »
The clippling bug in the cocoa canvas has been fixed by Dmitry. In my own tests, series color selection should work now in cocoa. Please test yourself and report back.

Note: you need Lazarus trunk to get the fix. Alternatively - without warranty - you could do this:
  • Open cocoagdiobject.pas in folder lcl/interfaces/cocoa of your Lazarus installation  and find procedure TCocoaContext.ClearClipping.
  • At the end of the "if" block insert the lines "if Assigned(FPen) then FPen.Apply(Self)" and "if Assigned(FBrush) then FBrush.Apply(Self)".
  • The entire procedure should be as follows. Afterwards rebuild the IDE.
Code: Pascal  [Select][+][-]
  1. procedure TCocoaContext.ClearClipping;
  2. var
  3.   Trans: CGAffineTransform;
  4.   cgc: CGContextRef;
  5. begin
  6.   if FClipped then
  7.   begin
  8.     cgc := CGContext();
  9.     Trans := CGContextGetCTM(cgc);
  10.     CGContextRestoreGState(cgc);
  11.     ApplyTransform(Trans);
  12.     if Assigned(FPen) then FPen.Apply(Self);      // <----- INSERTED
  13.     if Assigned(FBrush) then FBrush.Apply(Self);  // <----- INSERTED
  14.   end;
  15. end;
As I said -- I cannot give a guarantee that this change does not depend on other changes missing. So, please make a backup copy of the modified file so that you can restore the old state in case Lazarus does not compile.

bnl

  • New Member
  • *
  • Posts: 15
Re: [SOLVED/Work-around] TAChart - lineColor - what property to use
« Reply #18 on: August 09, 2020, 09:57:03 pm »
Quote
Note: you need Lazarus trunk to get the fix. Alternatively - without warranty - you could do this:
...
Afterwards rebuild the IDE.

Hmm, I'll need to do some reading up on details for that. I think I got Lazarus/fpc installed via macports.
I'm on vacation now, I hope to get to my dev computer during next week

/Björn

bnl

  • New Member
  • *
  • Posts: 15
Re: [SOLVED] TAChart - lineColor - what property to use
« Reply #19 on: August 11, 2020, 05:13:16 pm »
So I found fpcupdeluxe, and downloaded/compiled trunk of Lazarus and fpc.
It works as expected now, I get colors as I want.
Thanks
/Björn

 

TinyPortal © 2005-2018