summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-07-28 17:22:41 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-07-28 17:22:41 (GMT)
commit9e8223868c844a58de5ba6db0aaa9ac1808d5e0f (patch)
tree974403e637653fbc702c575e52f97521ddc34968 /ds9
parentfa91f2c85cbfe7cd5c730ffb9570d154b287b99c (diff)
downloadblt-9e8223868c844a58de5ba6db0aaa9ac1808d5e0f.zip
blt-9e8223868c844a58de5ba6db0aaa9ac1808d5e0f.tar.gz
blt-9e8223868c844a58de5ba6db0aaa9ac1808d5e0f.tar.bz2
support multiple graphs per plot
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/plot.tcl55
-rw-r--r--ds9/library/plotdialog.tcl69
-rw-r--r--ds9/library/plotstate.tcl1
3 files changed, 100 insertions, 25 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 9ebec8f..67a106c 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -78,31 +78,6 @@ proc PlotLayoutCanvas {varname} {
}
switch $var(layout) {
- column -
- strip {
- set ww 1
- set ii 0
- grid columnconfigure $var(top) 0 -weight 1
- foreach cc $var(graphs) {
- grid rowconfigure $var(top) $ii -weight $ww
- grid $var($cc,canvas) -row $ii -column 0 -sticky news
-
- set ww 2
- incr ii
- }
- }
- row {
- set ww 1
- set ii 0
- grid rowconfigure $var(top) 0 -weight 1
- foreach cc $var(graphs) {
- grid columnconfigure $var(top) $ii -weight $ww
- grid $var($cc,canvas) -row 0 -column $ii -sticky news
-
- set ww 2
- incr ii
- }
- }
grid {
set num [llength $var(graphs)]
set nr [expr int(sqrt($num)+.5)]
@@ -122,6 +97,36 @@ proc PlotLayoutCanvas {varname} {
}
}
}
+ column {
+ set ii 0
+ grid columnconfigure $var(top) 0 -weight 1
+ foreach cc $var(graphs) {
+ grid rowconfigure $var(top) $ii -weight 1
+ grid $var($cc,canvas) -row $ii -column 0 -sticky news
+ incr ii
+ }
+ }
+ row {
+ set ii 0
+ grid rowconfigure $var(top) 0 -weight 1
+ foreach cc $var(graphs) {
+ grid columnconfigure $var(top) $ii -weight 1
+ grid $var($cc,canvas) -row 0 -column $ii -sticky news
+ incr ii
+ }
+ }
+ strip {
+ set ww 1
+ set ii 0
+ grid columnconfigure $var(top) 0 -weight 1
+ foreach cc $var(graphs) {
+ grid rowconfigure $var(top) $ii -weight $ww
+ grid $var($cc,canvas) -row $ii -column 0 -sticky news
+
+ set ww [expr int(100./$var(layout,strip,weight))]
+ incr ii
+ }
+ }
}
update
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index 8182662..1b2aa59 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -150,6 +150,9 @@ proc PlotDialog {varname wtt} {
$var(mb).canvas.layout add radiobutton -label [msgcat::mc {Strip}] \
-variable ${varname}(layout) -value strip \
-command [list PlotChangeLayout $varname]
+ $var(mb).canvas.layout add command \
+ -label "[msgcat::mc {Strip Parameters}]..." \
+ -command [list PlotStripDialog $varname]
menu $var(mb).canvas.legend
$var(mb).canvas.legend add checkbutton -label [msgcat::mc {Show}] \
@@ -326,6 +329,56 @@ proc PlotDataFormatDialog {xarname} {
return $rr
}
+proc PlotStripDialog {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ global ed
+
+ set w {.aptitle}
+
+ set ed(ok) 0
+
+ set ed(layout,strip,weight) $var(layout,strip,weight)
+
+ DialogCreate $w [msgcat::mc {Strip}] ed(ok)
+
+ # Param
+ set f [ttk::frame $w.param]
+ ttk::label $f.t -text [msgcat::mc {Graph Weight}]
+ ttk::entry $f.ww -textvariable ed(layout,strip,weight) -width 6
+ ttk::label $f.tt -text [msgcat::mc {%}]
+
+ grid $f.t $f.ww $f.tt -padx 2 -pady 2 -sticky w
+
+ # Buttons
+ set f [ttk::frame $w.buttons]
+ ttk::button $f.ok -text [msgcat::mc {OK}] -command {set ed(ok) 1} \
+ -default active
+ ttk::button $f.cancel -text [msgcat::mc {Cancel}] -command {set ed(ok) 0}
+ pack $f.ok $f.cancel -side left -expand true -padx 2 -pady 4
+
+ bind $w <Return> {set ed(ok) 1}
+
+ # Fini
+ ttk::separator $w.sep -orient horizontal
+ pack $w.buttons $w.sep -side bottom -fill x
+ pack $w.param -side top -fill both -expand true
+
+ DialogCenter $w
+ DialogWait $w ed(ok) $w.param.ww
+ DialogDismiss $w
+
+ if {$ed(ok)} {
+ set var(layout,strip,weight) $ed(layout,strip,weight)
+ PlotChangeLayout $varname
+ }
+
+ set rr $ed(ok)
+ unset ed
+ return $rr
+}
+
proc PlotRangeDialog {varname} {
upvar #0 $varname var
global $varname
@@ -633,6 +686,22 @@ proc PlotUpdateMenus {varname} {
# Canvas
# Graph
+ switch $var(layout) {
+ grid -
+ row -
+ column {$var(mb).graph entryconfig [msgcat::mc {Axes}] -state normal}
+ strip {
+ set cc $var(graph,current)
+ set first [lindex $var(graphs) 0]
+ if {$cc == $first} {
+ $var(mb).graph entryconfig [msgcat::mc {Axes}] -state normal
+ } else {
+ $var(mb).graph entryconfig [msgcat::mc {Axes}] -state disabled
+ }
+ }
+ }
+
+
if {[llength $var(graph,dss)] == 0} {
$var(mb).graph entryconfig [msgcat::mc {Duplicate Dataset}] \
-state disabled
diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl
index 14d0067..ee7064f 100644
--- a/ds9/library/plotstate.tcl
+++ b/ds9/library/plotstate.tcl
@@ -10,6 +10,7 @@ proc PlotDefState {} {
# per Canvas
set pap(layout) grid
+ set pap(layout,strip,weight) 50
set pap(layout,axis,x,grid) 0
set pap(layout,axis,x,log) 0
set pap(layout,axis,x,flip) 0