5
file = File.join(File.dirname(File.expand_path(__FILE__)),
6
'images', 'buckskin.gif')
7
bgTexture = TkPhotoImage.new(:file=>file)
9
TkOption.add('*Graph.Tile', bgTexture)
10
TkOption.add('*Label.Tile', bgTexture)
11
TkOption.add('*Frame.Tile', bgTexture)
12
TkOption.add('*Htext.Tile', bgTexture)
13
TkOption.add('*TileOffset', 0)
14
TkOption.add('*HighlightThickness', 0)
15
TkOption.add('*Element.ScaleSybols', false)
16
TkOption.add('*Element.Smooth', :linear)
17
TkOption.add('*activeLine.Color', 'yellow4')
18
TkOption.add('*activeLine.Fill', 'yellow')
19
TkOption.add('*activeLine.LineWidth', 0)
20
TkOption.add('*Element.Pixels', 3)
21
TkOption.add('*Graph.halo', '7i')
23
if Tk.root.winfo_screenvisual != 'staticgray'
24
TkOption.add('*print.background', 'yellow')
25
TkOption.add('*quit.background', 'red')
29
graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
30
graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
31
graph.yaxis_configure(:title=>'Y Axis Label')
32
graph.legend_configure(:activerelief=>:sunken, :background=>'')
34
Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
36
v_x = Tk::BLT::Vector.new(length)
37
v_y = Tk::BLT::Vector.new(length)
38
v_x.expr("random(#{v_x})")
39
v_y.expr("random(#{v_y})")
42
plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
43
:color=>'green4', :fill=>'green2',
44
:linewidth=>0, :outlinewidth=>1,
45
:pixels=>4, :label=>'plot',
46
:xdata=>v_x, :ydata=>v_y)
54
Tk::BLT.zoom_stack(graph)
55
Tk::BLT.crosshairs(graph)
56
Tk::BLT.active_legend(graph)
57
Tk::BLT.closest_point(graph)
59
Tk::BLT::Busy.hold(graph)
61
Tk::BLT::Busy.release(graph)