Recent

Author Topic: [SOLVED] Troubles with TDataPointDragTool  (Read 698 times)

CM630

  • Hero Member
  • *****
  • Posts: 922
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
[SOLVED] Troubles with TDataPointDragTool
« on: October 02, 2020, 08:40:12 pm »
I am trying to fix a bug in a component that I have started to write... 6 or 7 years ago, I have stopped woring on it 5 years ago, at least.
Well, I tried to create a snippet, but I cannot make TDataPointDragTool work in a standalone component.
I tried the ..\lazarus\components\tachart\demo\tools.
Dragging works for the two vertical bars, but it does not work for the Chart1FuncSeries1 (I expect that should be able to move its points).
I have set the AffectedSered of ChartToolset1DataPointDragTool1 to 0,1,2,3 (it was 2,3).
What else should I do?
« Last Edit: October 04, 2020, 04:37:40 pm by CM630 »
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

wp

  • Hero Member
  • *****
  • Posts: 7958
Re: Troubles with TDataPointDragTool
« Reply #1 on: October 02, 2020, 09:58:21 pm »
ChartFuncSeries1? No, you cannot drag its points, in fact, it does not even have points, it is defined by a function defined by an event handler.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

CM630

  • Hero Member
  • *****
  • Posts: 922
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Troubles with TDataPointDragTool
« Reply #2 on: October 04, 2020, 10:34:02 am »

Okay, I did:


Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   myLineSeries:= TLineSeries.Create(Chart1) ;
  4.   myLineSeries.ShowPoints := True;
  5.   myLineSeries.AddXY (0,-0.5);
  6.   chart1.AddSeries(myLineSeries);
  7.   ChartToolset1DataPointDragTool1.AffectedSeries := ChartToolset1DataPointDragTool1.AffectedSeries + '0,1,2,3,4,5';
  8. end;  
Now I can move the quadrangle, drawn and teh single point of MySeries.


But besides that, sth. seems wrong- I have tried to add a LineSeries in the GUI mode- the series was shown, but when I run the app it is gone. (Laz ver etc are in my signature)/.
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

wp

  • Hero Member
  • *****
  • Posts: 7958
Re: [SOLVED] Troubles with TDataPointDragTool
« Reply #3 on: October 04, 2020, 06:55:27 pm »
Did you add data points to the series? Normally you must do this at runtime (even if the series is created at designtime -- ok, you could use a TListChartSource where you can enter values in the DataPoints property at designtime).
« Last Edit: October 05, 2020, 12:02:21 am by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

CM630

  • Hero Member
  • *****
  • Posts: 922
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: [SOLVED] Troubles with TDataPointDragTool
« Reply #4 on: October 07, 2020, 10:29:16 am »
Maybe the image will expain it better than words:
On the left: what is shown in the IDE.
On the right : what happens when the app is executed.


Edit: I have just found sth. odd: When I save and close the project and reload it- the values in the DataPoints are lost!
No surprise that they are not shown if the compiler does not see them them saved.
« Last Edit: October 07, 2020, 10:37:45 am by CM630 »
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

wp

  • Hero Member
  • *****
  • Posts: 7958
Re: [SOLVED] Troubles with TDataPointDragTool
« Reply #5 on: October 07, 2020, 05:42:33 pm »
In fact, I never used the interal listchartsource of a series for this purpose. I guess the built-in source is not prepared for it, or maybe there is a Clear somewhere. Debugging designtime code is always hard stuff, so I am not very much motivated to begin...

What you can do is to add a separate TListChartSource to the form, attach it to the LineSeries.Source, and add values to the DataPoints property like you did with the internal ListChartSource. This works, for sure -- see attachment.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

CM630

  • Hero Member
  • *****
  • Posts: 922
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: [SOLVED] Troubles with TDataPointDragTool
« Reply #6 on: October 09, 2020, 02:26:01 pm »
Generally I do not use the design time editor for TAChart, I just wanted to execute some simple snippet for sth. more complex, which I have succeeded to fix.
But since you confirm that this is a bug, I will try to create a report for it, in case that its time comes, or rather to know that this is not working.
« Last Edit: October 09, 2020, 02:28:37 pm by CM630 »
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

wp

  • Hero Member
  • *****
  • Posts: 7958
Re: [SOLVED] Troubles with TDataPointDragTool
« Reply #7 on: October 09, 2020, 03:54:09 pm »
But since you confirm that this is a bug, I will try to create a report for it, in case that its time comes, or rather to know that this is not working.
Good idea. Assign it to me. Add a demo project and link also to this discussion.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

CM630

  • Hero Member
  • *****
  • Posts: 922
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: [SOLVED] Troubles with TDataPointDragTool
« Reply #8 on: October 09, 2020, 11:32:21 pm »
https://bugs.freepascal.org/view.php?id=37904
I am not sure, that I can assign bugs, currently it is unassigned.
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

 

TinyPortal © 2005-2018