Recent

Author Topic: [Solved] selecting chart data like with the Zoom Drag Tool  (Read 14857 times)

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: selecting chart data like with the Zoom Drag Tool
« Reply #15 on: June 25, 2021, 04:51:42 pm »
The TChartListbox has an event OnAddSeries in which you can set the boolean argument ASkip to true to prevent adding a series. In my example this is already used to remove the constant lines from the ChartListBox

I already use OnAddSeries  to skip some unwanted series. however, in my applications, there can be up to 8 series. The user decides at runtime what series is active. So in case he uses 4 series, only these 4 active series should be listed in ChartListBox.
is this possible?

- I have several series and some are not active. Therefore they don't appear in the legend. But when I now start the data selection mode they all appear in the legend. When I leave the selection mode the legend looks fine again. So how can i keep the legend untouched while being in selection mode.
Quote
I don't know what you are doing. Please try to reduce your project to a minimum level and post it here.

It it is attached. I also attached a screencast to show the problem: when you activate the measurement, the legend suddenly shows series that are purposely not shown in the legend.

Quote
- your solution allows to drag the TConstantLines. The problem is that the user is not aware of that feature. So what I want is that when the mouse is over a TConstantLine, the cursor changes to crSizeNS or crSizeWE, respectively. Is that possible?
I know of this limitation, but don't see a simple way to fix it (I myself did not write this part of TAChart).

OK.
« Last Edit: July 04, 2021, 11:40:33 pm by Muso »

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: selecting chart data like with the Zoom Drag Tool
« Reply #16 on: June 25, 2021, 04:56:40 pm »
It it is attached. I also attached a screencast to show the problem: when you activate the measurement, the legend suddenly shows series that are purposely not shown in the legend.

OK, I could fix this. The CustomLines had the property to be shown in the legend but since they were not active they were not shown. When I started the measurement in my example program, the lines became active.

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: selecting chart data like with the Zoom Drag Tool
« Reply #17 on: June 25, 2021, 05:30:34 pm »
It it is attached. I also attached a screencast to show the problem: when you activate the measurement, the legend suddenly shows series that are purposely not shown in the legend.

OK, I could fix this. The CustomLines had the property to be shown in the legend but since they were not active they were not shown. When I started the measurement in my example program, the lines became active.
Yes, sorry for my fault.

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: selecting chart data like with the Zoom Drag Tool
« Reply #18 on: June 25, 2021, 05:32:40 pm »
I already use OnAddSeries  to skip some unwanted series. however, in my applications, there can be up to 8 series. The user decides at runtime what series is active. So in case he uses 4 series, only these 4 active series should be listed in ChartListBox.
is this possible?

OK, I found a way for this as well. by debugging I found out that every time a data point is added OnAddSeries is triggered and this way I can skip the non-active series.

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: [Solved] selecting chart data like with the Zoom Drag Tool
« Reply #19 on: July 06, 2021, 05:14:08 pm »
Note, that the solution presented by me fails when one adds an autoScale axis transformation. So one needs to map the lines positions on the axis transformation.

But how can this be done?

Code: Pascal  [Select][+][-]
  1. y1:= Min(TopLine.Position, BottomLine.Position);

Has now always values between 0 and 1. But how can i determine what 1 is as real value - so I need to know what value is currently the maximal displayed value if the axis.
« Last Edit: July 06, 2021, 05:42:11 pm by Muso »

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: [Solved] selecting chart data like with the Zoom Drag Tool
« Reply #20 on: July 06, 2021, 05:41:57 pm »
But how can this be done?

Googling gave me the solution: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-TAChart-DataPointCrossHairTool-td4038622.html

so the code is

Code: Pascal  [Select][+][-]
  1. y1:= Min(TopLine.Position, BottomLine.Position);
  2. y1:= Chart1.LeftAxis.GetTransform.GraphToAxis(y1);

 

TinyPortal © 2005-2018