Ignore:
Timestamp:
Sep 19, 2005 8:27:37 PM (19 years ago)
Author:
mmc
Message:
  • Fixed x/y graphs to support multiple axes.
  • Added Rappture::result proc for reporting results.
  • Fixed up app-fermi example to be a little cleaner.
File:
1 edited

Legend:

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

    r56 r57  
    3232    private variable _curve ""   ;# lib obj representing this curve
    3333    private variable _comp2xy    ;# maps component name => x,y vectors
     34    private variable _hints      ;# cache of hints stored in XML
    3435
    3536    private common _counter 0    ;# counter for unique vector names
     
    108109
    109110# ----------------------------------------------------------------------
    110 # USAGE: limits x|xlog|y|ylog
     111# USAGE: limits x|xlin|xlog|y|ylin|ylog
    111112#
    112113# Returns the {min max} limits for the specified axis.
     
    116117    set max ""
    117118    switch -- $which {
    118         x { set pos 0; set log 0; set axis xaxis }
     119        x - xlin { set pos 0; set log 0; set axis xaxis }
    119120        xlog { set pos 0; set log 1; set axis xaxis }
    120         y - v { set pos 1; set log 0; set axis yaxis }
     121        y - ylin - v - vlin { set pos 1; set log 0; set axis yaxis }
    121122        ylog - vlog { set pos 1; set log 1; set axis yaxis }
    122123        default {
    123             error "bad option \"$which\": should be x, xlog, y, ylog, v, vlog"
     124            error "bad option \"$which\": should be x, xlin, xlog, y, ylin, ylog, v, vlin, vlog"
    124125        }
    125126    }
     
    184185# ----------------------------------------------------------------------
    185186itcl::body Rappture::Curve::hints {{keyword ""}} {
    186     foreach {key path} {
    187         group   about.group
    188         label   about.label
    189         color   about.color
    190         style   about.style
    191         xlabel  xaxis.label
    192         xunits  xaxis.units
    193         xscale  xaxis.scale
    194         xmin    xaxis.min
    195         xmax    xaxis.max
    196         ylabel  yaxis.label
    197         yunits  yaxis.units
    198         yscale  yaxis.scale
    199         ymin    yaxis.min
    200         ymax    yaxis.max
    201     } {
    202         set str [$_curve get $path]
    203         if {"" != $str} {
    204             set hints($key) $str
    205         }
    206     }
    207 
    208     if {[info exists hints(xlabel)] && "" != $hints(xlabel)
    209           && [info exists hints(xunits)] && "" != $hints(xunits)} {
    210         set hints(xlabel) "$hints(xlabel) ($hints(xunits))"
    211     }
    212     if {[info exists hints(ylabel)] && "" != $hints(ylabel)
    213           && [info exists hints(yunits)] && "" != $hints(yunits)} {
    214         set hints(ylabel) "$hints(ylabel) ($hints(yunits))"
    215     }
    216 
    217     if {[info exists hints(group)] && [info exists hints(label)]} {
    218         # pop-up help for each curve
    219         set hints(tooltip) $hints(label)
     187    if {![info exists _hints]} {
     188        foreach {key path} {
     189            group   about.group
     190            label   about.label
     191            color   about.color
     192            style   about.style
     193            xlabel  xaxis.label
     194            xunits  xaxis.units
     195            xscale  xaxis.scale
     196            xmin    xaxis.min
     197            xmax    xaxis.max
     198            ylabel  yaxis.label
     199            yunits  yaxis.units
     200            yscale  yaxis.scale
     201            ymin    yaxis.min
     202            ymax    yaxis.max
     203        } {
     204            set str [$_curve get $path]
     205            if {"" != $str} {
     206                set _hints($key) $str
     207            }
     208        }
     209
     210        if {[info exists _hints(xlabel)] && "" != $_hints(xlabel)
     211              && [info exists _hints(xunits)] && "" != $_hints(xunits)} {
     212            set _hints(xlabel) "$_hints(xlabel) ($_hints(xunits))"
     213        }
     214        if {[info exists _hints(ylabel)] && "" != $_hints(ylabel)
     215              && [info exists _hints(yunits)] && "" != $_hints(yunits)} {
     216            set _hints(ylabel) "$_hints(ylabel) ($_hints(yunits))"
     217        }
     218
     219        if {[info exists _hints(group)] && [info exists _hints(label)]} {
     220            # pop-up help for each curve
     221            set _hints(tooltip) $_hints(label)
     222        }
    220223    }
    221224
    222225    if {$keyword != ""} {
    223         if {[info exists hints($keyword)]} {
    224             return $hints($keyword)
     226        if {[info exists _hints($keyword)]} {
     227            return $_hints($keyword)
    225228        }
    226229        return ""
    227230    }
    228     return [array get hints]
     231    return [array get _hints]
    229232}
    230233
Note: See TracChangeset for help on using the changeset viewer.