From 1270a7c8239e4edfb99402cd6443a99f912ac6e5 Mon Sep 17 00:00:00 2001 From: Cody Rogers Date: Thu, 4 Jun 2026 17:14:09 -0500 Subject: [PATCH 1/3] Add tags to several components to aid with testing and DOM organization --- lib/plox.ex | 250 +++++++++++++++++++++++++++------------------------- 1 file changed, 131 insertions(+), 119 deletions(-) diff --git a/lib/plox.ex b/lib/plox.ex index dcdf889..2afce2a 100644 --- a/lib/plox.ex +++ b/lib/plox.ex @@ -211,25 +211,29 @@ defmodule Plox do def line_plot(%{type: :line} = assigns) do ~H""" - GraphDataset.to_graph_points(@x, @y) |> polyline_points()} - fill="none" - stroke={@color} - stroke-width={@width} - stroke-dasharray={stroke_dasharray(@line_style)} - /> + + GraphDataset.to_graph_points(@x, @y) |> polyline_points()} + fill="none" + stroke={@color} + stroke-width={@width} + stroke-dasharray={stroke_dasharray(@line_style)} + /> + """ end def line_plot(%{type: :step_line} = assigns) do ~H""" - step_points(@x, @y) |> polyline_points()} - fill="none" - stroke={@color} - stroke-width={@width} - stroke-dasharray={stroke_dasharray(@line_style)} - /> + + step_points(@x, @y) |> polyline_points()} + fill="none" + stroke={@color} + stroke-width={@width} + stroke-dasharray={stroke_dasharray(@line_style)} + /> + """ end @@ -262,27 +266,29 @@ defmodule Plox do def points_plot(assigns) do ~H""" - + + + """ end @@ -308,34 +314,36 @@ defmodule Plox do def bar_plot(assigns) do ~H""" - <%= for point <- GraphDataset.to_graph_points(@dataset, @x, @y) do %> - - <% end %> + + <%= for point <- GraphDataset.to_graph_points(@dataset, @x, @y) do %> + + <% end %> + """ end @@ -434,67 +442,71 @@ defmodule Plox do def area_plot(%{orientation: :horizontal} = assigns) do ~H""" - <%= for [scalar1, scalar2] <- area_points(@dataset, @area, @orientation), rect_color = GraphDataset.to_color(@dataset, @color, scalar1.data_point) do %> - - <% end %> + + <%= for [scalar1, scalar2] <- area_points(@dataset, @area, @orientation), rect_color = GraphDataset.to_color(@dataset, @color, scalar1.data_point) do %> + + <% end %> + """ end def area_plot(%{orientation: :vertical} = assigns) do ~H""" - <%= for [scalar1, scalar2] <- area_points(@dataset, @area, @orientation), rect_color = GraphDataset.to_color(@dataset, @color, scalar1.data_point) do %> - - <% end %> + + <%= for [scalar1, scalar2] <- area_points(@dataset, @area, @orientation), rect_color = GraphDataset.to_color(@dataset, @color, scalar1.data_point) do %> + + <% end %> + """ end From 81c971937dc30e5bbd5ea3a0419384987a28c86b Mon Sep 17 00:00:00 2001 From: Cody Rogers Date: Thu, 4 Jun 2026 18:18:51 -0500 Subject: [PATCH 2/3] Make 'id' into an attribute, default to 'nil' --- lib/plox.ex | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/plox.ex b/lib/plox.ex index 2afce2a..ba2ba8c 100644 --- a/lib/plox.ex +++ b/lib/plox.ex @@ -199,6 +199,7 @@ defmodule Plox do """ @doc type: :component + attr :id, :string, default: nil attr :dataset, :any, required: true attr :x, :atom, default: :x, doc: "The dataset axis key to use for x values" @@ -211,7 +212,7 @@ defmodule Plox do def line_plot(%{type: :line} = assigns) do ~H""" - + GraphDataset.to_graph_points(@x, @y) |> polyline_points()} fill="none" @@ -225,7 +226,7 @@ defmodule Plox do def line_plot(%{type: :step_line} = assigns) do ~H""" - + step_points(@x, @y) |> polyline_points()} fill="none" @@ -254,6 +255,7 @@ defmodule Plox do """ @doc type: :component + attr :id, :string, default: nil attr :dataset, :any, required: true attr :x, :atom, default: :x, doc: "The dataset axis key to use for x values" @@ -266,7 +268,7 @@ defmodule Plox do def points_plot(assigns) do ~H""" - + + <%= for point <- GraphDataset.to_graph_points(@dataset, @x, @y) do %> + <%= for [scalar1, scalar2] <- area_points(@dataset, @area, @orientation), rect_color = GraphDataset.to_color(@dataset, @color, scalar1.data_point) do %> + <%= for [scalar1, scalar2] <- area_points(@dataset, @area, @orientation), rect_color = GraphDataset.to_color(@dataset, @color, scalar1.data_point) do %> Date: Fri, 5 Jun 2026 11:02:59 -0500 Subject: [PATCH 3/3] bump version to 0.3.3 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 189c97a..af471cc 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Plox.MixProject do use Mix.Project - @version "0.3.2" + @version "0.3.3" @source_url "https://github.com/gridpoint-com/plox" def project do