I've found several posts that explain how to display the correct custom mark positions when zooming or scrolling a chart. For example:
http://www.teechart.net/support/viewtop ... =3&t=15468
In this post and any others related to custom mark position updating, the answer seems to depend on using TChart's zoom and scroll by mouse feature. My users wanted a more standard interface, so we have attached a tscrollbar - we don't use the mouse at all. So the marks do not get repositioned correctly because XScrollPos and YScrollPos are not correct. Likewise, when a chart is resized, there is no mouse click involved, and so the marks do not update correctly.
In my case, I think I need to somehow keep track of the logical positions of all the custom marks, and update marks OnResize and OnScrollBarChange. Can you suggest some code to help me accomplish this?
Retain custom mark positions on chart resize or tscrollbar
Re: Retain custom mark positions on chart resize or tscrollbar
Hello,
In the example you linked, there is a method named PlaceMarks, responsible of repositioning the marks at their correct positions. This method is called at the events being fired on the actions you noted, like zoom and scroll.
In your case, you need to call that method in the the OnResize and OnScrollBarChange events. Have you tried it?
If you find any problem with it, please try to arrange a simple example project we can run as-is to reproduce the situation here.
In the example you linked, there is a method named PlaceMarks, responsible of repositioning the marks at their correct positions. This method is called at the events being fired on the actions you noted, like zoom and scroll.
In your case, you need to call that method in the the OnResize and OnScrollBarChange events. Have you tried it?
If you find any problem with it, please try to arrange a simple example project we can run as-is to reproduce the situation here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Retain custom mark positions on chart resize or tscrollbar
I have tried it, and when you resize the form, the marks don't move, while the rest of the chart resizes. This is because all values in the XOffset and YOffset arrays are still zero; there have been no mouse clicks.
We are currently using TeeChart Pro v8.08. I tried the attached example in version 2014, and it does work there. We are moving towards a more current version, but aren't able to use it until some other upgrade issues are resolved. Is there a simple fix to make version 8 work?
We are currently using TeeChart Pro v8.08. I tried the attached example in version 2014, and it does work there. We are moving towards a more current version, but aren't able to use it until some other upgrade issues are resolved. Is there a simple fix to make version 8 work?
- Attachments
-
- TChart_drag_marks8.zip
- (2.45 KiB) Downloaded 748 times
Re: Retain custom mark positions on chart resize or tscrollbar
Hello,
Your project seems to work fine for me with Delphi 7 and TeeChart 8.08.
I only added this code to make sure I'm using the correct TeeChart version:
Your project seems to work fine for me with Delphi 7 and TeeChart 8.08.
I only added this code to make sure I'm using the correct TeeChart version:
Code: Select all
uses TeeConst;
Caption:=TeeMsg_Version;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Retain custom mark positions on chart resize or tscrollbar
Hmm. Turns out I was using 8.06, but even after I installed 8.08, the resize doesn't work. After the install, my paths all appear to point to 8.08. I am using D2010, not D7. It seems unlikely that is the source of the problem, but I don't know what else?
- Attachments
-
- Resize problem on 8.08e.PNG (31.18 KiB) Viewed 13452 times
Re: Retain custom mark positions on chart resize or tscrollbar
Hello,
Have you added a breakpoint into the PlaceMarks method to check if it's executed when you resize the window?
I've tried it with RAD XE and TeeChart Pro v8.08 (source code version) and it also works fine for me.kkar wrote:I am using D2010, not D7. It seems unlikely that is the source of the problem, but I don't know what else?
Have you added a breakpoint into the PlaceMarks method to check if it's executed when you resize the window?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Retain custom mark positions on chart resize or tscrollbar
I stepped away from the problem until we were able to upgrade to TChart v2017.22.170619, where the Resize retains the correct "stock" mark positions. But it still doesn't retain custom mark positions correctly. The TScrollbar also does not handle custom mark positions correctly. The mark still attaches to the correct point, but the mark label does not retain the correct relative position. Each scroll makes the position worse.
I understand I need to update the mark position, but I don't understand how to do it using the scrollbar. Attached is my updated sample project.
I understand I need to update the mark position, but I don't understand how to do it using the scrollbar. Attached is my updated sample project.
- Attachments
-
- TChart_drag_marks_scrollbar.zip
- (2.63 KiB) Downloaded 755 times
Re: Retain custom mark positions on chart resize or tscrollbar
Hello,
I've modified the project to make the marks to work fine both with the ScrollBar, and with the builtin zoom and scroll features:
I've modified the project to make the marks to work fine both with the ScrollBar, and with the builtin zoom and scroll features:
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |