summaryrefslogtreecommitdiff
path: root/ext/tk/sample/tkextlib/blt/pareto.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/tkextlib/blt/pareto.rb')
-rw-r--r--ext/tk/sample/tkextlib/blt/pareto.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/ext/tk/sample/tkextlib/blt/pareto.rb b/ext/tk/sample/tkextlib/blt/pareto.rb
index 94d5f3f97f..bf9a1ec749 100644
--- a/ext/tk/sample/tkextlib/blt/pareto.rb
+++ b/ext/tk/sample/tkextlib/blt/pareto.rb
@@ -8,21 +8,21 @@ require 'tkextlib/blt'
# The pareto chart mixes line and bar elements in the same graph.
# Each processing operating is represented by a bar element. The
# total accumulated defects is displayed with a single line element.
-b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection',
- :font=>'Helvetica 12', :plotpady=>[12, 4],
+b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection',
+ :font=>'Helvetica 12', :plotpady=>[12, 4],
:width=>'6i', :height=>'5i')
Tk::BLT::Table.add(Tk.root, b, :fill=>:both)
data = [
- ["Spot Weld", 82, 'yellow'],
- ["Lathe", 49, 'orange'],
- ["Gear Cut", 38, 'green'],
- ["Drill", 24, 'blue'],
- ["Grind", 17, 'red'],
- ["Lapping", 12, 'brown'],
- ["Press", 8, 'purple'],
- ["De-burr", 4, 'pink'],
- ["Packaging", 3, 'cyan'],
+ ["Spot Weld", 82, 'yellow'],
+ ["Lathe", 49, 'orange'],
+ ["Gear Cut", 38, 'green'],
+ ["Drill", 24, 'blue'],
+ ["Grind", 17, 'red'],
+ ["Lapping", 12, 'brown'],
+ ["Press", 8, 'purple'],
+ ["De-burr", 4, 'pink'],
+ ["Packaging", 3, 'cyan'],
["Other", 12, 'magenta']
]
@@ -41,8 +41,8 @@ labels = []
data.each{|label, value, color|
count += 1
- b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color,
- :relief=>:solid, :borderwidth=>1, :stipple=>pattern1,
+ b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color,
+ :relief=>:solid, :borderwidth=>1, :stipple=>pattern1,
:background=>'lightblue')
labels[count] = label
# Get the total number of defects.
@@ -51,7 +51,7 @@ data.each{|label, value, color|
xdata << count
}
-# Configure the coordinates of the accumulated defects,
+# Configure the coordinates of the accumulated defects,
# now that we know what they are.
b.element_configure('accum', :xdata=>xdata, :ydata=>ydata)
@@ -63,19 +63,19 @@ xdata.zip(ydata){|x, y|
else
text = '%.1f' % percent
end
- b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10',
+ b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10',
:foreground=>'red4', :anchor=>:center, :yoffset=>-5)
}
# Display an auxillary y-axis for percentages.
-b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0,
+b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0,
:title=>'Percentage')
# Title the y-axis
b.axis_configure('y', :title=>'Defects')
# Configure the x-axis to display the process names, instead of numbers.
-b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0,
+b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0,
:command=>proc{|w, val|
val = val.round
labels[val]? labels[val]: val