Changeset 4006 for branches/1.3/gui/scripts/xyresult.tcl
- Timestamp:
- Oct 9, 2013, 9:27:32 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3/gui/scripts/xyresult.tcl
r3908 r4006 173 173 itk_component add plot { 174 174 blt::graph $f.plot \ 175 -highlightthickness 0 -plotpadx 0 -plotpady 4 \ 176 -rightmargin 10 175 -highlightthickness 0 -plotpadx 0 -plotpady 4 177 176 } { 178 177 keep -background -foreground -cursor -font … … 277 276 } 278 277 set type [$dataobj hints type] 278 279 279 foreach cname [$dataobj components] { 280 280 set tag $dataobj-$cname … … 283 283 "bar" { 284 284 $g bar configure $elem -foreground $color -background $color \ 285 -hide no 285 -hide no 286 286 } 287 287 "scatter" { 288 $g line configure $elem -color $color -hide no 288 $g line configure $elem -color $color -hide no 289 289 } 290 290 default { 291 291 $g line configure $elem -color $color -hide no \ 292 -linewidth $linewidth 292 -linewidth $linewidth 293 293 } 294 294 } … … 524 524 $g marker configure $id -element $elem 525 525 $g marker bind $id <Enter> \ 526 [itcl::code $this EnterMarker $g y-$label $at $xmin $at]526 [itcl::code $this EnterMarker $g $label $at $xmin $at] 527 527 $g marker bind $id <Leave> \ 528 [itcl::code $this LeaveMarker $g y-$label]528 [itcl::code $this LeaveMarker $g $label] 529 529 set options [GetLineMarkerOptions $style] 530 530 if { $options != "" } { … … 645 645 set elem $info(name) 646 646 647 # Some elements are generated dynamically and therefore will648 # not have a data object associated with them.649 647 set mapx [$g element cget $elem -mapx] 650 648 set mapy [$g element cget $elem -mapy] 651 if {[info exists _elem2comp($elem)]} {652 foreach {dataobj cname} [split $_elem2comp($elem) -] break653 foreach {mapx mapy} [GetAxes $dataobj] break654 }655 649 656 650 # search again for an exact point -- this time don't interpolate … … 662 656 set x [$g axis transform $mapx $info(x)] 663 657 set y [$g axis transform $mapy $info(y)] 664 665 658 if {[info exists _elem2comp($elem)]} { 666 659 foreach {dataobj cname} [split $_elem2comp($elem) -] break … … 683 676 set elem $info(name) 684 677 685 # Some elements are generated dynamically and therefore will686 # not have a data object associated with them.687 678 set mapx [$g element cget $elem -mapx] 688 679 set mapy [$g element cget $elem -mapy] 689 if {[info exists _elem2comp($elem)]} {690 foreach {dataobj cname} [split $_elem2comp($elem) -] break691 foreach {mapx mapy} [GetAxes $dataobj] break692 }693 680 694 681 set tip "" … … 739 726 set allx [$g x2axis use] 740 727 if {[llength $allx] > 0} { 741 lappend allx x ; # fix main x-axis too728 lappend allx x ; # fix main x-axis too 742 729 foreach axis $allx { 743 730 if {$axis == $mapx} { … … 752 739 set ally [$g y2axis use] 753 740 if {[llength $ally] > 0} { 754 lappend ally y ; # fix main y-axis too741 lappend ally y ; # fix main y-axis too 755 742 foreach axis $ally { 756 743 if {$axis == $mapy} { … … 763 750 } 764 751 } 765 766 752 if {"" != $tip} { 767 753 $g crosshairs configure -hide no -position @$x,$y … … 1042 1028 # ---------------------------------------------------------------------- 1043 1029 itcl::body Rappture::XyResult::GetAxes {dataobj} { 1044 # rebuild if needed, so we know about the axes1045 if 0 {1046 # Don't do this. Given dataobj may be deleted in the rebuild1047 1048 # rebuild if needed, so we know about the axes1049 if {[$_dispatcher ispending !rebuild]} {1050 $_dispatcher cancel !rebuild1051 $_dispatcher event -now !rebuild1052 }1053 }1054 # what is the x axis? x? x2? x3? ...1055 1030 set xlabel [$dataobj hints xlabel] 1056 if {[info exists _label2axis( x-$xlabel)]} {1057 set mapx $_label2axis( x-$xlabel)1031 if {[info exists _label2axis($xlabel)]} { 1032 set mapx $_label2axis($xlabel) 1058 1033 } else { 1059 1034 set mapx "x" 1060 1035 } 1061 1036 1062 # what is the y axis? y? y2? y3? ...1063 1037 set ylabel [$dataobj hints ylabel] 1064 if {[info exists _label2axis( y-$ylabel)]} {1065 set mapy $_label2axis( y-$ylabel)1038 if {[info exists _label2axis($ylabel)]} { 1039 set mapy $_label2axis($ylabel) 1066 1040 } else { 1067 1041 set mapy "y" 1068 1042 } 1069 1070 1043 return [list $mapx $mapy] 1071 1044 } … … 1517 1490 } 1518 1491 $g axis configure $axisName -title $label -hide no \ 1519 -checklimits no 1492 -checklimits no -showticks yes 1520 1493 set _label2axis($label) $axisName 1521 1494 … … 1526 1499 } 1527 1500 } 1528 # Next set the axes based on what we've found.1501 # Next, set the axes based on what we've found. 1529 1502 foreach label [array names _label2axis] { 1530 1503 set logscale [info exists _limits(${label}-log)] … … 1618 1591 set xv [$dataobj mesh $cname] 1619 1592 set yv [$dataobj values $cname] 1620 1593 set xev [$dataobj xErrorValues $cname] 1594 set yev [$dataobj yErrorValues $cname] 1621 1595 if {([$xv length] <= 1) || ($linewidth == 0)} { 1622 1596 set sym square … … 1643 1617 -mapx $mapx \ 1644 1618 -mapy $mapy \ 1645 -hide yes 1619 -hide yes \ 1620 -xerror $xev -yerror $yev 1646 1621 } 1647 1622 "scatter" { … … 1655 1630 -mapx $mapx \ 1656 1631 -mapy $mapy \ 1657 -hide yes 1632 -hide yes \ 1633 -xerror $xev -yerror $yev 1658 1634 } 1659 1635 "bar" { … … 1664 1640 -mapx $mapx \ 1665 1641 -mapy $mapy \ 1666 -hide yes 1642 -hide yes \ 1643 -xerror $xev -yerror $yev 1667 1644 } 1668 1645 } 1669 1646 } else { 1670 if 0 { 1671 set elem $_comp2elem($tag) 1672 switch -- $type { 1673 "scatter" { 1674 $g line configure $elem \ 1675 -symbol $sym \ 1676 -pixels $pixels \ 1677 -linewidth 0 1678 } 1679 "line" { 1680 $g line configure $elem \ 1681 -symbol $sym \ 1682 -pixels $pixels \ 1683 -linewidth $linewidth \ 1684 -dashes $dashes 1685 } 1686 "bar" { 1687 $g bar configure $elem \ 1688 -barwidth $barwidth \ 1689 -label $label 1690 } 1691 } 1692 } 1693 } 1694 } 1695 } 1647 $g element configure $_comp2elem($tag) -mapx $mapx -mapy $mapy 1648 } 1649 } 1650 }
Note: See TracChangeset
for help on using the changeset viewer.