Changeset 4006 for branches/1.3


Ignore:
Timestamp:
Oct 9, 2013, 9:27:32 PM (11 years ago)
Author:
gah
Message:

fix axis mappings for alternate axes. fix tooltip for elements with alternate axes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/xyresult.tcl

    r3908 r4006  
    173173    itk_component add plot {
    174174        blt::graph $f.plot \
    175             -highlightthickness 0 -plotpadx 0 -plotpady 4 \
    176             -rightmargin 10
     175            -highlightthickness 0 -plotpadx 0 -plotpady 4
    177176    } {
    178177        keep -background -foreground -cursor -font
     
    277276    }
    278277    set type [$dataobj hints type]
     278   
    279279    foreach cname [$dataobj components] {
    280280        set tag $dataobj-$cname
     
    283283            "bar" {
    284284                $g bar configure $elem -foreground $color -background $color \
    285                     -hide no
     285                    -hide no 
    286286            }
    287287            "scatter" {
    288                 $g line configure $elem -color $color -hide no
     288                $g line configure $elem -color $color -hide no 
    289289            }
    290290            default {
    291291                $g line configure $elem -color $color -hide no \
    292                     -linewidth $linewidth
     292                    -linewidth $linewidth 
    293293            }
    294294        }
     
    524524        $g marker configure $id -element $elem
    525525        $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]
    527527        $g marker bind $id <Leave> \
    528             [itcl::code $this LeaveMarker $g y-$label]
     528            [itcl::code $this LeaveMarker $g $label]
    529529        set options [GetLineMarkerOptions $style]
    530530        if { $options != "" } {
     
    645645            set elem $info(name)
    646646
    647             # Some elements are generated dynamically and therefore will
    648             # not have a data object associated with them.
    649647            set mapx [$g element cget $elem -mapx]
    650648            set mapy [$g element cget $elem -mapy]
    651             if {[info exists _elem2comp($elem)]} {
    652                 foreach {dataobj cname} [split $_elem2comp($elem) -] break
    653                 foreach {mapx mapy} [GetAxes $dataobj] break
    654             }
    655649
    656650            # search again for an exact point -- this time don't interpolate
     
    662656                set x [$g axis transform $mapx $info(x)]
    663657                set y [$g axis transform $mapy $info(y)]
    664                
    665658                if {[info exists _elem2comp($elem)]} {
    666659                    foreach {dataobj cname} [split $_elem2comp($elem) -] break
     
    683676            set elem $info(name)
    684677
    685             # Some elements are generated dynamically and therefore will
    686             # not have a data object associated with them.
    687678            set mapx [$g element cget $elem -mapx]
    688679            set mapy [$g element cget $elem -mapy]
    689             if {[info exists _elem2comp($elem)]} {
    690                 foreach {dataobj cname} [split $_elem2comp($elem) -] break
    691                 foreach {mapx mapy} [GetAxes $dataobj] break
    692             }
    693680
    694681            set tip ""
     
    739726        set allx [$g x2axis use]
    740727        if {[llength $allx] > 0} {
    741             lappend allx x  ;# fix main x-axis too
     728            lappend allx x  ;           # fix main x-axis too
    742729            foreach axis $allx {
    743730                if {$axis == $mapx} {
     
    752739        set ally [$g y2axis use]
    753740        if {[llength $ally] > 0} {
    754             lappend ally y  ;# fix main y-axis too
     741            lappend ally y  ;           # fix main y-axis too
    755742            foreach axis $ally {
    756743                if {$axis == $mapy} {
     
    763750            }
    764751        }
    765 
    766752        if {"" != $tip} {
    767753            $g crosshairs configure -hide no -position @$x,$y
     
    10421028# ----------------------------------------------------------------------
    10431029itcl::body Rappture::XyResult::GetAxes {dataobj} {
    1044     # rebuild if needed, so we know about the axes
    1045     if 0 {
    1046         # Don't do this. Given dataobj may be deleted in the rebuild
    1047 
    1048         # rebuild if needed, so we know about the axes
    1049         if {[$_dispatcher ispending !rebuild]} {
    1050             $_dispatcher cancel !rebuild
    1051             $_dispatcher event -now !rebuild
    1052         }
    1053     }
    1054     # what is the x axis?  x? x2? x3? ...
    10551030    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)
    10581033    } else {
    10591034        set mapx "x"
    10601035    }
    10611036
    1062     # what is the y axis?  y? y2? y3? ...
    10631037    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)
    10661040    } else {
    10671041        set mapy "y"
    10681042    }
    1069 
    10701043    return [list $mapx $mapy]
    10711044}
     
    15171490                }
    15181491                $g axis configure $axisName -title $label -hide no \
    1519                     -checklimits no
     1492                    -checklimits no -showticks yes
    15201493                set _label2axis($label) $axisName
    15211494               
     
    15261499        }
    15271500    }
    1528     # Next set the axes based on what we've found.
     1501    # Next, set the axes based on what we've found.
    15291502    foreach label [array names _label2axis] {
    15301503        set logscale [info exists _limits(${label}-log)]
     
    16181591        set xv [$dataobj mesh $cname]
    16191592        set yv [$dataobj values $cname]
    1620 
     1593        set xev [$dataobj xErrorValues $cname]
     1594        set yev [$dataobj yErrorValues $cname]
    16211595        if {([$xv length] <= 1) || ($linewidth == 0)} {
    16221596            set sym square
     
    16431617                        -mapx $mapx \
    16441618                        -mapy $mapy \
    1645                         -hide yes
     1619                        -hide yes \
     1620                        -xerror $xev -yerror $yev
    16461621                }
    16471622                "scatter" {               
     
    16551630                        -mapx $mapx \
    16561631                        -mapy $mapy \
    1657                         -hide yes
     1632                        -hide yes \
     1633                        -xerror $xev -yerror $yev
    16581634                }
    16591635                "bar" {
     
    16641640                        -mapx $mapx \
    16651641                        -mapy $mapy \
    1666                         -hide yes
     1642                        -hide yes \
     1643                        -xerror $xev -yerror $yev
    16671644                }
    16681645            }
    16691646        } 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.