diff --git a/lib/demo_web/live/page_live.ex b/lib/demo_web/live/page_live.ex index 7d02725..5ae2510 100644 --- a/lib/demo_web/live/page_live.ex +++ b/lib/demo_web/live/page_live.ex @@ -6,10 +6,11 @@ defmodule DemoWeb.PageLive do alias Demo.Examples.Cincy alias Demo.SystemData.{Memory, MemoryChart, VMEvents} alias Uncharted.{BaseChart, BaseDatum, Gradient} - alias Uncharted.Axes.{BaseAxes, MagnitudeAxis, XYAxes} + alias Uncharted.Axes.{BaseAxes, MagnitudeAxis, PolarAxes, XYAxes} alias Uncharted.BarChart alias Uncharted.ColumnChart alias Uncharted.PieChart + alias Uncharted.PolarChart alias Uncharted.ProgressChart @impl true @@ -90,6 +91,46 @@ defmodule DemoWeb.PageLive do } } + polar_chart = %BaseChart{ + title: "Polar Chart", + colors: colors, + dataset: %PolarChart.Dataset{ + axes: %PolarAxes{ + r: %MagnitudeAxis{ + max: 20, + min: 0 + }, + t: %MagnitudeAxis{ + max: 2 * :math.pi, + min: 0, + units: :radians + } + }, + data: [ + %BaseDatum{ + name: "Point 1", + values: [1, 0.4 * :math.pi] + }, + %BaseDatum{ + name: "Point 2", + values: [5, 1.4 * :math.pi] + }, + %BaseDatum{ + name: "Point 3", + values: [12, 0.1 * :math.pi] + }, + %BaseDatum{ + name: "Point 4", + values: [4, 0 * :math.pi] + }, + %BaseDatum{ + name: "Point 5", + values: [18, 1.9 * :math.pi] + } + ] + } + } + line_chart = %BaseChart{ title: "Live Line Chart", colors: colors, @@ -141,6 +182,7 @@ defmodule DemoWeb.PageLive do bar_chart: bar_chart(), column_chart: column_chart, pie_chart: pie_chart, + polar_chart: polar_chart, progress_chart: progress_chart, line_chart: line_chart )} diff --git a/lib/demo_web/live/page_live.html.leex b/lib/demo_web/live/page_live.html.leex index 1649c75..b6e47b9 100644 --- a/lib/demo_web/live/page_live.html.leex +++ b/lib/demo_web/live/page_live.html.leex @@ -25,4 +25,8 @@

<%= Uncharted.Chart.title(@bar_chart) %>
the bar chart

<%= live_component @socket, UnchartedPhoenix.LiveBarComponent, chart: @bar_chart %> +
+

<%= Uncharted.Chart.title(@polar_chart) %>
the polar chart

+ <%= live_component @socket, UnchartedPhoenix.LivePolarComponent, chart: @polar_chart %> +
diff --git a/mix.exs b/mix.exs index c2bc828..a083817 100644 --- a/mix.exs +++ b/mix.exs @@ -62,7 +62,7 @@ defmodule Demo.MixProject do {:gettext, "~> 0.11"}, {:jason, "~> 1.0"}, {:plug_cowboy, "~> 2.0"}, - {:uncharted_phoenix, "~> 0.2.0"} + {:uncharted_phoenix, git: "git@github.com:unchartedelixir/uncharted_phoenix.git", branch: "polar-chart"} ] end diff --git a/mix.lock b/mix.lock index f8d01ad..c140200 100644 --- a/mix.lock +++ b/mix.lock @@ -32,7 +32,7 @@ "telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, "telemetry_metrics": {:hex, :telemetry_metrics, "0.5.0", "1b796e74add83abf844e808564275dfb342bcc930b04c7577ab780e262b0d998", [:mix], [{:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31225e6ce7a37a421a0a96ec55244386aec1c190b22578bd245188a4a33298fd"}, "telemetry_poller": {:hex, :telemetry_poller, "0.5.1", "21071cc2e536810bac5628b935521ff3e28f0303e770951158c73eaaa01e962a", [:rebar3], [{:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4cab72069210bc6e7a080cec9afffad1b33370149ed5d379b81c7c5f0c663fd4"}, - "uncharted": {:hex, :uncharted, "0.2.0", "701a4935cfd1c5dcbcdf791f3cc707e24ae8995a313d16591b3862b8939db993", [:mix], [], "hexpm", "3bef78ea95a16647af8e722aa7f6010a9213091d012ac6dbdaf9aad89c0dd7a5"}, - "uncharted_phoenix": {:hex, :uncharted_phoenix, "0.2.0", "8ce756f9ed617f5f4d080e21f2a8f68af78e2a715e2945966dc9afb65edbe3a7", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.14.4", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:uncharted, "~> 0.2.0", [hex: :uncharted, repo: "hexpm", optional: false]}], "hexpm", "f87bc56f6f0b6badac2d68730f7b131686134bcb21bac3871ad6f1d04c01feef"}, + "uncharted": {:git, "git@github.com:unchartedelixir/uncharted.git", "f278dada41375fc76c94b0093dbf16564fbe0a46", [branch: "polar-chart"]}, + "uncharted_phoenix": {:git, "git@github.com:unchartedelixir/uncharted_phoenix.git", "a5119aafd3ed086f8e065ed448cbea5337058217", [branch: "polar-chart"]}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"}, }