From 4c46cb295833a04cbfb2191f757045e64bc2cc62 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Sun, 4 Jun 2023 17:43:51 -0300 Subject: [PATCH] Sync format_buffer code --- c-historico/handler.cr | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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