Fuente: https://www.tek-tips.com/viewthread.cfm?qid=503800
Adaptado para RBC.
package require rbc
rbc::vector create x(20)
rbc::vector create y(20)
x seq 1 20
y random
rbc::graph .g
pack .g -expand yes -fill both
.g element create data -xdata x -ydata y
toplevel .report -bg black
label .report.info -textvariable status -justify left -bg yellow
pack .report.info -padx 2 -pady 2
wm withdraw .report
wm overrideredirect .report 1
.g element bind data {
if {[.g element closest %x %y click]} {
set status "Clicked on \"$click(name)\" element\n"
append status "Data point $click(index)\n"
append status "x value: $click(x), y value $click(y)"
wm geometry .report +%X+%Y
wm deiconify .report
}
}
.g element bind data {
wm withdraw .report
}
Adaptado para RBC.
package require rbc
rbc::vector create x(20)
rbc::vector create y(20)
x seq 1 20
y random
rbc::graph .g
pack .g -expand yes -fill both
.g element create data -xdata x -ydata y
toplevel .report -bg black
label .report.info -textvariable status -justify left -bg yellow
pack .report.info -padx 2 -pady 2
wm withdraw .report
wm overrideredirect .report 1
.g element bind data
if {[.g element closest %x %y click]} {
set status "Clicked on \"$click(name)\" element\n"
append status "Data point $click(index)\n"
append status "x value: $click(x), y value $click(y)"
wm geometry .report +%X+%Y
wm deiconify .report
}
}
.g element bind data
wm withdraw .report
}
No comments:
Post a Comment