diff options
Diffstat (limited to 'ext/tk/sample/tkextlib/tcllib')
-rw-r--r-- | ext/tk/sample/tkextlib/tcllib/datefield.rb | 4 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tcllib/plotdemos1.rb | 22 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tcllib/plotdemos2.rb | 30 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tcllib/plotdemos3.rb | 38 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tcllib/xyplot.rb | 2 |
5 files changed, 48 insertions, 48 deletions
diff --git a/ext/tk/sample/tkextlib/tcllib/datefield.rb b/ext/tk/sample/tkextlib/tcllib/datefield.rb index 1b0a29c0b9..cfeca0c6de 100644 --- a/ext/tk/sample/tkextlib/tcllib/datefield.rb +++ b/ext/tk/sample/tkextlib/tcllib/datefield.rb @@ -21,8 +21,8 @@ my_date1.trace('w'){ df = Tk::Tcllib::Datefield.new(:textvariable=>my_date1) Tk.grid(TkLabel.new(:text=>'Enter a date:', :anchor=>:e), df, :sticky=>:ew) Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e), - TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), - :sticky=>:ew) + TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), + :sticky=>:ew) df.set_focus diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb index 6077d8ab2c..053b0de085 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb @@ -24,7 +24,7 @@ Tk.pack(vc1,vc2,vc3, :fill=>:both, :side=>:top) ############################### s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) + [0.0, 100.0, 20.0]) xd = 5.0 @@ -57,7 +57,7 @@ s.save_plot "aha.ps" s = Tk::Tcllib::Plotchart::Piechart.new(c2) s.plot([ ["Long names", 10], ["Short names", 30], - ["Average", 40], ["Ultra-short names", 5] ]) + ["Average", 40], ["Ultra-short names", 5] ]) # # Note: title should be shifted up @@ -79,7 +79,7 @@ s.title "Cardioid" ############################### s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E), - [0.0, 10.0, 2.0], 2) + [0.0, 10.0, 2.0], 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -88,7 +88,7 @@ s.title "Arbitrary data" ############################### s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E), - [0.0, 20.0, 5.0], :stacked) + [0.0, 20.0, 5.0], :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -97,7 +97,7 @@ s.title "Stacked diagram" ############################### s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0], - %w(A B C D E), 2) + %w(A B C D E), 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -106,7 +106,7 @@ s.title "Arbitrary data" ############################### s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0], - %w(A B C D E), :stacked) + %w(A B C D E), :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green') @@ -115,7 +115,7 @@ s.title "Stacked diagram" ############################### s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004", - "31 december 2004", 4) + "31 december 2004", 4) s.period("Spring", "1 march 2004", "1 june 2004", 'green') s.period("Summer", "1 june 2004", "1 september 2004", 'yellow') @@ -135,7 +135,7 @@ zc2 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>250) Tk.pack(zc1,zc2) s = Tk::Tcllib::Plotchart::Plot3D.new(zc1, - [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) + [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot" s.plot_function{|x, y| @@ -146,12 +146,12 @@ s.plot_function{|x, y| } s = Tk::Tcllib::Plotchart::Plot3D.new(zc2, - [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) + [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot - data " s.colour("green", "black") s.plot_data([ [1.0, 2.0, 1.0, 0.0], - [1.1, 3.0, 1.1, -0.5], - [3.0, 1.0, 4.0, 5.0] ]) + [1.1, 3.0, 1.1, -0.5], + [3.0, 1.0, 4.0, 5.0] ]) ############################### diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb index 3fd57f3804..33a6f29940 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb @@ -13,21 +13,21 @@ Tk.pack(c1,c2, :fill=>:both, :side=>:top) # Set up a strip chart ############################### slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) + [0.0, 100.0, 20.0]) TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object - slipchart, xold, xd, yold, yd = obj.return_value - xnew = xold + xd - ynew = yold + (rand() - 0.5) * yd - ynew2 = yold + (rand() - 0.5) * 2.0 * yd - slipchart.plot('series1', xnew, ynew) - slipchart.plot('series2', xnew, ynew2) - obj.stop if xnew >= 200 - [slipchart, xnew, xd, ynew, yd] # return_value - }).start(100, proc{ - # init return_value - [slipchart, 0.0, 15.0, 50.0, 30.0] - }) + slipchart, xold, xd, yold, yd = obj.return_value + xnew = xold + xd + ynew = yold + (rand() - 0.5) * yd + ynew2 = yold + (rand() - 0.5) * 2.0 * yd + slipchart.plot('series1', xnew, ynew) + slipchart.plot('series2', xnew, ynew2) + obj.stop if xnew >= 200 + [slipchart, xnew, xd, ynew, yd] # return_value + }).start(100, proc{ + # init return_value + [slipchart, 0.0, 15.0, 50.0, 30.0] + }) slipchart.title "Aha!" @@ -35,7 +35,7 @@ slipchart.title "Aha!" # Set up an isometric plot ############################### s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0], - :noaxes) + :noaxes) s.set_zoom_pan @@ -51,7 +51,7 @@ h = TkToplevel.new(:title=>'h') c = TkCanvas.new(h, :bg=>'white', :width=>400, :height=>200).pack(:fill=>:both) s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) + [0.0, 100.0, 20.0]) s.dataconfig('series1', :colour=>'red', :type=>:symbol) s.dataconfig('series2', :colour=>'green', :type=>:both) diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb index 3b74b1f592..2b5c7642bb 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb @@ -8,9 +8,9 @@ require 'tkextlib/tcllib/plotchart' ############################### Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :background=>'white', - :width=>400, :height=>200){|chart| + [0.0, 100.0, 20.0], + :background=>'white', + :width=>400, :height=>200){|chart| title "Aha!" pack(:fill=>:both, :side=>:top) @@ -21,26 +21,26 @@ Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], yd = 30.0 TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object - xold, yold = obj.return_value - xnew = xold + xd - ynew = yold + (rand() - 0.5) * yd - ynew2 = yold + (rand() - 0.5) * 2.0 * yd + xold, yold = obj.return_value + xnew = xold + xd + ynew = yold + (rand() - 0.5) * yd + ynew2 = yold + (rand() - 0.5) * 2.0 * yd - series1.plot(xnew, ynew) - series2.plot(xnew, ynew2) + series1.plot(xnew, ynew) + series2.plot(xnew, ynew2) - obj.stop if xnew >= 200 + obj.stop if xnew >= 200 - [xnew, ynew] # return_value - }).start(100, proc{ [0.0, 50.0] }) # init return_value + [xnew, ynew] # return_value + }).start(100, proc{ [0.0, 50.0] }) # init return_value } ############################### # Set up an isometric plot ############################### Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, - :background=>'white', - :width=>400, :height=>200){|chart| + :background=>'white', + :width=>400, :height=>200){|chart| pack(:fill=>:both, :side=>:top) set_zoom_pan @@ -55,17 +55,17 @@ Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, ############################### TkToplevel.new(:title=>'h'){|h| Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :bg=>'white', - :width=>400, :height=>200){|chart| + [0.0, 100.0, 20.0], + :bg=>'white', + :width=>400, :height=>200){|chart| pack(:fill=>:both) yconfig(:format=>"%12.2e") series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red', - :type=>:symbol) + :type=>:symbol) series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green', - :type=>:both) + :type=>:both) x = 5.0 %w(plus cross circle up down dot upfilled downfilled).each{|sym| diff --git a/ext/tk/sample/tkextlib/tcllib/xyplot.rb b/ext/tk/sample/tkextlib/tcllib/xyplot.rb index 116609e34f..8f8c3eb880 100644 --- a/ext/tk/sample/tkextlib/tcllib/xyplot.rb +++ b/ext/tk/sample/tkextlib/tcllib/xyplot.rb @@ -6,7 +6,7 @@ require 'tkextlib/tcllib/plotchart' TkCanvas.new(:background=>'white', :width=>400, :height=>200){|c| pack(:fill=>:both) Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]){ + [0.0, 100.0, 20.0]){ [ [0.0, 32.0], [10.0, 50.0], [25.0, 60.0], [78.0, 11.0] ].each{|x, y| plot('series1', x, y) } |