diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-05-24 18:05:05 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-05-24 18:05:05 (GMT) |
commit | c79a0b8a9aadd5d43cb9366cada358e6fa20ce30 (patch) | |
tree | b60120faed288577555fdd89a62298de83dbded5 | |
parent | cdb0395c318af057350a1f9999c2d74d309d26bf (diff) | |
download | blt-c79a0b8a9aadd5d43cb9366cada358e6fa20ce30.zip blt-c79a0b8a9aadd5d43cb9366cada358e6fa20ce30.tar.gz blt-c79a0b8a9aadd5d43cb9366cada358e6fa20ce30.tar.bz2 |
add strip plot support
-rw-r--r-- | ds9/library/plot.tcl | 41 | ||||
-rw-r--r-- | ds9/library/plotbar.tcl | 28 | ||||
-rw-r--r-- | ds9/library/plotdialog.tcl | 3 | ||||
-rw-r--r-- | ds9/library/plotline.tcl | 26 | ||||
-rw-r--r-- | ds9/library/plotscatter.tcl | 26 |
5 files changed, 61 insertions, 63 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index 6e5a875..706ba86 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -90,7 +90,7 @@ proc PlotAddGraph {varname} { global ds9 incr ${varname}(graph,total) - incr ${varname}(graph,current) 0 + incr ${varname}(graph,current) set cc $var(graph,current) @@ -101,6 +101,38 @@ proc PlotAddGraph {varname} { set var(data,current) $var(graph$cc,data,current) $var(proc,addgraph) $varname + + set var(graph) $var(graph$cc) + set var(type) $var(type$cc) + + pack $var(graph) -expand yes -fill both + + # set up zoom stack, assuming mode is zoom + global ds9 + switch $ds9(wm) { + x11 - + win32 {Blt_ZoomStack $var(graph) -mode release} + aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"} + } +} + +proc PlotDeleteGraph {varname} { + upvar #0 $varname var + global $varname + + set cc $var(graph,current) + if {$cc>1} { + destroy $var(graph$cc) + + incr ${varname}(graph,total) -1 + incr ${varname}(graph,current) -1 + + set cc $var(graph,current) + + set var(graph) $var(graph$cc) + set var(data,total) $var(graph$cc,data,total) + set var(data,current) $var(graph$cc,data,current) + } } proc PlotAxisFormat {varname axis w nn} { @@ -459,13 +491,6 @@ proc PlotDataSetOne {varname dim data} { $var(proc,updateelement) $varname } -proc PlotDeleteGraph {varname} { - upvar #0 $varname var - global $varname - - global ds9 -} - proc PlotDupData {varname mm} { upvar #0 $varname var global $varname diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl index 2648147..8b5e5da 100644 --- a/ds9/library/plotbar.tcl +++ b/ds9/library/plotbar.tcl @@ -148,27 +148,17 @@ proc PlotBarAddGraph {varname} { upvar #0 $varname var global $varname - set var(type) bar - set var(canvas) [ttk::frame $var(top).fr] - set var(graph) [blt::barchart $var(canvas).bar \ - -width 600 \ - -height 500 \ - -highlightthickness 0 \ - ] + set cc $var(graph,current) - $var(graph) xaxis configure -grid no -stepsize 0 - $var(graph) yaxis configure -grid yes + set var(type$cc) bar + set var(graph$cc) [blt::barchart $var(canvas).gr$cc \ + -width 600 \ + -height 500 \ + -highlightthickness 0 \ + ] - pack $var(graph) -expand yes -fill both - pack $var(canvas) -expand yes -fill both - - # set up zoom stack, assuming mode is zoom - global ds9 - switch $ds9(wm) { - x11 - - win32 {Blt_ZoomStack $var(graph) -mode release} - aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"} - } + $var(graph$cc) xaxis configure -grid no -stepsize 0 + $var(graph$cc) yaxis configure -grid yes } proc PlotBarUpdateGraph {varname} { diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl index 3c0fce7..a843179 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -224,6 +224,9 @@ proc PlotDialog {varname wtt title xaxis yaxis} { # dataset menu $var(mb).data + set var(canvas) [ttk::frame $var(top).fr] + pack $var(canvas) -expand yes -fill both + set var(graph,total) 0 set var(graph,current) 0 } diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl index 42f8b0f..1ef9ab4 100644 --- a/ds9/library/plotline.tcl +++ b/ds9/library/plotline.tcl @@ -228,24 +228,14 @@ proc PlotLineAddGraph {varname} { upvar #0 $varname var global $varname - set var(type) line - set var(canvas) [ttk::frame $var(top).fr] - set var(graph) [blt::graph $var(canvas).line \ - -width 600 \ - -height 500 \ - -highlightthickness 0 \ - ] - - pack $var(graph) -expand yes -fill both - pack $var(canvas) -expand yes -fill both - - # set up zoom stack, assuming mode is zoom - global ds9 - switch $ds9(wm) { - x11 - - win32 {Blt_ZoomStack $var(graph) -mode release} - aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"} - } + set cc $var(graph,current) + + set var(type$cc) line + set var(graph$cc) [blt::graph $var(canvas).gr$cc \ + -width 600 \ + -height 500 \ + -highlightthickness 0 \ + ] } proc PlotLineUpdateElement {varname} { diff --git a/ds9/library/plotscatter.tcl b/ds9/library/plotscatter.tcl index a4d4678..3b3dfa7 100644 --- a/ds9/library/plotscatter.tcl +++ b/ds9/library/plotscatter.tcl @@ -154,24 +154,14 @@ proc PlotScatterAddGraph {varname} { upvar #0 $varname var global $varname - set var(type) scatter - set var(canvas) [ttk::frame $var(top).fr] - set var(graph) [blt::graph $var(canvas).scatter \ - -width 600 \ - -height 500 \ - -highlightthickness 0 \ - ] - - pack $var(graph) -expand yes -fill both - pack $var(canvas) -expand yes -fill both - - # set up zoom stack, assuming mode is zoom - global ds9 - switch $ds9(wm) { - x11 - - win32 {Blt_ZoomStack $var(graph) -mode release} - aqua {Blt_ZoomStack $var(graph) -mode release -button "ButtonPress-2"} - } + set cc $var(graph,current) + + set var(type$cc) scatter + set var(graph$cc) [blt::graph $var(canvas).gr$cc \ + -width 600 \ + -height 500 \ + -highlightthickness 0 \ + ] } proc PlotScatterUpdateElement {varname} { |