# * On Debian, $ sudo apt-get install gnuplot
#
# Author:: Daigo Moriwaki <daigo at debian dot org>
-# Copyright:: Copyright (C) 2006-2008 Daigo Moriwaki <daigo at debian dot org>
+# Copyright:: Copyright (C) 2006-2012 Daigo Moriwaki <daigo at debian dot org>
#
# $Id$
#
@regexp_comment = Regexp.new(/^'\*\*(.*)/)
@flag = false
@name = nil
+ @increment = 0
end
def reset
@name = $1
when /\$START_TIME:(.*)/
@start_time = $1
+ when /^'Increment:(.*)/
+ @increment = $1.to_i
end
end
values = []
values << 1.0*y_max/play_time*consume
@times.each do |t|
+ consume += @increment
if consume == 0
break
end
def eval_values
moves = []
comments.each_with_index do |c, i|
- moves << i*2 + 1 if c
+ moves << i*2 if c
end
moves.unshift 0
[moves, comments.compact.unshift(0)]
def eval_values
moves = []
comments.each_with_index do |c, i|
- moves << i*2 if c
+ moves << i*2+1 if c
end
moves.unshift 0
[moves, comments.compact.unshift(0)]
width = [black.comments.size, white.comments.size].max * 2 + 1
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
- plot.terminal "svg" # or png
+ plot.terminal "svg size 800 500 fixed" # or png
plot.output to_svg_file(csa_file)
plot.title title
plot.size "0.9,0.9"
plot.key "left"
- plot.style "line 1 linewidth 5 linetype 0 linecolor rgbcolor \"red\""
- plot.style "line 2 linewidth 4 linetype 0 linecolor rgbcolor \"dark-green\""
+ plot.style "line 1 linewidth 5 linetype -1 linecolor rgbcolor \"red\""
+ plot.style "line 2 linewidth 4 linetype -1 linecolor rgbcolor \"dark-green\""
plot.data << Gnuplot::DataSet.new( black.eval_values ) do |ds|
ds.with = "lines ls 1"
end
if a_play_time > 0
- plot.style "line 5 linewidth 1 linetype 0 linecolor rgbcolor \"red\""
- plot.style "line 6 linewidth 1 linetype 0 linecolor rgbcolor \"green\""
+ plot.style "line 5 linewidth 1 linetype -1 linecolor rgbcolor \"red\""
+ plot.style "line 6 linewidth 1 linetype -1 linecolor rgbcolor \"green\""
plot.style "fill solid 0.25 noborder"
plot.data << Gnuplot::DataSet.new( black.time_values(3000, a_play_time) ) do |ds|