summaryrefslogtreecommitdiffstats
path: root/ds9/library
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-07-25 18:53:24 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-07-25 18:53:24 (GMT)
commit8e7f090f25d319d54fcb33d6c378b91fc517f90a (patch)
tree94bb47f5afa6a2742099f4e162abe510853ce3a1 /ds9/library
parente0f04caa468725ca39c4f4fe78c6d1daa1c83c63 (diff)
downloadblt-8e7f090f25d319d54fcb33d6c378b91fc517f90a.zip
blt-8e7f090f25d319d54fcb33d6c378b91fc517f90a.tar.gz
blt-8e7f090f25d319d54fcb33d6c378b91fc517f90a.tar.bz2
support multiple graphs per plot
Diffstat (limited to 'ds9/library')
-rw-r--r--ds9/library/plot.tcl67
-rw-r--r--ds9/library/plotdialog.tcl39
-rw-r--r--ds9/library/plotstate.tcl2
3 files changed, 93 insertions, 15 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 2d0c522..32699b6 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -176,7 +176,6 @@ proc PlotAddGraph {varname type} {
aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"}
}
- # update menus
$var(graph,proc,updateelement) $varname
PlotUpdateGraph $varname
PlotUpdateCanvas $varname
@@ -252,7 +251,6 @@ proc PlotDeleteGraph {varname} {
set var(graph,ds,current) [lindex $var($cc,dss) 0]
PlotRestoreState $varname
- # update menus
$var(graph,proc,updateelement) $varname
PlotUpdateGraph $varname
PlotUpdateCanvas $varname
@@ -405,6 +403,15 @@ proc PlotAxisFormat {varname axis w nn} {
return [format $var(graph,axis,$axis,format) $nn]
}
+proc PlotChangeLayout {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ PlotLayoutCanvas $varname
+ PlotUpdateCanvas $varname
+ PlotUpdateMenus $varname
+}
+
proc PlotChangeMode {varname} {
upvar #0 $varname var
global $varname
@@ -571,6 +578,9 @@ proc PlotUpdateCanvas {varname} {
PlotSaveState $varname
+ set first [lindex $var(graphs) 0]
+ set last [lindex $var(graphs) end]
+
foreach cc $var(graphs) {
switch ($cc,type) {
line {}
@@ -598,6 +608,59 @@ proc PlotUpdateCanvas {varname} {
-position $var(legend,position) \
-font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \
-titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)"
+
+ if {$var(layout,lock) &&
+ ($var(layout) == {row} || $var(layout) == {column})} {
+ $var($cc,graph) xaxis configure -exterior 0
+ $var($cc,graph) yaxis configure -exterior 0
+
+ $var($cc,graph) x2axis configure -hide no \
+ -grid no \
+ -exterior 0 \
+ -bg $var(background)
+ $var($cc,graph) y2axis configure -hide no \
+ -grid no \
+ -exterior 0 \
+ -bg $var(background)
+
+ switch $var(layout) {
+ column {
+ if {$cc != $last} {
+ $var($cc,graph) xaxis configure -showticks 0
+ $var($cc,graph) x2axis configure -showticks 0
+ $var($cc,graph) yaxis configure -showticks 1
+ $var($cc,graph) y2axis configure -showticks 0
+ } else {
+ $var($cc,graph) xaxis configure -showticks 1
+ $var($cc,graph) x2axis configure -showticks 0
+ $var($cc,graph) yaxis configure -showticks 1
+ $var($cc,graph) y2axis configure -showticks 0
+ }
+ }
+ row {
+ if {$cc != $last} {
+ $var($cc,graph) xaxis configure -showticks 1
+ $var($cc,graph) x2axis configure -showticks 0
+ $var($cc,graph) yaxis configure -showticks 1
+ $var($cc,graph) y2axis configure -showticks 0
+ } else {
+ $var($cc,graph) xaxis configure -showticks 1
+ $var($cc,graph) x2axis configure -showticks 0
+ $var($cc,graph) yaxis configure -showticks 0
+ $var($cc,graph) y2axis configure -showticks 0
+ }
+ }
+ }
+ } else {
+ $var($cc,graph) configure -plotpadx 0 -plotpady 0 \
+ -topmargin 0 -bottommargin 0 -leftmargin 0 -rightmargin 0
+
+ $var($cc,graph) xaxis configure -exterior 1 -showticks 1
+ $var($cc,graph) yaxis configure -exterior 1 -showticks 1
+
+ $var($cc,graph) x2axis configure -hide yes
+ $var($cc,graph) y2axis configure -hide yes
+ }
}
}
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index 87ad63b..39fa809 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -119,8 +119,6 @@ proc PlotDialog {varname wtt} {
$var(mb).canvas add cascade -label [msgcat::mc {Layout}] \
-menu $var(mb).canvas.layout
$var(mb).canvas add separator
- menu $var(mb).canvas.select
-
$var(mb).canvas add cascade -label [msgcat::mc {Legend}] \
-menu $var(mb).canvas.legend
$var(mb).canvas add cascade -label [msgcat::mc {Font}] \
@@ -128,6 +126,8 @@ proc PlotDialog {varname wtt} {
$var(mb).canvas add cascade -label [msgcat::mc {Background}] \
-menu $var(mb).canvas.bg
+ menu $var(mb).canvas.select
+
menu $var(mb).canvas.graph
$var(mb).canvas.graph add command -label [msgcat::mc {Line}] \
-command [list PlotAddGraph $varname line]
@@ -137,15 +137,20 @@ proc PlotDialog {varname wtt} {
-command [list PlotAddGraph $varname scatter]
menu $var(mb).canvas.layout
+ $var(mb).canvas.layout add radiobutton -label [msgcat::mc {Grid}] \
+ -variable ${varname}(layout) -value grid \
+ -command [list PlotChangeLayout $varname]
+ $var(mb).canvas.layout add separator
$var(mb).canvas.layout add radiobutton -label [msgcat::mc {Column}] \
-variable ${varname}(layout) -value column \
- -command [list PlotLayoutCanvas $varname]
+ -command [list PlotChangeLayout $varname]
$var(mb).canvas.layout add radiobutton -label [msgcat::mc {Row}] \
-variable ${varname}(layout) -value row \
- -command [list PlotLayoutCanvas $varname]
- $var(mb).canvas.layout add radiobutton -label [msgcat::mc {Grid}] \
- -variable ${varname}(layout) -value grid \
- -command [list PlotLayoutCanvas $varname]
+ -command [list PlotChangeLayout $varname]
+ $var(mb).canvas.layout add separator
+ $var(mb).canvas.layout add checkbutton -label [msgcat::mc {Lock Axis}] \
+ -variable ${varname}(layout,lock) \
+ -command [list PlotChangeLayout $varname]
menu $var(mb).canvas.legend
$var(mb).canvas.legend add checkbutton -label [msgcat::mc {Show}] \
@@ -619,7 +624,20 @@ proc PlotUpdateMenus {varname} {
upvar #0 $varname var
global $varname
-# Graph
+ # Canvas
+ switch $var(layout) {
+ grid {
+ $var(mb).canvas.layout entryconfig [msgcat::mc {Lock Axis}] \
+ -state disabled
+ }
+ row -
+ column {
+ $var(mb).canvas.layout entryconfig [msgcat::mc {Lock Axis}] \
+ -state normal
+ }
+ }
+
+ # Graph
if {[llength $var(graph,dss)] == 0} {
$var(mb).graph entryconfig [msgcat::mc {Duplicate Dataset}] \
-state disabled
@@ -638,10 +656,7 @@ proc PlotUpdateMenus {varname} {
}
}
- # remove menu item
$var(mb).graph.select delete 0 end
-
- # create menu item
set cc $var(graph,current)
foreach nn $var(graph,dss) {
$var(mb).graph.select add radiobutton -label "$var($cc,$nn,name)" \
@@ -649,7 +664,7 @@ proc PlotUpdateMenus {varname} {
-command [list PlotCurrentDataSet $varname]
}
-# Data
+ # Data
$var(mb) delete [msgcat::mc {Data}]
switch $var(graph,type) {
line {
diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl
index 439c045..9c2858c 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,lock) 0
set pap(background) white
set pap(bar,mode) normal
@@ -34,7 +35,6 @@ proc PlotDefState {} {
set pap(axis,title,size) 9
set pap(axis,title,weight) normal
set pap(axis,title,slant) roman
-
set pap(axis,font,family) helvetica
set pap(axis,font,size) 9
set pap(axis,font,weight) normal