diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-06-07 19:51:30 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-06-07 19:51:30 (GMT) |
commit | 3e0e98282ec1f35833f975990cbd69a12843c475 (patch) | |
tree | 734b9a5b6a1420d08863451e618e77601ae8ff51 /ds9/library | |
parent | 2ea2b0e83a4b3c58d82b13d4d26fdad5b3853d2e (diff) | |
download | blt-3e0e98282ec1f35833f975990cbd69a12843c475.zip blt-3e0e98282ec1f35833f975990cbd69a12843c475.tar.gz blt-3e0e98282ec1f35833f975990cbd69a12843c475.tar.bz2 |
support multiple graphs per plot
Diffstat (limited to 'ds9/library')
-rw-r--r-- | ds9/library/plot.tcl | 36 | ||||
-rw-r--r-- | ds9/library/plotbar.tcl | 6 | ||||
-rw-r--r-- | ds9/library/plotdata.tcl | 2 | ||||
-rw-r--r-- | ds9/library/plotline.tcl | 6 | ||||
-rw-r--r-- | ds9/library/plotprocess.tcl | 5 | ||||
-rw-r--r-- | ds9/library/plotscatter.tcl | 6 | ||||
-rw-r--r-- | ds9/library/plotstate.tcl | 12 |
7 files changed, 31 insertions, 42 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index 6f29603..328a85a 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -42,6 +42,7 @@ proc PlotAddGraph {varname} { $var(proc,addgraph) $varname PlotInitGraph $varname + PlotSaveState $varname $var(proc,updategraph) $varname $var(proc,updatecanvas) $varname @@ -54,6 +55,11 @@ proc PlotAddGraph {varname} { aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"} } + # update select graph menu + $var(mb).canvas.select add radiobutton -label "Graph $var(seq)" \ + -variable ${varname}(graph,current) -value $cc \ + -command [list PlotCurrent $varname] + # layout foreach cc $var(graphs) { pack forget $var($cc) @@ -111,33 +117,17 @@ proc PlotAddElement {varname} { } } - # update data set menu + # update select dataset menu $var(mb).graph.select add radiobutton -label "$var(graph,ds,name)" \ -variable ${varname}($cc,data,current) -value $nn \ - -command [list PlotCurrentData $varname] + -command [list PlotCurrent $varname] } -proc PlotCurrentGraph {varname} { +proc PlotCurrent {varname} { upvar #0 $varname var global $varname - set cc $var(graph,current) - - if {$cc != {}} { - PlotCurrentData $varname - } -} - -proc PlotCurrentData {varname} { - upvar #0 $varname var - global $varname - - set cc $var(graph,current) - - if {$var($cc,data,total) > 0} { - PlotRestoreState $varname - } - + PlotRestoreState $varname PlotStats $varname PlotList $varname } @@ -402,6 +392,8 @@ proc PlotUpdateGraph {varname} { upvar #0 $varname var global $varname + PlotSaveState $varname + if {$var(graph,axis,x,auto)} { set xmin {} set xmax {} @@ -542,7 +534,7 @@ proc PlotBackup {ch dir} { set save $var($cc,data,current) for {set ii 1} {$ii<=$var($cc,data,total)} {incr ii} { set ${varname}($cc,data,current) $ii - PlotCurrentData $varname + PlotCurrent $varname PlotSaveDataFile $varname "$fdir/plot$ii.dat" PlotSaveConfigFile $varname "$fdir/plot$ii.plt" @@ -551,7 +543,7 @@ proc PlotBackup {ch dir} { puts $ch "PlotLoadConfigFile $varname $fdir/plot$ii.plt" } set ${varname}($cc,data,current) $save - PlotCurrentData $varname + PlotCurrent $varname } } } diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl index 8372bf3..d5826d4 100644 --- a/ds9/library/plotbar.tcl +++ b/ds9/library/plotbar.tcl @@ -155,15 +155,13 @@ proc PlotBarUpdateElement {varname} { upvar #0 $varname var global $varname - set cc $var(graph,current) + PlotSaveState $varname - # warning: uses current vars + set cc $var(graph,current) if {$var($cc,data,total) == 0} { return } - PlotSaveState $varname - if {$var(graph,ds,error)} { set show both } else { diff --git a/ds9/library/plotdata.tcl b/ds9/library/plotdata.tcl index e36cada..8b24ea8 100644 --- a/ds9/library/plotdata.tcl +++ b/ds9/library/plotdata.tcl @@ -523,7 +523,7 @@ proc PlotDeleteAllDataSet {varname} { set var($cc,data,current) 1 $var(mb).graph.select delete [expr $ds9(menu,start)+1] end - PlotCurrentData $varname + PlotCurrent $varname $var(proc,updategraph) $varname } } diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl index a78b1b0..11bfdf3 100644 --- a/ds9/library/plotline.tcl +++ b/ds9/library/plotline.tcl @@ -155,15 +155,13 @@ proc PlotLineUpdateElement {varname} { upvar #0 $varname var global $varname - set cc $var(graph,current) + PlotSaveState $varname - # warning: uses current vars + set cc $var(graph,current) if {$var($cc,data,total) == 0} { return } - PlotSaveState $varname - if {$var(graph,ds,fill)} { set fillClr $var(graph,ds,fill,color) } else { diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index 15e5e69..42c883d 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -286,7 +286,7 @@ proc PlotCmdUpdateGraph {which value} { upvar #0 $cvarname cvar set cvar($which) $value - $cvar(proc,updategraph) $cvarname + UpdateGraph $cvarname } proc PlotCmdUpdateElement {which value} { @@ -315,7 +315,6 @@ proc PlotCmdFontStyle {which value} { set cvar($which,slant) italic } } - $cvar(proc,updatecanvas) $cvarname } @@ -342,7 +341,7 @@ proc PlotCmdSelectData {which} { set cc $cvar(graph,current) set cvar($cc,data,current) $which - PlotCurrentData $cvarname + PlotCurrent $cvarname } # used by SAMP and CATALOG diff --git a/ds9/library/plotscatter.tcl b/ds9/library/plotscatter.tcl index 182d2c4..a59269c 100644 --- a/ds9/library/plotscatter.tcl +++ b/ds9/library/plotscatter.tcl @@ -85,15 +85,13 @@ proc PlotScatterUpdateElement {varname} { upvar #0 $varname var global $varname - set cc $var(graph,current) + PlotSaveState $varname - # warning: uses current vars + set cc $var(graph,current) if {$var($cc,data,total) == 0} { return } - PlotSaveState $varname - if {$var(graph,ds,shape,symbol) == "none"} { set var(graph,ds,shape,symbol) circle } diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl index d3c40f2..15c5579 100644 --- a/ds9/library/plotstate.tcl +++ b/ds9/library/plotstate.tcl @@ -37,8 +37,6 @@ proc PlotDefState {} { set pap(axis,font,slant) roman # per Graph - set pap(graph,title) {} - set pap(graph,legend) 0 set pap(graph,legend,title) Legend set pap(graph,legend,position) right @@ -95,6 +93,8 @@ proc PlotInitGraph {varname} { # per Graph set var(graph,format) 1 + set var(graph,title) {} + set var(graph,legend) $pap(graph,legend) set var(graph,legend,title) $pap(graph,legend,title) set var(graph,legend,position) $pap(graph,legend,position) @@ -154,9 +154,11 @@ proc PlotSaveState {varname} { set cc $var(graph,current) set nn $var($cc,data,current) + puts "PlotSaveState $cc" + # per Graph - set var($cc,title) $var(graph,title) set var($cc,format) $var(graph,format) + set var($cc,title) $var(graph,title) set var($cc,legend) $var(graph,legend) set var($cc,legend,title) $var(graph,legend,title) @@ -218,9 +220,11 @@ proc PlotRestoreState {varname} { set nn $var($cc,data,current) set var(graph) $var($cc) + puts "PlotRestoreState $cc" + # per Graph - set var(graph,title) $var($cc,title) set var(graph,format) $var($cc,format) + set var(graph,title) $var($cc,title) set var(graph,legend) $var($cc,legend) set var(graph,legend,title) $var($cc,legend,title) |