Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/plox.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ defmodule Plox do

slot :legend
slot :tooltips
slot :sticky_left_axis, doc: "Y-axes included in this slot will stick to the left of the graph"
slot :sticky_right_axis, doc: "Y-axes included in this slot will stick to the right of the graph"
slot :inner_block, required: true

def graph(assigns) do
Expand Down Expand Up @@ -78,10 +80,24 @@ defmodule Plox do
</.legend>
</div>
<div style={@graph_div_style_string}>
<div
:if={@sticky_left_axis != []}
style="display: flex; flex-direction: column-reverse; justify-content: space-evenly; position: sticky; left: 0px; margin-top: 4px; margin-bottom: 16px;"
>
{render_slot(@sticky_left_axis, @graph)}
</div>

<svg viewBox={"0 0 #{@width} #{@height}"} xmlns="http://www.w3.org/2000/svg">
{render_slot(@inner_block, @graph)}
</svg>

<div
:if={@sticky_right_axis != []}
style="display: flex; flex-direction: column-reverse; justify-content: space-evenly; position: sticky; right: 0px; margin-top: 4px; margin-bottom: 16px;"
>
{render_slot(@sticky_right_axis, @graph)}
</div>

<%= for tooltip <- @tooltips do %>
{render_slot(tooltip, @graph)}
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Plox.MixProject do
use Mix.Project

@version "0.3.1"
@version "0.3.2"
@source_url "https://github.com/gridpoint-com/plox"

def project do
Expand Down
Loading