diff --git a/c-historico/handler.cr b/c-historico/handler.cr index d74a9fd..2815c8c 100644 --- a/c-historico/handler.cr +++ b/c-historico/handler.cr @@ -6,16 +6,17 @@ require "json" require "uuid" class Handler - def format_buffer(buffer, canvas_name) + def format_buffer(buffer, canvas_name, title) # Process the gnuplot output so it works in the page # # buffer is the Ishi output # name is a string to replace for gnuplot_canvas so - # we can have multiple charts in a page + # we can have multiple charts in a page + # title is added on top of the chart html = buffer.to_s.split("\n") html = html[html.index("")] - html = html.join("\n") + %( + html = "#{title}" + html.join("\n") + %(
@@ -30,7 +31,7 @@ class Handler ) - # This ID needs to be unique in case + # This ID needs to be unique in case # we have 2 charts in the same page html.gsub("gnuplot_canvas", canvas_name) end