\n"..
"\n"..
"\n"
SvgBgColor =
"\n"..
"\n"..
"\n"
------------------------------------------
--文字の分解
------------------------------------------
function split(str, d)
local s = str
local t = {}
local p = "%s*(.-)%s*"..d.."%s*"
local f = function(v) table.insert(t, v) end
if s ~= nil then
string.gsub(s, p, f) -- 最後の要素より前の要素を処理する
f(string.gsub(s, p, "")) -- 最後の要素はカンマで区切られていないときにマッチしないので、その前の値を空白で置き換えてからマッチさせる
end
return t
end
------------------------------------------
--CSVファイルを読み込みます
------------------------------------------
function readdata( filename )
local fp
local msg
local str
local t={}
local i = 1
local x = 0
local y = 0
local width = 0
local height = 0
local graph_height = 0
local graph_width = 0
local fill_color = "fill=\"#008d46\""
local draw_width = 640
local draw_height = 480
local draw_offset_x = 16
local draw_offset_y = 16
local scale_x = 1.0
local scale_y = 1.0
local font_size = 16
local graph_title = "XXX Task"
local x_axis_title = "time"
local y_axis_title = "size"
--ファイルを開きます
fp,msg = io.open( filename, "r")
if( not(fp) )then
print( "Can't open "..Path..Fname)
return
end
--CSVデータを読み込みます
-- 1回目:x,yの最大値を検索し、表示サイズを確定する
while(true)do
str = fp:read("*l") --1行読み込み
if( str==nil )then break end --読込むデータが無ければ終了
str = string.gsub( str,"\r","" ) --改行コードを外す
t = split( str, "," )
if( t[1] ~= "x" )then
x = tonumber(t[1])
y = tonumber(t[2])
if (x > graph_width) then graph_width = x end
if (y > graph_height) then graph_height = y end
end
end
scale_x = (graph_width / draw_width)
scale_y = (graph_height / draw_height)
-- HTML前半部表示
print(Html1)
print("")
-- HTML後半部表示
print(Html2)
io.close(fp)
end
------------------------------------------
--メインプログラム
------------------------------------------
function main()
--CSVファイルを読み込みます
readdata( Path..Fname )
end
main()