Recent

Author Topic: [Solved] Marks color in TaChart not consistents in Cocoa  (Read 4592 times)

AL

  • Sr. Member
  • ****
  • Posts: 264
[Solved] Marks color in TaChart not consistents in Cocoa
« on: March 10, 2020, 12:11:14 am »
I am using Toolset to show Data point labels in a tachart.
This works fine in Windows.
There is a little bug or mis-use on my side.
Also I am runing this on a VM machine running Mojave, this might be the problem, I do not know.
The first mark shown is the right color.  The second, third, et.  are black on white.
The funny thing is that if you remove the first one then the second one turns of the right color!  It is like the color is applied only to the first point of the curve.

If somebody with a real Mac could confirm this, that would be great.
I have modified the demo project supplied with TaChart to demonstrate.

A second problem:
Also on this same form I have added a ttogglebox.  In windows it works fine and write its status in the label at the bottom of the form.  In Darwin it does not.
« Last Edit: August 26, 2020, 05:32:44 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

nsl

  • New Member
  • *
  • Posts: 16
Re: Marks color in TaChart not consistents in Cocoa
« Reply #1 on: March 10, 2020, 02:15:33 pm »
Not sure what to expect for point colours. Screenshot included.
I had to change the control alignments to alNone so that the tabs were not hidden by the chart.

With a breakpoint on the TMainForm.ToggleBox1Change function this did not get called when the togglebox was clicked. An OnClick handler was also not called. Looks like could be a bug.
Lazarus 2.1 on Windows 10 / macOS Mojave

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Marks color in TaChart not consistents in Cocoa
« Reply #2 on: March 10, 2020, 02:32:03 pm »
if you alt-click on a point it shows the marks.  The first is yellow as it should the others are white.
Thanks for confirming the togglebox problem
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

nsl

  • New Member
  • *
  • Posts: 16
Re: Marks color in TaChart not consistents in Cocoa
« Reply #3 on: March 10, 2020, 03:28:41 pm »
Yes, I can confirm that the marks are not drawn correctly. See screenshot.
Lazarus 2.1 on Windows 10 / macOS Mojave

wp

  • Hero Member
  • *****
  • Posts: 13275
Re: Marks color in TaChart not consistents in Cocoa
« Reply #4 on: March 10, 2020, 03:44:49 pm »
It took me some time until I understood what the problem is. Here is a simpler demo. It just draws a random line series with data point labels. On Windows all the labels have a yellow background color - that's how it should be. On macOS only the left-most label is yellow, the others have a transparent background, the brush style seems to be bsClear.

The demo also contains a checkbox to activate the background of the axis labels which are drawn by a similar routine. When this is active the series labels take the color of the y axis label background. And when the y axis is hidden (use the other checkbox) the series labels have the background color of the x axis labels!

So, Cocoa draws the series marks with the previously used brush (the axes Marks.LabelBrush has Style bsClear by default)

Smells like a bug in TAChart...

[EDIT]
I added debugging output to TAChart and found that the brush properties have values as expected. Smells like a bug in Cocoa now...
« Last Edit: March 10, 2020, 04:00:47 pm by wp »

wp

  • Hero Member
  • *****
  • Posts: 13275
Re: Marks color in TaChart not consistents in Cocoa
« Reply #5 on: March 10, 2020, 08:31:41 pm »
Cocoa seems to have an issue with polygons. TAChart paints the label background as a polygon, but when I replace it by a rectangle (Canvas.Rectangle) everything works fine.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Marks color in TaChart not consistents in Cocoa
« Reply #6 on: March 18, 2020, 10:18:28 pm »

I found a workaround way to the TtoggleBox bug.

The onchange and onclick events do not work.
But the OnmouseUp and OnMouseDown do work.
The Property Checked is also updated.
SO instead of using OnChange I use onMouseUp and verify the checked property or the cbstate property.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: Marks color in TaChart not consistents in Cocoa
« Reply #7 on: March 19, 2020, 11:23:28 pm »
Please log a bug in the bug tracker so it can be fixed and add a link to this thread.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Marks color in TaChart not consistents in Cocoa
« Reply #8 on: March 19, 2020, 11:42:31 pm »
Done for ttoglebox:  0036812

I assume WP will take care of the TaChart color bug/problem.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 13275
Re: Marks color in TaChart not consistents in Cocoa
« Reply #9 on: March 20, 2020, 12:08:20 am »
I assume WP will take care of the TaChart color bug/problem.
Yes. But I am sure that this is not related to TAChart, but is a consequence of a deeper problem within the Cocoa widgetset, and I don't find a simple way to reproduce it outside TAChart...

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Marks color in TaChart not consistents in Cocoa
« Reply #10 on: March 23, 2020, 02:33:18 pm »
Done for ttoglebox:  0036812

The bug is reported as fixed in 62776
How do I easily get the revision without disturbing my setup.
I have FPCupDeluxe installed.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 13275
Re: Marks color in TaChart not consistents in Cocoa
« Reply #11 on: March 23, 2020, 04:58:26 pm »
Since you already have FPCUpdate, use it to install the current Laz-trunk to a different directory? This leaves your first installation alone.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Marks color in TaChart not consistents in Cocoa
« Reply #12 on: March 23, 2020, 07:36:28 pm »
I did not follow you advice.  Too bad for me!|
I update my Darwin version of lazarus trunk only and kept my fpc 3.3.1.
At least I have my Win10 Lazarus which is OK.

Got the error:
fpcupdeluxe: Start of compile error summary.
Error: (lazbuild) Broken dependency: IDEIntf 1.0->BuildIntf
fpcupdeluxe: Start of compile error summary.
fpcupdeluxe: ERROR: LazarusNativeInstaller (BuildModuleCustom: UserIDE): make returned error code #512
fpcupdeluxe: Done !!

Any idea what can cause this?

Edit:  Reverting to ver 2.1.0 give the same error!
« Last Edit: March 23, 2020, 09:44:57 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Marks color in TaChart not consistents in Cocoa
« Reply #13 on: April 15, 2020, 04:47:39 am »
I assume WP will take care of the TaChart color bug/problem.
Yes. But I am sure that this is not related to TAChart, but is a consequence of a deeper problem within the Cocoa widgetset, and I don't find a simple way to reproduce it outside TAChart...


FYI
To solve my problem I did the following in form create:
{$ IFDEF DARWIN}    // windows version keep original color.
Set the mark.frame to yellow
Set the brush.color to None
Set the brush.style to BSclear
Set the mark.labelfont to white  (my chart background is black)
This produce a  consistent label (mark) that does not change color.
So it seems that only the brush color and/or background is affected by the problem.



Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 13275
Re: Marks color in TaChart not consistents in Cocoa
« Reply #14 on: August 09, 2020, 03:11:50 pm »
Returning to this old thread I want to tell you that the root cause in the cocoa canvas has been fixed by Dmitry (r63702). According to my own tests, your issue should be fixed now. Please test yourself.

 

TinyPortal © 2005-2018