diff options
-rw-r--r-- | room-schedule.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/room-schedule.rb b/room-schedule.rb index 40e94aa..bb6e677 100644 --- a/room-schedule.rb +++ b/room-schedule.rb @@ -73,14 +73,29 @@ module SVG bar_width = (x_end - x_start) * scale bar_start = x_start * scale - @graph.add_element( "rect", { + event = @graph.add_element( "rect", { "x" => bar_start.to_s, "y" => y.to_s, "width" => bar_width.to_s, "height" => subbar_height.to_s, "class" => "fill#{field_count+1}" }) - t = @graph.add_element("text", { + switch = @graph.add_element("switch") + fo = switch.add_element("foreignObject", { + "x" => (bar_start + @font_size / 2).to_s, + "y" => y.to_s, + "width" => bar_width.to_s, + "height" => subbar_height.to_s, + "requiredExtensions" => "http://www.w3.org/1999/xhtml", + }) + body = fo.add_element("body", { + "xmlns" => "http://www.w3.org/1999/xhtml", + }) + p = body.add_element("p", { + "class" => "event-title", + }) + p.add_text(entry.title) + t = switch.add_element("text", { "x" => (bar_start + @font_size / 2).to_s, "y" => (y + 2 * @font_size).to_s, }) @@ -165,6 +180,9 @@ module SVG stroke: none; stroke-width: 1px; } +.event-title { + font-size: 80%; +} EOL end |