Update SVG library to latest stable (0.6.1) (#3056).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2642 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8d6d9a80d2
commit
c9c269abf7
|
@ -96,37 +96,48 @@ module SVG
|
||||||
end
|
end
|
||||||
|
|
||||||
def draw_data
|
def draw_data
|
||||||
fieldwidth = field_width
|
|
||||||
maxvalue = max_value
|
|
||||||
minvalue = min_value
|
minvalue = min_value
|
||||||
|
fieldwidth = field_width
|
||||||
|
|
||||||
fieldheight = (@graph_height.to_f - font_size*2*top_font) /
|
unit_size = (@graph_height.to_f - font_size*2*top_font) /
|
||||||
(get_y_labels.max - get_y_labels.min)
|
(get_y_labels.max - get_y_labels.min)
|
||||||
bargap = bar_gap ? (fieldwidth < 10 ? fieldwidth / 2 : 10) : 0
|
bargap = bar_gap ? (fieldwidth < 10 ? fieldwidth / 2 : 10) : 0
|
||||||
|
|
||||||
subbar_width = fieldwidth - bargap
|
bar_width = fieldwidth - bargap
|
||||||
subbar_width /= @data.length if stack == :side
|
bar_width /= @data.length if stack == :side
|
||||||
x_mod = (@graph_width-bargap)/2 - (stack==:side ? subbar_width/2 : 0)
|
x_mod = (@graph_width-bargap)/2 - (stack==:side ? bar_width/2 : 0)
|
||||||
# Y1
|
|
||||||
p2 = @graph_height
|
bottom = @graph_height
|
||||||
# to X2
|
|
||||||
field_count = 0
|
field_count = 0
|
||||||
@config[:fields].each_index { |i|
|
@config[:fields].each_index { |i|
|
||||||
dataset_count = 0
|
dataset_count = 0
|
||||||
for dataset in @data
|
for dataset in @data
|
||||||
# X1
|
|
||||||
p1 = (fieldwidth * field_count)
|
# cases (assume 0 = +ve):
|
||||||
# to Y2
|
# value min length
|
||||||
p3 = @graph_height - ((dataset[:data][i] - minvalue) * fieldheight)
|
# +ve +ve value - min
|
||||||
p1 += subbar_width * dataset_count if stack == :side
|
# +ve -ve value - 0
|
||||||
@graph.add_element( "path", {
|
# -ve -ve value.abs - 0
|
||||||
"class" => "fill#{dataset_count+1}",
|
|
||||||
"d" => "M#{p1} #{p2} V#{p3} h#{subbar_width} V#{p2} Z"
|
value = dataset[:data][i]
|
||||||
|
|
||||||
|
left = (fieldwidth * field_count)
|
||||||
|
|
||||||
|
length = (value.abs - (minvalue > 0 ? minvalue : 0)) * unit_size
|
||||||
|
# top is 0 if value is negative
|
||||||
|
top = bottom - (((value < 0 ? 0 : value) - minvalue) * unit_size)
|
||||||
|
left += bar_width * dataset_count if stack == :side
|
||||||
|
|
||||||
|
@graph.add_element( "rect", {
|
||||||
|
"x" => left.to_s,
|
||||||
|
"y" => top.to_s,
|
||||||
|
"width" => bar_width.to_s,
|
||||||
|
"height" => length.to_s,
|
||||||
|
"class" => "fill#{dataset_count+1}"
|
||||||
})
|
})
|
||||||
make_datapoint_text(
|
|
||||||
p1 + subbar_width/2.0,
|
make_datapoint_text(left + bar_width/2.0, top - 6, value.to_s)
|
||||||
p3 - 6,
|
|
||||||
dataset[:data][i].to_s)
|
|
||||||
dataset_count += 1
|
dataset_count += 1
|
||||||
end
|
end
|
||||||
field_count += 1
|
field_count += 1
|
||||||
|
|
|
@ -43,18 +43,17 @@ module SVG
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def max_value
|
def max_value
|
||||||
return @data.collect{|x| x[:data].max}.max
|
@data.collect{|x| x[:data].max}.max
|
||||||
end
|
end
|
||||||
|
|
||||||
def min_value
|
def min_value
|
||||||
min = 0
|
min = 0
|
||||||
|
if min_scale_value.nil?
|
||||||
if (min_scale_value.nil? == false) then
|
|
||||||
min = min_scale_value
|
|
||||||
else
|
|
||||||
min = @data.collect{|x| x[:data].min}.min
|
min = @data.collect{|x| x[:data].min}.min
|
||||||
|
min = min > 0 ? 0 : min
|
||||||
|
else
|
||||||
|
min = min_scale_value
|
||||||
end
|
end
|
||||||
|
|
||||||
return min
|
return min
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -103,28 +103,41 @@ module SVG
|
||||||
def draw_data
|
def draw_data
|
||||||
minvalue = min_value
|
minvalue = min_value
|
||||||
fieldheight = field_height
|
fieldheight = field_height
|
||||||
fieldwidth = (@graph_width.to_f - font_size*2*right_font ) /
|
|
||||||
|
unit_size = (@graph_width.to_f - font_size*2*right_font ) /
|
||||||
(get_x_labels.max - get_x_labels.min )
|
(get_x_labels.max - get_x_labels.min )
|
||||||
bargap = bar_gap ? (fieldheight < 10 ? fieldheight / 2 : 10) : 0
|
bargap = bar_gap ? (fieldheight < 10 ? fieldheight / 2 : 10) : 0
|
||||||
|
|
||||||
subbar_height = fieldheight - bargap
|
bar_height = fieldheight - bargap
|
||||||
subbar_height /= @data.length if stack == :side
|
bar_height /= @data.length if stack == :side
|
||||||
|
y_mod = (bar_height / 2) + (font_size / 2)
|
||||||
|
|
||||||
field_count = 1
|
field_count = 1
|
||||||
y_mod = (subbar_height / 2) + (font_size / 2)
|
|
||||||
@config[:fields].each_index { |i|
|
@config[:fields].each_index { |i|
|
||||||
dataset_count = 0
|
dataset_count = 0
|
||||||
for dataset in @data
|
for dataset in @data
|
||||||
y = @graph_height - (fieldheight * field_count)
|
value = dataset[:data][i]
|
||||||
y += (subbar_height * dataset_count) if stack == :side
|
|
||||||
x = (dataset[:data][i] - minvalue) * fieldwidth
|
|
||||||
|
|
||||||
@graph.add_element( "path", {
|
top = @graph_height - (fieldheight * field_count)
|
||||||
"d" => "M0 #{y} H#{x} v#{subbar_height} H0 Z",
|
top += (bar_height * dataset_count) if stack == :side
|
||||||
|
# cases (assume 0 = +ve):
|
||||||
|
# value min length left
|
||||||
|
# +ve +ve value.abs - min minvalue.abs
|
||||||
|
# +ve -ve value.abs - 0 minvalue.abs
|
||||||
|
# -ve -ve value.abs - 0 minvalue.abs + value
|
||||||
|
length = (value.abs - (minvalue > 0 ? minvalue : 0)) * unit_size
|
||||||
|
left = (minvalue.abs + (value < 0 ? value : 0)) * unit_size
|
||||||
|
|
||||||
|
@graph.add_element( "rect", {
|
||||||
|
"x" => left.to_s,
|
||||||
|
"y" => top.to_s,
|
||||||
|
"width" => length.to_s,
|
||||||
|
"height" => bar_height.to_s,
|
||||||
"class" => "fill#{dataset_count+1}"
|
"class" => "fill#{dataset_count+1}"
|
||||||
})
|
})
|
||||||
|
|
||||||
make_datapoint_text(
|
make_datapoint_text(
|
||||||
x+5, y+y_mod, dataset[:data][i], "text-anchor: start; "
|
left+length+5, top+y_mod, value, "text-anchor: start; "
|
||||||
)
|
)
|
||||||
dataset_count += 1
|
dataset_count += 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -110,7 +110,7 @@ module SVG
|
||||||
:show_y_guidelines => true,
|
:show_y_guidelines => true,
|
||||||
:show_data_values => true,
|
:show_data_values => true,
|
||||||
|
|
||||||
:min_scale_value => 0,
|
# :min_scale_value => 0,
|
||||||
|
|
||||||
:show_x_labels => true,
|
:show_x_labels => true,
|
||||||
:stagger_x_labels => false,
|
:stagger_x_labels => false,
|
||||||
|
@ -137,14 +137,14 @@ module SVG
|
||||||
:key => true,
|
:key => true,
|
||||||
:key_position => :right, # bottom or right
|
:key_position => :right, # bottom or right
|
||||||
|
|
||||||
:font_size =>10,
|
:font_size =>12,
|
||||||
:title_font_size =>12,
|
:title_font_size =>16,
|
||||||
:subtitle_font_size =>14,
|
:subtitle_font_size =>14,
|
||||||
:x_label_font_size =>11,
|
:x_label_font_size =>12,
|
||||||
:x_title_font_size =>14,
|
:x_title_font_size =>14,
|
||||||
:y_label_font_size =>11,
|
:y_label_font_size =>12,
|
||||||
:y_title_font_size =>14,
|
:y_title_font_size =>14,
|
||||||
:key_font_size => 9,
|
:key_font_size =>10,
|
||||||
|
|
||||||
:no_css =>false,
|
:no_css =>false,
|
||||||
:add_popups =>false,
|
:add_popups =>false,
|
||||||
|
@ -392,7 +392,7 @@ module SVG
|
||||||
@border_right = 7
|
@border_right = 7
|
||||||
if key and key_position == :right
|
if key and key_position == :right
|
||||||
val = keys.max { |a,b| a.length <=> b.length }
|
val = keys.max { |a,b| a.length <=> b.length }
|
||||||
@border_right += val.length * key_font_size * 0.7
|
@border_right += val.length * key_font_size * 0.6
|
||||||
@border_right += KEY_BOX_SIZE
|
@border_right += KEY_BOX_SIZE
|
||||||
@border_right += 10 # Some padding around the box
|
@border_right += 10 # Some padding around the box
|
||||||
end
|
end
|
||||||
|
@ -421,7 +421,7 @@ module SVG
|
||||||
t.attributes["style"] = "fill: #000; "+
|
t.attributes["style"] = "fill: #000; "+
|
||||||
(x+txt_width > width ? "text-anchor: end;" : "text-anchor: start;")
|
(x+txt_width > width ? "text-anchor: end;" : "text-anchor: start;")
|
||||||
t.text = label.to_s
|
t.text = label.to_s
|
||||||
t.attributes["id"] = t.id.to_s
|
t.attributes["id"] = t.object_id.to_s
|
||||||
|
|
||||||
@foreground.add_element( "circle", {
|
@foreground.add_element( "circle", {
|
||||||
"cx" => x.to_s,
|
"cx" => x.to_s,
|
||||||
|
@ -429,9 +429,9 @@ module SVG
|
||||||
"r" => "10",
|
"r" => "10",
|
||||||
"style" => "opacity: 0",
|
"style" => "opacity: 0",
|
||||||
"onmouseover" =>
|
"onmouseover" =>
|
||||||
"document.getElementById(#{t.id}).setAttribute('visibility', 'visible' )",
|
"document.getElementById(#{t.object_id}).setAttribute('visibility', 'visible' )",
|
||||||
"onmouseout" =>
|
"onmouseout" =>
|
||||||
"document.getElementById(#{t.id}).setAttribute('visibility', 'hidden' )",
|
"document.getElementById(#{t.object_id}).setAttribute('visibility', 'hidden' )",
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -446,11 +446,11 @@ module SVG
|
||||||
@border_bottom += 10
|
@border_bottom += 10
|
||||||
end
|
end
|
||||||
if show_x_labels
|
if show_x_labels
|
||||||
max_x_label_height_px = rotate_x_labels ?
|
max_x_label_height_px = (not rotate_x_labels) ?
|
||||||
|
x_label_font_size :
|
||||||
get_x_labels.max{|a,b|
|
get_x_labels.max{|a,b|
|
||||||
a.length<=>b.length
|
a.to_s.length<=>b.to_s.length
|
||||||
}.length * x_label_font_size * 0.6 :
|
}.to_s.length * x_label_font_size * 0.6
|
||||||
x_label_font_size
|
|
||||||
@border_bottom += max_x_label_height_px
|
@border_bottom += max_x_label_height_px
|
||||||
@border_bottom += max_x_label_height_px + 10 if stagger_x_labels
|
@border_bottom += max_x_label_height_px + 10 if stagger_x_labels
|
||||||
end
|
end
|
||||||
|
@ -723,7 +723,7 @@ module SVG
|
||||||
})
|
})
|
||||||
group.add_element( "text", {
|
group.add_element( "text", {
|
||||||
"x" => (KEY_BOX_SIZE + 5).to_s,
|
"x" => (KEY_BOX_SIZE + 5).to_s,
|
||||||
"y" => (y_offset + KEY_BOX_SIZE - 2).to_s,
|
"y" => (y_offset + KEY_BOX_SIZE).to_s,
|
||||||
"class" => "keyText"
|
"class" => "keyText"
|
||||||
}).text = key_name.to_s
|
}).text = key_name.to_s
|
||||||
key_count += 1
|
key_count += 1
|
||||||
|
@ -737,10 +737,11 @@ module SVG
|
||||||
x_offset = @border_left + 20
|
x_offset = @border_left + 20
|
||||||
y_offset = @border_top + @graph_height + 5
|
y_offset = @border_top + @graph_height + 5
|
||||||
if show_x_labels
|
if show_x_labels
|
||||||
max_x_label_height_px = rotate_x_labels ?
|
max_x_label_height_px = (not rotate_x_labels) ?
|
||||||
|
x_label_font_size :
|
||||||
get_x_labels.max{|a,b|
|
get_x_labels.max{|a,b|
|
||||||
a.length<=>b.length
|
a.to_s.length<=>b.to_s.length
|
||||||
}.length * x_label_font_size :
|
}.to_s.length * x_label_font_size * 0.6
|
||||||
x_label_font_size
|
x_label_font_size
|
||||||
y_offset += max_x_label_height_px
|
y_offset += max_x_label_height_px
|
||||||
y_offset += max_x_label_height_px + 5 if stagger_x_labels
|
y_offset += max_x_label_height_px + 5 if stagger_x_labels
|
||||||
|
@ -883,41 +884,41 @@ module SVG
|
||||||
fill:#ffffff;
|
fill:#ffffff;
|
||||||
}
|
}
|
||||||
.graphBackground{
|
.graphBackground{
|
||||||
fill:#f5f5f5;
|
fill:#f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* graphs titles */
|
/* graphs titles */
|
||||||
.mainTitle{
|
.mainTitle{
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
fill: #555555;
|
fill: #000000;
|
||||||
font-size: #{title_font_size}px;
|
font-size: #{title_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: bold;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
.subTitle{
|
.subTitle{
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
fill: #999999;
|
fill: #999999;
|
||||||
font-size: #{subtitle_font_size}px;
|
font-size: #{subtitle_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.axis{
|
.axis{
|
||||||
stroke: #666666;
|
stroke: #000000;
|
||||||
stroke-width: 1px;
|
stroke-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guideLines{
|
.guideLines{
|
||||||
stroke: #666666;
|
stroke: #666666;
|
||||||
stroke-width: 1px;
|
stroke-width: 1px;
|
||||||
stroke-dasharray:2,2,2;
|
stroke-dasharray: 5 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xAxisLabels{
|
.xAxisLabels{
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
fill: #000000;
|
fill: #000000;
|
||||||
font-size: #{x_label_font_size}px;
|
font-size: #{x_label_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +926,7 @@ module SVG
|
||||||
text-anchor: end;
|
text-anchor: end;
|
||||||
fill: #000000;
|
fill: #000000;
|
||||||
font-size: #{y_label_font_size}px;
|
font-size: #{y_label_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,7 +934,7 @@ module SVG
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
fill: #ff0000;
|
fill: #ff0000;
|
||||||
font-size: #{x_title_font_size}px;
|
font-size: #{x_title_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,7 +942,7 @@ module SVG
|
||||||
fill: #ff0000;
|
fill: #ff0000;
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
font-size: #{y_title_font_size}px;
|
font-size: #{y_title_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +950,7 @@ module SVG
|
||||||
fill: #000000;
|
fill: #000000;
|
||||||
text-anchor:middle;
|
text-anchor:middle;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -965,7 +966,7 @@ module SVG
|
||||||
fill: #000000;
|
fill: #000000;
|
||||||
text-anchor:start;
|
text-anchor:start;
|
||||||
font-size: #{key_font_size}px;
|
font-size: #{key_font_size}px;
|
||||||
font-family: "Verdana", sans-serif;
|
font-family: "Arial", sans-serif;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
/* End copy for external style sheet */
|
/* End copy for external style sheet */
|
||||||
|
|
|
@ -222,6 +222,7 @@ module SVG
|
||||||
y_start = radius-(Math.cos(radians) * radius)
|
y_start = radius-(Math.cos(radians) * radius)
|
||||||
radians = (prev_percent+percent) * rad_mult
|
radians = (prev_percent+percent) * rad_mult
|
||||||
x_end = radius+(Math.sin(radians) * radius)
|
x_end = radius+(Math.sin(radians) * radius)
|
||||||
|
x_end -= 0.00001 if @data.length == 1
|
||||||
y_end = radius-(Math.cos(radians) * radius)
|
y_end = radius-(Math.cos(radians) * radius)
|
||||||
path = "M#{radius},#{radius} L#{x_start},#{y_start} "+
|
path = "M#{radius},#{radius} L#{x_start},#{y_start} "+
|
||||||
"A#{radius},#{radius} "+
|
"A#{radius},#{radius} "+
|
||||||
|
@ -257,7 +258,7 @@ module SVG
|
||||||
ty = -(Math.cos(radians) * expand_gap)
|
ty = -(Math.cos(radians) * expand_gap)
|
||||||
translate = "translate( #{tx} #{ty} )"
|
translate = "translate( #{tx} #{ty} )"
|
||||||
wedge.attributes["transform"] = translate
|
wedge.attributes["transform"] = translate
|
||||||
clear.attributes["transform"] = translate
|
clear.attributes["transform"] = translate if clear
|
||||||
end
|
end
|
||||||
|
|
||||||
if show_shadow
|
if show_shadow
|
||||||
|
|
|
@ -88,11 +88,13 @@ module SVG
|
||||||
class Plot < Graph
|
class Plot < Graph
|
||||||
|
|
||||||
# In addition to the defaults set by Graph::initialize, sets
|
# In addition to the defaults set by Graph::initialize, sets
|
||||||
|
# [show_data_values] true
|
||||||
# [show_data_points] true
|
# [show_data_points] true
|
||||||
# [area_fill] false
|
# [area_fill] false
|
||||||
# [stacked] false
|
# [stacked] false
|
||||||
def set_defaults
|
def set_defaults
|
||||||
init_with(
|
init_with(
|
||||||
|
:show_data_values => true,
|
||||||
:show_data_points => true,
|
:show_data_points => true,
|
||||||
:area_fill => false,
|
:area_fill => false,
|
||||||
:stacked => false
|
:stacked => false
|
||||||
|
@ -238,7 +240,11 @@ module SVG
|
||||||
def field_height
|
def field_height
|
||||||
values = get_y_values
|
values = get_y_values
|
||||||
max = @data.collect{|x| x[:data][Y].max }.max
|
max = @data.collect{|x| x[:data][Y].max }.max
|
||||||
|
if values.length == 1
|
||||||
|
dx = values[-1]
|
||||||
|
else
|
||||||
dx = (max - values[-1]).to_f / (values[-1] - values[-2])
|
dx = (max - values[-1]).to_f / (values[-1] - values[-2])
|
||||||
|
end
|
||||||
(@graph_height.to_f - font_size*2*top_font) /
|
(@graph_height.to_f - font_size*2*top_font) /
|
||||||
(values.length + dx - top_align)
|
(values.length + dx - top_align)
|
||||||
end
|
end
|
||||||
|
@ -290,7 +296,7 @@ module SVG
|
||||||
})
|
})
|
||||||
add_popup(x, y, format( x_points[idx], y_points[idx] )) if add_popups
|
add_popup(x, y, format( x_points[idx], y_points[idx] )) if add_popups
|
||||||
end
|
end
|
||||||
make_datapoint_text( x, y-6, y_points[idx] )
|
make_datapoint_text( x, y-6, y_points[idx] ) if show_data_values
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
line += 1
|
line += 1
|
||||||
|
|
|
@ -145,7 +145,7 @@ module SVG
|
||||||
def add_data data
|
def add_data data
|
||||||
@data = [] unless @data
|
@data = [] unless @data
|
||||||
|
|
||||||
raise "No data provided by #{conf.inspect}" unless data[:data] and
|
raise "No data provided by #{@data.inspect}" unless data[:data] and
|
||||||
data[:data].kind_of? Array
|
data[:data].kind_of? Array
|
||||||
raise "Data supplied must be x,y pairs! "+
|
raise "Data supplied must be x,y pairs! "+
|
||||||
"The data provided contained an odd set of "+
|
"The data provided contained an odd set of "+
|
||||||
|
@ -191,13 +191,13 @@ module SVG
|
||||||
rv = []
|
rv = []
|
||||||
min, max, scale_division = x_range
|
min, max, scale_division = x_range
|
||||||
if timescale_divisions
|
if timescale_divisions
|
||||||
timescale_divisions =~ /(\d+) ?(days|weeks|months|years|hours|minutes|seconds)?/
|
timescale_divisions =~ /(\d+) ?(day|week|month|year|hour|minute|second)?/
|
||||||
division_units = $2 ? $2 : "days"
|
division_units = $2 ? $2 : "day"
|
||||||
amount = $1.to_i
|
amount = $1.to_i
|
||||||
if amount
|
if amount
|
||||||
step = nil
|
step = nil
|
||||||
case division_units
|
case division_units
|
||||||
when "months"
|
when "month"
|
||||||
cur = min
|
cur = min
|
||||||
while cur < max
|
while cur < max
|
||||||
rv << cur
|
rv << cur
|
||||||
|
@ -209,7 +209,7 @@ module SVG
|
||||||
end
|
end
|
||||||
cur = Time.local(*arr).to_i
|
cur = Time.local(*arr).to_i
|
||||||
end
|
end
|
||||||
when "years"
|
when "year"
|
||||||
cur = min
|
cur = min
|
||||||
while cur < max
|
while cur < max
|
||||||
rv << cur
|
rv << cur
|
||||||
|
@ -217,15 +217,15 @@ module SVG
|
||||||
arr[5] += amount
|
arr[5] += amount
|
||||||
cur = Time.local(*arr).to_i
|
cur = Time.local(*arr).to_i
|
||||||
end
|
end
|
||||||
when "weeks"
|
when "week"
|
||||||
step = 7 * 24 * 60 * 60 * amount
|
step = 7 * 24 * 60 * 60 * amount
|
||||||
when "days"
|
when "day"
|
||||||
step = 24 * 60 * 60 * amount
|
step = 24 * 60 * 60 * amount
|
||||||
when "hours"
|
when "hour"
|
||||||
step = 60 * 60 * amount
|
step = 60 * 60 * amount
|
||||||
when "minutes"
|
when "minute"
|
||||||
step = 60 * amount
|
step = 60 * amount
|
||||||
when "seconds"
|
when "second"
|
||||||
step = amount
|
step = amount
|
||||||
end
|
end
|
||||||
min.step( max, step ) {|v| rv << v} if step
|
min.step( max, step ) {|v| rv << v} if step
|
||||||
|
|
Loading…
Reference in New Issue