Changeset 2287


Ignore:
Timestamp:
Jun 21, 2011, 3:41:22 PM (13 years ago)
Author:
gah
Message:

fixes for datatable and numberresult viewers

Location:
branches/blt4/gui/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/gui/scripts/datatable.tcl

    r1941 r2287  
    144144        package require blt_datatable_csv
    145145        $d0 import csv -data $csvdata
    146         for { set row 1 } { $row <= [$d0 row length] } { incr row } {
     146        for { set row 1 } { $row <= [$d0 numrows] } { incr row } {
    147147            set child [$_tree insert 0]
    148148            set c 0
  • branches/blt4/gui/scripts/datatableresult.tcl

    r2098 r2287  
    312312    }
    313313    foreach col [$itk_component(treeview) column names] {
    314         if { [string match "BLT TreeView*" $col] } {
    315             continue
    316         }
    317314        $itk_component(treeview) column delete $col
    318315    }
  • branches/blt4/gui/scripts/numberresult.tcl

    r2173 r2287  
    875875    set g $itk_component(plot)
    876876    set elem ""
    877 
     877 
    878878    # Peek inside of Blt_ZoomStack package to see if we're currently in the
    879879    # middle of a zoom selection.
     
    882882    }
    883883    set tip ""
     884    set found 0
    884885    if {$state == "at"} {
    885         if {[$g element closest $x $y info -interpolate yes]} {
     886        set results [$g element closest $x $y -interpolate yes]
     887        if { $results != "" } {
     888            array set info $results
    886889            # for dealing with xy line plots
    887890            set elem $info(name)
     891
    888892            # Some elements are generated dynamically and therefore will
    889             # not have a data object associated with them.
     893            # not have a dataobj object associated with them.
    890894            set mapx [$g element cget $elem -mapx]
    891895            set mapy [$g element cget $elem -mapy]
     
    896900            # search again for an exact point -- this time don't interpolate
    897901            set tip ""
    898             if {[$g element closest $x $y info -interpolate no]
    899                   && $info(name) == $elem} {
     902            array unset info
     903            set results [$g element closest $x $y -interpolate no]
     904            array set info $results
     905
     906            if { [info exists info(name)] && $info(name) == $elem } {
     907                set found 1
     908
    900909                set x [$g axis transform $mapx $info(x)]
    901910                set y [$g axis transform $mapy $info(y)]
    902 
     911               
     912                set tip ""
    903913                if {[info exists _elem2dataobj($elem)]} {
    904914                    set dataobj $_elem2dataobj($elem)
     
    917927                }
    918928            }
    919             set state 1
    920         } elseif {[$g element closest $x $y info -interpolate no]} {
    921             # for dealing with xy scatter plot
    922             set elem $info(name)
    923             foreach {mapx mapy} [GetAxes $_elem2dataobj($elem)] break
    924 
    925             # search again for an exact point -- this time don't interpolate
    926             set tip ""
    927             if {$info(name) == $elem} {
     929        } else {
     930            set results [$g element closest $x $y -interpolate no]
     931            if { $results != ""  } {
     932                set found 1
     933
     934                array unset info
     935                array set info $results
     936                # for dealing with xy scatter plot
     937                set elem $info(name)
     938               
     939                # Some elements are generated dynamically and therefore will
     940                # not have a dataobj object associated with them.
     941                set mapx [$g element cget $elem -mapx]
     942                set mapy [$g element cget $elem -mapy]
     943                if {[info exists _elem2dataobj($elem)]} {
     944                    foreach {mapx mapy} [GetAxes $_elem2dataobj($elem)] break
     945                }
     946               
     947                set tip ""
    928948                set x [$g axis transform $mapx $info(x)]
    929949                set y [$g axis transform $mapy $info(y)]
    930 
     950               
    931951                if {[info exists _elem2dataobj($elem)]} {
    932952                    set dataobj $_elem2dataobj($elem)
     
    945965                }
    946966            }
    947             set state 1
    948         } else {
    949             set state 0
    950         }
    951     }
    952 
    953     if {$state} {
     967        }
     968    }
     969
     970    if { $found } {
    954971        #
    955972        # Highlight ON:
     
    958975        # - pop up tooltip about data
    959976        #
    960         if {$_hilite(elem) != "" && $_hilite(elem) != $elem} {
     977        if { [$g element exists $_hilite(elem)] && $_hilite(elem) != $elem } {
    961978            $g element deactivate $_hilite(elem)
    962979            $g crosshairs configure -hide yes
     
    966983        set _hilite(elem) $elem
    967984
    968         set dlist [$g element show]
    969         set i [lsearch -exact $dlist $elem]
    970         if {$i >= 0} {
    971             set dlist [lreplace $dlist $i $i]
    972             lappend dlist $elem
    973             $g element show $dlist
    974         }
    975 
    976         foreach {mapx mapy} [GetAxes $_elem2dataobj($elem)] break
    977 
     985        set mapx [$g element cget $elem -mapx]
     986        set mapy [$g element cget $elem -mapy]
     987        if {[info exists _elem2dataobj($elem)]} {
     988            foreach {mapx mapy} [GetAxes $_elem2dataobj($elem)] break
     989        }
    978990        set allx [$g x2axis use]
    979991        if {[llength $allx] > 0} {
     
    10421054        # - take down tooltip
    10431055        #
    1044         if {"" != $_hilite(elem)} {
     1056        if { [$g element exists $_hilite(elem)] } {
    10451057            $g element deactivate $_hilite(elem)
    1046 
    1047             set allx [$g x2axis use]
    1048             if {[llength $allx] > 0} {
    1049                 lappend allx x  ;# fix main x-axis too
    1050                 foreach axis $allx {
    1051                     $g axis configure $axis -color $itk_option(-foreground) \
    1052                         -titlecolor $itk_option(-foreground)
    1053                 }
    1054             }
    1055 
    1056             set ally [$g y2axis use]
    1057             if {[llength $ally] > 0} {
    1058                 lappend ally y  ;# fix main y-axis too
    1059                 foreach axis $ally {
    1060                     $g axis configure $axis -color $itk_option(-foreground) \
    1061                         -titlecolor $itk_option(-foreground)
    1062                 }
     1058        }
     1059        set allx [$g x2axis use]
     1060        if {[llength $allx] > 0} {
     1061            lappend allx x  ;# fix main x-axis too
     1062            foreach axis $allx {
     1063                $g axis configure $axis -color $itk_option(-foreground) \
     1064                    -titlecolor $itk_option(-foreground)
     1065            }
     1066        }
     1067       
     1068        set ally [$g y2axis use]
     1069        if {[llength $ally] > 0} {
     1070            lappend ally y  ;# fix main y-axis too
     1071            foreach axis $ally {
     1072                $g axis configure $axis -color $itk_option(-foreground) \
     1073                    -titlecolor $itk_option(-foreground)
    10631074            }
    10641075        }
     
    10711082        }
    10721083
    1073         # there is no currently highlighted element
     1084        # There is no currently highlighted element
    10741085        set _hilite(elem) ""
    10751086    }
     
    15391550# ----------------------------------------------------------------------
    15401551itcl::configbody Rappture::NumberResult::gridcolor {
    1541     if {"" == $itk_option(-gridcolor)} {
    1542         $itk_component(plot) grid off
     1552    if { "" == $itk_option(-gridcolor) } {
     1553        foreach axis [$itk_component(plot) axis names] {
     1554            $itk_component(plot) axis configure $axis -grid off
     1555        }
    15431556    } else {
    1544         $itk_component(plot) grid configure -color $itk_option(-gridcolor)
    1545         $itk_component(plot) grid on
    1546     }
    1547 }
     1557        foreach axis [$itk_component(plot) axis names] {
     1558            $itk_component(plot) axis configure $axis \
     1559                -gridcolor $itk_option(-gridcolor) -grid on
     1560        }
     1561    }
     1562}
  • branches/blt4/gui/scripts/resultviewer.tcl

    r2242 r2287  
    350350                    set mode "number"
    351351                    if {![info exists _mode2widget($mode)]} {
    352 p                        set w $itk_interior.number
     352                        set w $itk_interior.number
    353353                        Rappture::NumberResult $w
    354354                        set _mode2widget($mode) $w
Note: See TracChangeset for help on using the changeset viewer.