From faa2613ce9bd460dd66c19b791804fdd39d037c9 Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 22 Jul 2019 14:00:19 -0400 Subject: support multiple graphs per plot --- ds9/library/catplot.tcl | 3 ++- ds9/library/markeranalysishist.tcl | 3 ++- ds9/library/markeranalysispanda.tcl | 3 ++- ds9/library/markeranalysisplot2d.tcl | 3 ++- ds9/library/markeranalysisplot3d.tcl | 3 ++- ds9/library/markeranalysisradial.tcl | 3 ++- ds9/library/plot.tcl | 17 +++++------------ ds9/library/plotbar.tcl | 11 ++--------- ds9/library/plotline.tcl | 11 ++--------- ds9/library/plotscatter.tcl | 16 ++++++---------- ds9/library/plotstate.tcl | 6 +++--- 11 files changed, 30 insertions(+), 49 deletions(-) diff --git a/ds9/library/catplot.tcl b/ds9/library/catplot.tcl index 09175df..ade9f34 100644 --- a/ds9/library/catplot.tcl +++ b/ds9/library/catplot.tcl @@ -76,7 +76,8 @@ proc CATPlotGenerate {varname} { set ping [PlotPing $vvarname] if {!$ping} { - PlotScatterDialog $vvarname $var(title) + PlotDialog $vvarname $var(title) + PlotAddGraph $vvarname scatter PlotTitle $vvarname $var(title) $xtitle $ytitle set vvar(mode) pointer diff --git a/ds9/library/markeranalysishist.tcl b/ds9/library/markeranalysishist.tcl index e3feefb..5c243a7 100644 --- a/ds9/library/markeranalysishist.tcl +++ b/ds9/library/markeranalysishist.tcl @@ -80,7 +80,8 @@ proc MarkerAnalysisHistogramCB {frame id} { if {$bunit=={}} { set bunit {Values} } - PlotLineDialog $vvarname [string totitle [$frame get marker $id type]] + PlotDialog $vvarname [string totitle [$frame get marker $id type]] + PlotAddGraph $vvarname line PlotTitle $vvarname Histogram $bunit Counts set vvar(graph,ds,xdata) $xdata diff --git a/ds9/library/markeranalysispanda.tcl b/ds9/library/markeranalysispanda.tcl index a54391a..d2f3725 100644 --- a/ds9/library/markeranalysispanda.tcl +++ b/ds9/library/markeranalysispanda.tcl @@ -108,7 +108,8 @@ proc MarkerAnalysisPandaCB {frame id} { } if {![PlotPing $vvarname]} { - PlotLineDialog $vvarname [string totitle [$frame get marker $id type]] + PlotDialog $vvarname [string totitle [$frame get marker $id type]] + PlotAddGraph $vvarname line PlotTitle $vvarname "Radial Profile" $sys {} MarkerAnalysisPandaAxisTitle $vvarname diff --git a/ds9/library/markeranalysisplot2d.tcl b/ds9/library/markeranalysisplot2d.tcl index dc695b2..5732c0d 100644 --- a/ds9/library/markeranalysisplot2d.tcl +++ b/ds9/library/markeranalysisplot2d.tcl @@ -165,7 +165,8 @@ proc MarkerAnalysisPlot2dCB {frame id} { if {$vvar(bunit)=={}} { set vvar(bunit) {Counts} } - PlotLineDialog $vvarname [string totitle [$frame get marker $id type]] + PlotDialog $vvarname [string totitle [$frame get marker $id type]] + PlotAddGraph $vvarname line PlotTitle $vvarname {} $vvar(system) $vvar(bunit) MarkerAnalysisPlot2dXAxisTitle $vvarname diff --git a/ds9/library/markeranalysisplot3d.tcl b/ds9/library/markeranalysisplot3d.tcl index ea80c66..55f7c46 100644 --- a/ds9/library/markeranalysisplot3d.tcl +++ b/ds9/library/markeranalysisplot3d.tcl @@ -164,7 +164,8 @@ proc MarkerAnalysisPlot3dCB {frame id} { if {$vvar(bunit)=={}} { set vvar(bunit) {Counts} } - PlotLineDialog $vvarname [string totitle [$frame get marker $id type]] + PlotDialog $vvarname [string totitle [$frame get marker $id type]] + PlotAddGraph $vvarname line PlotTitle $vvarname {} $vvar(system) $vvar(bunit) MarkerAnalysisPlot3dXAxisTitle $vvarname diff --git a/ds9/library/markeranalysisradial.tcl b/ds9/library/markeranalysisradial.tcl index 1c13a35..fe5fe63 100644 --- a/ds9/library/markeranalysisradial.tcl +++ b/ds9/library/markeranalysisradial.tcl @@ -106,7 +106,8 @@ proc MarkerAnalysisRadialCB {frame id} { $frame get marker $id analysis radial $xdata $ydata $yedata $sys if {![PlotPing $vvarname]} { - PlotLineDialog $vvarname [string totitle [$frame get marker $id type]] + PlotDialog $vvarname [string totitle [$frame get marker $id type]] + PlotAddGraph $vvarname line PlotTitle $vvarname "Radial Profile" $sys {} MarkerAnalysisRadialAxisTitle $vvarname diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index 85e9641..ef99f7b 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -155,7 +155,7 @@ proc PlotAddGraph {varname type} { } scatter { PlotScatterAddGraph $varname - set var(graph,proc,updateelement) PlotScattterUpdateElement + set var(graph,proc,updateelement) PlotScatterUpdateElement set var(graph,proc,highlite) PlotScatterHighLiteElement set var(graph,proc,button) PlotScatterButton } @@ -738,24 +738,16 @@ proc PlotBackup {ch dir} { upvar #0 $varname var global $varname - set cc $var(graph,current) - switch $var($cc,type) { - line {puts $ch "PlotLineTool"} - bar {puts $ch "PlotBarTool"} - scatter {puts $ch "PlotScatterTool"} - } + puts $ch "PlotDialog $varname $varname" + set cc $var(graph,current) set gr $var(graph,current) set ds $var(graph,ds,current) - set first 1 foreach cc $var(graphs) { set var(graph,current) $cc PlotCurrentGraph $varname - if {!$first} { - puts $ch "PlotAddGraph $varname $var($cc,type)" - } - set first 0 + puts $ch "PlotAddGraph $varname $var($cc,type)" foreach nn $var($cc,dss) { set var(graph,ds,current) $nn @@ -768,6 +760,7 @@ proc PlotBackup {ch dir} { puts $ch "PlotLoadConfigFile $varname $fdir/graph${cc}ds${nn}.plt" } } + puts $ch "wm geometry $var(top) [winfo width $var(top)]x[winfo height $var(top)]" set var(graph,current) $gr PlotCurrentGraph $varname diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl index 4c05ec3..ac56026 100644 --- a/ds9/library/plotbar.tcl +++ b/ds9/library/plotbar.tcl @@ -30,7 +30,8 @@ proc PlotBar {tt wtt title xaxis yaxis dim data} { upvar #0 $varname var global $varname - PlotBarDialog $varname $wtt + PlotDialog $varname $wtt + PlotAddGraph $varname bar PlotTitle $varname $title $xaxis $yaxis PlotAddDataSet $varname $dim $data PlotStats $varname @@ -48,14 +49,6 @@ proc PlotBar {tt wtt title xaxis yaxis dim data} { } } -proc PlotBarDialog {varname wtt} { - upvar #0 $varname var - global $varname - - PlotDialog $varname $wtt - PlotAddGraph $varname bar -} - proc PlotBarMenus {varname} { upvar #0 $varname var global $varname diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl index e275332..576ce29 100644 --- a/ds9/library/plotline.tcl +++ b/ds9/library/plotline.tcl @@ -30,7 +30,8 @@ proc PlotLine {tt wtt title xaxis yaxis dim data} { upvar #0 $varname var global $varname - PlotLineDialog $varname $wtt + PlotDialog $varname $wtt + PlotAddGraph $varname line PlotTitle $varname $title $xaxis $yaxis PlotAddDataSet $varname $dim $data PlotStats $varname @@ -48,14 +49,6 @@ proc PlotLine {tt wtt title xaxis yaxis dim data} { } } -proc PlotLineDialog {varname wtt} { - upvar #0 $varname var - global $varname - - PlotDialog $varname $wtt - PlotAddGraph $varname line -} - proc PlotLineMenus {varname} { upvar #0 $varname var global $varname diff --git a/ds9/library/plotscatter.tcl b/ds9/library/plotscatter.tcl index 1b48f6f..d9d6029 100644 --- a/ds9/library/plotscatter.tcl +++ b/ds9/library/plotscatter.tcl @@ -30,7 +30,8 @@ proc PlotScatter {tt wtt title xaxis yaxis dim data} { upvar #0 $varname var global $varname - PlotScatterDialog $varname $wtt + PlotDialog $varname $wtt + PlotAddGraph $varname scatter PlotTitle $varname $title $xaxis $yaxis PlotAddDataSet $varname $dim $data PlotStats $varname @@ -48,15 +49,6 @@ proc PlotScatter {tt wtt title xaxis yaxis dim data} { } } -proc PlotScatterDialog {varname wtt} { - upvar #0 $varname var - global $varname - - PlotDialog $varname $wtt - PlotAddGraph $varname scatter -} - - proc PlotScatterMenus {varname} { upvar #0 $varname var global $varname @@ -163,14 +155,18 @@ proc PlotScatterUpdateElement {varname} { PlotSaveState $varname +# DumpCallStack + set cc $var(graph,current) if {[llength $var($cc,dss)] == 0} { return } +# puts "***$var(graph,ds,shape,symbol)" if {$var(graph,ds,shape,symbol) == "none"} { set var(graph,ds,shape,symbol) circle } +# puts "=$var(graph,ds,shape,symbol)" if {$var(graph,ds,shape,fill)} { set clr $var(graph,ds,shape,color) diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl index 893d172..439c045 100644 --- a/ds9/library/plotstate.tcl +++ b/ds9/library/plotstate.tcl @@ -242,9 +242,9 @@ proc PlotRestoreState {varname} { set var(graph) $var($cc,graph) set var(graph,type) $var($cc,type) - set var(graph,proc,updateelement) $var(graph,proc,updateelement) - set var(graph,proc,highlite) $var(graph,proc,highlite) - set var(graph,proc,button) $var(graph,proc,button) + set var(graph,proc,updateelement) $var($cc,proc,updateelement) + set var(graph,proc,highlite) $var($cc,proc,highlite) + set var(graph,proc,button) $var($cc,proc,button) set var(graph,name) $var($cc,name) set var(graph,format) $var($cc,format) -- cgit v0.12