Changeset 1644 for branches/blt4/gui/scripts/xyresult.tcl
- Timestamp:
- Jan 27, 2010, 8:41:20 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/xyresult.tcl
r1643 r1644 166 166 -rightmargin 10 167 167 } { 168 keep - background -foreground -cursor -font168 keep -foreground -cursor -font 169 169 } 170 170 pack $itk_component(plot) -expand yes -fill both … … 252 252 after idle [subst { 253 253 update idletasks 254 #$itk_component(legend) reset254 $itk_component(legend) reset 255 255 }] 256 256 … … 601 601 eval $g element delete [$g element names] 602 602 foreach axis [$g axis names] { 603 $g axis configure $axis -hide yes -checklimits no 603 $g axis configure $axis -hide yes -checklimits no \ 604 -activeforeground blue 604 605 } 605 606 # Presumably you want at least an X-axis and Y-axis displayed. … … 667 668 $g axis bind $axis <Leave> \ 668 669 [itcl::code $this _axis hilite $axis off] 669 $g axis bind $axis <ButtonPress > \670 $g axis bind $axis <ButtonPress-1> \ 670 671 [itcl::code $this _axis click $axis %x %y] 671 672 $g axis bind $axis <B1-Motion> \ 672 673 [itcl::code $this _axis drag $axis %x %y] 673 $g axis bind $axis <ButtonRelease > \674 $g axis bind $axis <ButtonRelease-1> \ 674 675 [itcl::code $this _axis release $axis %x %y] 675 676 $g axis bind $axis <KeyPress> \ … … 907 908 set tip "" 908 909 if {$state == "at"} { 909 if {[$g element closest $x $y info -interpolate yes]} { 910 set results [$g element closest $x $y -interpolate yes] 911 if { $results != "" } { 912 array set info $results 910 913 # for dealing with xy line plots 911 914 set elem $info(name) … … 922 925 set tip "" 923 926 array unset info 924 if {[$g element closest $x $y info -interpolate no] 925 && $info(name) == $elem} { 927 set results [$g element closest $x $y -interpolate no] 928 array set info $results 929 if { [info exists info(name)] && $info(name) == $elem } { 926 930 927 931 set x [$g axis transform $mapx $info(x)] … … 944 948 } 945 949 set state 1 946 } elseif {[$g element closest $x $y info -interpolate no]} { 947 # for dealing with xy scatter plot 948 set elem $info(name) 949 950 # Some elements are generated dynamically and therefore will 951 # not have a curve object associated with them. 952 set mapx [$g element cget $elem -mapx] 953 set mapy [$g element cget $elem -mapy] 954 if {[info exists _elem2curve($elem)]} { 955 foreach {mapx mapy} [_getAxes $_elem2curve($elem)] break 956 } 957 958 set tip "" 959 set x [$g axis transform $mapx $info(x)] 960 set y [$g axis transform $mapy $info(y)] 950 } else { 951 set results [$g element closest $x $y -interpolate no] 952 if { $results != "" } { 953 array unset info 954 array set info $results 955 # for dealing with xy scatter plot 956 set elem $info(name) 957 958 # Some elements are generated dynamically and therefore will 959 # not have a curve object associated with them. 960 set mapx [$g element cget $elem -mapx] 961 set mapy [$g element cget $elem -mapy] 962 if {[info exists _elem2curve($elem)]} { 963 foreach {mapx mapy} [_getAxes $_elem2curve($elem)] break 964 } 965 966 set tip "" 967 set x [$g axis transform $mapx $info(x)] 968 set y [$g axis transform $mapy $info(y)] 961 969 962 if {[info exists _elem2curve($elem)]} { 963 set curve $_elem2curve($elem) 964 set yunits [$curve hints yunits] 965 set xunits [$curve hints xunits] 966 } else { 967 set xunits "" 968 set yunits "" 969 } 970 set tip [$g element cget $elem -label] 971 set yval [_axis format y dummy $info(y)] 972 append tip "\n$yval$yunits" 973 set xval [_axis format x dummy $info(x)] 974 append tip " @ $xval$xunits" 975 set tip [string trim $tip] 976 set state 1 977 } else { 978 set state 0 979 } 970 if {[info exists _elem2curve($elem)]} { 971 set curve $_elem2curve($elem) 972 set yunits [$curve hints yunits] 973 set xunits [$curve hints xunits] 974 } else { 975 set xunits "" 976 set yunits "" 977 } 978 set tip [$g element cget $elem -label] 979 set yval [_axis format y dummy $info(y)] 980 append tip "\n$yval$yunits" 981 set xval [_axis format x dummy $info(x)] 982 append tip " @ $xval$xunits" 983 set tip [string trim $tip] 984 set state 1 985 } else { 986 set state 0 987 } 988 } 980 989 } 981 990 … … 1118 1127 itcl::body Rappture::XyResult::_axis {option args} { 1119 1128 set inner [$itk_component(hull).axes component inner] 1120 1121 1129 switch -- $option { 1122 1130 hilite { … … 1129 1137 1130 1138 if {$state} { 1131 $g axis configure $axis \ 1132 -color $itk_option(-activecolor) \ 1133 -titlecolor $itk_option(-activecolor) 1134 1139 $g axis activate $axis 1140 update 1135 1141 set x [expr {[winfo pointerx $g]+4}] 1136 1142 set y [expr {[winfo pointery $g]+4}] 1137 1143 Rappture::Tooltip::tooltip pending $g-$axis @$x,$y 1138 1144 } else { 1139 $g axis configure $axis \ 1140 -color $itk_option(-foreground) \ 1141 -titlecolor $itk_option(-foreground) 1145 $g axis deactivate $axis 1146 update 1142 1147 Rappture::Tooltip::tooltip cancel 1143 1148 } … … 1553 1558 # ---------------------------------------------------------------------- 1554 1559 itcl::configbody Rappture::XyResult::gridcolor { 1555 if { "" == $itk_option(-gridcolor)} {1560 if { "" == $itk_option(-gridcolor) } { 1556 1561 foreach axis [$itk_component(plot) axis names] { 1557 $itk_component(plot) axis configure -grid off1562 $itk_component(plot) axis configure $axis -grid off 1558 1563 } 1559 1564 } else { 1560 1565 foreach axis [$itk_component(plot) axis names] { 1561 $itk_component(plot) axis configure \1566 $itk_component(plot) axis configure $axis \ 1562 1567 -gridcolor $itk_option(-gridcolor) -grid on 1563 1568 }
Note: See TracChangeset
for help on using the changeset viewer.