Forum > TAChart

how to bring marks to front

<< < (2/2)

wp:

--- Quote from: Muso on July 27, 2022, 11:28:14 pm ---I gave this a try but get a crash when I try to access the Z-order see attached screenshot.
Is this a bug in the tool or do I have to do something special?

--- End quote ---
I don't know. Of course I tested the idea, and it is working for my sample project - see attachment (which contains the Z-Order code in both DatapointMarkClick- and DatapointHintTools, i.e. reacts on moving the mouse over the data points/connecting lines and on clicking on the mark labels).

Muso:

--- Quote from: wp on July 27, 2022, 11:47:35 pm ---I don't know. Of course I tested the idea, and it is working for my sample project

--- End quote ---

OK, my mistake, I used your code inside of


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---DataPointMarksClickToolBeforeMouseDown(ATool:...But since I use the tool as

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---tool:= ATool as TDatapointMarksClickTool;this cannot work.

However, I fixed this and implemented the z.order change code to a DataPintHintTool.

I debugged ans see that all my TLineSeries have the ZPosition 0.

I thought, OK, I set the current series to 0, the other visible ones to 1. But this made the other ones painted on top. Instead I have to paint my series in z-order 1, the others at 0.
Here is my final solution:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var currentSeries, otherSeries : TBasicChartSeries; i : integer;begin otherSeries:= nil; currentSeries:= ATool.Series;  for i:= 0 to MainForm.SIXCH.SeriesCount - 1 do begin  if (MainForm.SIXCH.Series[i] is TLineSeries)   and (MainForm.SIXCH.Series[i].Active)   then  begin   otherSeries:= MainForm.SIXCH.Series[i];   if currentSeries <> otherSeries then    otherSeries.ZPosition:= 0;  end; end; // repaint chart if necessary if currentSeries.ZPosition < 1 then begin  currentSeries.ZPosition:= 1;  MainForm.SIXCH.Invalidate; end;
So there is a bug in the description of ZPosition, because it says, that to bring a series to front one should set it to 0.

wp:

--- Quote from: Muso on July 28, 2022, 07:34:18 pm ---So there is a bug in the description of ZPosition, because it says, that to bring a series to front one should set it to 0.

--- End quote ---
Where is that? I did not find such a statement in https://wiki.lazarus.freepascal.org/TAChart_documentation

Muso:

--- Quote from: wp on July 28, 2022, 11:24:47 pm ---Where is that? I did not find such a statement in https://wiki.lazarus.freepascal.org/TAChart_documentation

--- End quote ---
In the tooltip, see attached.
------------------------
Again many thanks for the marks click tool!

As final feedback:
- I miss a hover event. When the users moves the mouse over the mark area, the cursor should be changeable and it should also be possible to show then a tooltip with custom content.

- marks should have the feature to display one e.g. the first 3 words of its content, the rest as tooltip, as I described.

Navigation

[0] Message Index

[*] Previous page

Go to full version