| Ticket UUID: | 6812273b4db845b2374e9cb977cf352f96aa4863 | |||
| Title: | Plotchart "bindplot" not sensitive when cursor is over data/lines | |||
| Type: | Bug | Version: | 0.6 | |
| Submitter: | anonymous | Created on: | 2014-09-05 23:14:45 | |
| Subsystem: | tklib :: plotchart | Assigned To: | arjenmarkus | |
| Priority: | 7 High | Severity: | Critical | |
| Status: | Open | Last Modified: | 2026-11-16 17:17:33 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
When using an xyplot in plotchart and trying to make use of 'bindplot' to get the coordinate X,Y values in a convenient callback, I notice that the callback does not execute if the cursor is over data (lines and dot symbols in my case) but it does work as expected in the empty parts of the plot. A fix (or workaround) would be much appreciated. | |||
| User Comments: |
serhiy.storchaka added on 2026-11-16 17:17:33:
Proposed fix in branch plotchart-bindplot-over-data. The event was bound to an invisible rectangle below all other items. Now it is bound to the canvas, and the command is called only when the pointer is inside the plot area. Bindings of items (bindlast, dragging the legend) still work. <Enter> and <Leave> now refer to the canvas instead of the plot area. anonymous added on 2024-09-27 10:15:58: I run into the same problem both in version 2.4.1 and 2.6.2. Consider this script:
# puts "Plotchart version = [package require -exact Plotchart 2.4.1]"
puts "Plotchart version = [package require -exact Plotchart 2.6.2]"
canvas .c; pack .c
proc callback {args} {puts "bindplot is working"}
set myplot [Plotchart::createXYPlot .c [list 0 10 2] [list 0 10 2]]
$myplot background gradient \#78baff bottom-up
$myplot bindplot <ButtonPress-1> callback
When run with Plotchart 2.4.1, the callback works only when the background gradient is commented out in the code above, i.e. it is not drawn
When run with Plotchart 2.6.2, the callback works regardless the background, because the background does not draw anymore. The latter phenomenon is due to a change in plotannot.tcl (::Plotchart::DrawGradientBackground) leading to the `nmax` variable being negative. Consequently the background is never drawn and the callback works.
Apart from the problem in ::Plotchart::DrawGradientBackground I think the general problem with `bindplot` is that the invisible rectangle receiving the event from the mouse is lowered in the canvas (proc ::Plotchart::BindPlot in plotbind.tcl):
$w lower $scaling($w,eventobj)
Therefor the callback doesn't work when clicking on data symbols or the backgound. It only works when clicking on empty space inside the plot where the invisible rectangle for the event "shines through".
It would be good when the callback works regardless of other plot objects being above.
I took the freedom to raise the priority of this ticket as I would like to see this fixed (could do it myself but don't have the time right now - probably it's not complicated)
| |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki