Changeset 2693


Ignore:
Timestamp:
Nov 17, 2011 2:29:45 PM (12 years ago)
Author:
gah
Message:
 
Location:
trunk/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/xyprint.tcl

    r2654 r2693  
    291291    # Axis component
    292292    foreach axis [$orig axis names] {
     293        if { $axis == "z" } {
     294            continue
     295        }
    293296        if { [$orig axis cget $axis -hide] } {
    294297            continue
     
    379382    set _settings($this-axis-title-fontslant)  roman
    380383    foreach axis [$_clone axis names] {
     384        if { $axis == "z" } {
     385            continue
     386        }
    381387        if { [$_clone axis cget $axis -hide] } {
    382388            continue
     
    398404            -titlefont $titlefont
    399405    }
     406    set count 0
    400407    foreach elem [$_clone element names] {
    401408        if { [$_clone element type $elem] == "bar" } {
    402409            continue
    403410        }
     411        incr count
    404412        if { [$_clone element cget $elem -linewidth] > 1 } {
    405413            $_clone element configure $elem -linewidth 1 -pixels 3
    406414        }
     415    }
     416    if { $count == 0 } {
     417        # There are no "line" elements in the graph.
     418        # Remove the symbol and dashes controls.
     419        set page $itk_component(legend_page)
     420        # May have already been forgotten.
     421        catch {
     422            blt::table forget $page.symbol_l
     423            blt::table forget $page.symbol
     424            blt::table forget $page.dashes_l
     425            blt::table forget $page.dashes
     426        }
    407427    }
    408428}
  • trunk/gui/scripts/xyresult.tcl

    r2388 r2693  
    1515package require Itk
    1616package require BLT
     17
     18option add *XyResult.width 3i widgetDefault
     19option add *XyResult.height 3i widgetDefault
     20option add *XyResult.gridColor #d9d9d9 widgetDefault
     21option add *XyResult.activeColor blue widgetDefault
     22option add *XyResult.dimColor gray widgetDefault
     23option add *XyResult.controlBackground gray widgetDefault
     24option add *XyResult.font \
     25    -*-helvetica-medium-r-normal-*-12-* widgetDefault
    1726
    1827set autocolors {
     
    5160}
    5261
    53 option add *XyResult.width 3i widgetDefault
    54 option add *XyResult.height 3i widgetDefault
    55 option add *XyResult.gridColor #d9d9d9 widgetDefault
    56 option add *XyResult.activeColor blue widgetDefault
    57 option add *XyResult.dimColor gray widgetDefault
    58 option add *XyResult.controlBackground gray widgetDefault
    59 option add *XyResult.font \
    60     -*-helvetica-medium-r-normal-*-12-* widgetDefault
    6162option add *XyResult.autoColors $autocolors widgetDefault
    6263option add *XyResult*Balloon*Entry.background white widgetDefault
     
    9798
    9899    private variable _dispatcher "" ;# dispatcher for !events
    99     private variable _dlist ""     ;# list of data object objects
    100     private variable _dataobj2color  ;# maps data object => plotting color
    101     private variable _dataobj2width  ;# maps data object => line width
    102     private variable _dataobj2dashes ;# maps data object => BLT -dashes list
    103     private variable _dataobj2raise  ;# maps data object => raise flag 0/1
    104     private variable _dataobj2desc   ;# maps data object => description of data
    105     private variable _elem2dataobj   ;# maps graph element => data object
     100    private variable _dlist ""     ;# list of dataobj objects
     101    private variable _dataobj2color  ;# maps dataobj => plotting color
     102    private variable _dataobj2width  ;# maps dataobj => line width
     103    private variable _dataobj2dashes ;# maps dataobj => BLT -dashes list
     104    private variable _dataobj2raise  ;# maps dataobj => raise flag 0/1
     105    private variable _dataobj2desc   ;# maps dataobj => description of data
     106    private variable _elem2dataobj   ;# maps graph element => dataobj
    106107    private variable _label2axis   ;# maps axis label => axis ID
    107108    private variable _limits       ;# axis limits:  x-min, x-max, etc.
     
    170171        -outline black -fill red -color black
    171172
    172     #
    173173    # Add bindings so you can mouse over points to see values:
    174174    #
     
    293293        set params(-width) 0
    294294    }
    295 
    296295    # if the color is "auto", then select a color from -autocolors
    297     if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     296    if { $params(-color) == "auto" || $params(-color) == "autoreset" } {
    298297        if {$params(-color) == "autoreset"} {
    299298            set _autoColorI 0
    300299        }
    301         set color [lindex $itk_option(-autocolors) $_autoColorI]
    302         if {"" == $color} { set color black }
     300        set color [lindex $itk_option(-autocolors) $_autoColorI]
     301        if { "" == $color} {
     302            set color black
     303        }
    303304        set params(-color) $color
    304 
    305305        # set up for next auto color
    306306        if {[incr _autoColorI] >= [llength $itk_option(-autocolors)]} {
     
    320320        set params(-color) [Rappture::color::brightness \
    321321            $params(-color) $params(-brightness)]
    322 
    323322        set bg [$itk_component(plot) cget -plotbackground]
    324323        foreach {h s v} [Rappture::color::RGBtoHSV $bg] break
     
    359358            lappend top $obj
    360359        } else {
    361             lappend bottom $obj
     360            lappend bottom $obj 
    362361        }
    363362    }
     
    369368# USAGE: delete ?<dataobj1> <dataobj2> ...?
    370369#
    371 # Clients use this to delete a data object from the plot.  If no data objects
    372 # are specified, then all data objects are deleted.
     370# Clients use this to delete a dataobj from the plot.  If no dataobjs
     371# are specified, then all dataobjs are deleted.
    373372# ----------------------------------------------------------------------
    374373itcl::body Rappture::XyResult::delete {args} {
     
    377376    }
    378377
    379     # delete all specified data objects
     378    # delete all specified dataobjs
    380379    set changed 0
    381380    foreach dataobj $args {
     
    383382        if {$pos >= 0} {
    384383            set _dlist [lreplace $_dlist $pos $pos]
    385             catch {unset _dataobj2color($dataobj)}
    386             catch {unset _dataobj2width($dataobj)}
    387             catch {unset _dataobj2dashes($dataobj)}
    388             catch {unset _dataobj2raise($dataobj)}
     384            array unset _dataobj2color  $dataobj
     385            array unset _dataobj2width  $dataobj
     386            array unset _dataobj2dashes $dataobj
     387            array unset _dataobj2raise  $dataobj
    389388            foreach elem [array names _elem2dataobj] {
    390389                if {$_elem2dataobj($elem) == $dataobj} {
    391                     unset _elem2dataobj($elem)
     390                    array unset _elem2dataobj $elem
    392391                }
    393392            }
     
    412411# Sets the default limits for the overall plot according to the
    413412# limits of the data for all of the given <dataobj> objects.  This
    414 # accounts for all data objects--even those not showing on the screen.
    415 # Because of this, the limits are appropriate for all data objects as
     413# accounts for all dataobjs--even those not showing on the screen.
     414# Because of this, the limits are appropriate for all dataobjs as
    416415# the user scans through data in the ResultSet viewer.
    417416# ----------------------------------------------------------------------
     
    431430    catch {unset _limits}
    432431    foreach dataobj $args {
    433         # find the axes for this data object (e.g., {x y2})
     432        # find the axes for this dataobj (e.g., {x y2})
    434433        foreach {map(x) map(y)} [GetAxes $dataobj] break
    435 
    436434        foreach axis {x y} {
    437435            # get defaults for both linear and log scales
     
    440438                set id $map($axis)$type
    441439                foreach {min max} [$dataobj limits $axis$type] break
     440                set amin [$dataobj hints ${axis}min]
     441                set amax [$dataobj hints ${axis}max]
     442                if { $amin != "" } {
     443                    set min $amin
     444                }
     445                if { $amax != "" } {
     446                    set max $amax
     447                }
    442448                if {"" != $min && "" != $max} {
    443449                    if {![info exists _limits($id-min)]} {
     
    454460                }
    455461            }
    456 
    457462            if {[$dataobj hints ${axis}scale] == "log"} {
    458463                Axis scale $map($axis) log
     
    497502                button $inner.go -text [Rappture::filexfer::label download] \
    498503                    -command [lindex $args 0]
    499                 pack $inner.go -pady 4
     504                pack $inner.go -side bottom -pady 4
    500505            } else {
    501506                set inner [$popup component inner]
     
    675680
    676681    #
    677     # Plot all of the data objects.
     682    # Plot all of the dataobjs.
    678683    #
    679684    set count 0
     
    681686        set label [$dataobj hints label]
    682687        foreach {mapx mapy} [GetAxes $dataobj] break
    683 
    684688        foreach comp [$dataobj components] {
    685689            set xv [$dataobj mesh $comp]
     
    694698                }
    695699            }
    696 
    697700            if {[info exists _dataobj2width($dataobj)]} {
    698701                set lwidth $_dataobj2width($dataobj)
     
    15211524# ----------------------------------------------------------------------
    15221525itcl::body Rappture::XyResult::GetAxes {dataobj} {
     1526    # rebuild if needed, so we know about the axes
    15231527    if 0 {
    15241528        # Don't do this. Given dataobj may be deleted in the rebuild
  • trunk/gui/src/Makefile.in

    r2202 r2693  
    4747
    4848LIBS            = \
    49                 -L../../src/core -lrappture \
    5049                -L$(libdir) $(TCL_LIB_SPEC) $(TK_LIB_SPEC) $(TK_XLIBSW) -lm
    5150
Note: See TracChangeset for help on using the changeset viewer.