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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ matplotex-*.tar
/tmp/

/.github
/samples
/samples
/add_line.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The package can be installed by adding <font color="darkblue"> **Matplotex**</fo
```elixir
def deps do
[
{:matplotex, git: "git@github.com:BigThinkcode/matplotex.git" }
{:matplotex, "~> 0.2.0" }
]
```

Expand Down
2 changes: 0 additions & 2 deletions lib/matplotex.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule Matplotex do
@moduledoc """
# Matplotex

A lightweight and efficient Elixir library designed for server-side SVG generation, ideal for data visualization in web applications. It integrates seamlessly with Phoenix LiveView and provides powerful tools for generating dynamic visualizations.

## Supported Graph Types
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/blueprint.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Blueprint do
@moduledoc false
@callback new(graph :: module(), params :: map()) :: any()
@callback set_content(graphset :: any()) :: any()
@callback add_elements(graphset :: any()) :: any()
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/blueprint/chord.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Blueprint.Chord do
@moduledoc false
@true_by_default false
@false_by_default true
defmacro chord(opts \\ []) do
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/blueprint/frame.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Blueprint.Frame do
@moduledoc false
alias Matplotex.Figure.Legend
@default_margin 0.05
@show_by_default true
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element do
@moduledoc false
@callback assemble(element :: struct()) :: String.t()
def assemble(%module{} = element), do: module.assemble(element)

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/circle.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Circle do
@moduledoc false
alias Matplotex.Element
use Element

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/label.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Label do
@moduledoc false
alias Matplotex.Element
use Element
@default_fill "black"
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/legend.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Legend do
@moduledoc false
alias Matplotex.Element.Label
alias Matplotex.Element

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/line.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Line do
@moduledoc false
alias Matplotex.Element
use Element

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/polygon.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Polygon do
@moduledoc false
alias Matplotex.Element
use Element
@default_fill "blue"
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/rad_legend.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.RadLegend do
@moduledoc false
alias Matplotex.Element.Label
alias Matplotex.Element
alias Matplotex.Element.Rect
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/rect.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Rect do
@moduledoc false
alias Matplotex.Element

@default_stroke_width 2
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/slice.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Slice do
@moduledoc false
alias Matplotex.Element
use Element

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/spline.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Spline do
@moduledoc false
alias Matplotex.Element
use Element
@default_stroke_width 2
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/stencil.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Stencil do
@moduledoc false
def line(line) do
~s(
<line
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/element/tick.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Element.Tick do
@moduledoc false
alias Matplotex.Element
alias Matplotex.Element.Line
alias Matplotex.Element.Label
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure do
@moduledoc false
alias Matplotex.Figure.RcParams
@row_column_default 1
@margin_default 0.05
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal do
@moduledoc false
alias Matplotex.Figure.Areal.Ticker
alias Matplotex.Utils.Algebra
alias Matplotex.Figure.Dataset
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/bar_chart.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.BarChart do
@moduledoc false
import Matplotex.Figure.Numer
alias Matplotex.Figure.Areal.PlotOptions
alias Matplotex.Figure.Areal.Region
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/histogram.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.Histogram do
@moduledoc false
alias Matplotex.Element.Rect
alias Matplotex.Figure.RcParams
alias Matplotex.Figure.Areal.PlotOptions
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/line_plot.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.LinePlot do
@moduledoc false
alias Matplotex.Figure.Areal.PlotOptions
alias Matplotex.Utils.Algebra
alias Matplotex.Figure.Areal.Region
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/plot_options.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.PlotOptions do
@moduledoc false
alias Matplotex.Figure
alias Matplotex.Figure.TwoD
alias Matplotex.Figure.RcParams
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/region.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.Region do
@moduledoc false
alias Matplotex.Figure.Areal.XyRegion.Coords
@zero_by_default 0
defstruct x: @zero_by_default,
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/scatter.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.Scatter do
@moduledoc false
alias Matplotex.Figure.Areal.PlotOptions
alias Matplotex.Figure.Areal.Region
alias Matplotex.Figure.Areal.Ticker
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/spline.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.Spline do
@moduledoc false
alias Matplotex.Element.Spline
alias Matplotex.Figure.RcParams
alias Matplotex.Figure.Areal
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/ticker.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Areal.Ticker do
@moduledoc false
@tick_in_plot 5
def generate_ticks({min, max}) do
step = (max - min) / @tick_in_plot
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/areal/xy_region/coords.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
defmodule Matplotex.Figure.Areal.XyRegion.Coords do
@moduledoc false
defstruct [:label, :ticks, :grids]
end
1 change: 1 addition & 0 deletions lib/matplotex/figure/cast.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Cast do
@moduledoc false
alias Matplotex.Figure.Lead
alias Matplotex.Element.Legend
alias Matplotex.Utils.Algebra
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/coords.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Coords do
@moduledoc false
defstruct [
:title,
:x_label,
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/dataset.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Dataset do
@moduledoc false
@default_color "blue"
@default_marker "o"
@default_linestyle "_"
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/dimension.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
defmodule Matplotex.Figure.Dimension do
@moduledoc false
defstruct [:x_label, :y_label, :x_tick, :y_tick, :title]
end
1 change: 1 addition & 0 deletions lib/matplotex/figure/font.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Font do
@moduledoc false
@default_font_color "black"
@default_font_family "Arial, Verdana, sans-serif"
@default_font_style "normal"
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/lead.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Lead do
@moduledoc false
alias Matplotex.Utils.Algebra
alias Matplotex.Figure.Areal.XyRegion.Coords, as: XyCoords
alias Matplotex.Figure.Font
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/legend.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Legend do
@moduledoc false
defstruct [:labels, :title, :colors, :position, :size]

@type t() :: %__MODULE__{labels: list(), title: String.t(), position: atom(), size: tuple()}
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/marker.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Marker do
@moduledoc false
alias Matplotex.Utils.Algebra
alias Matplotex.Element.Rect
alias Matplotex.Element.Polygon
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/numer.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Numer do
@moduledoc false
def round_to_best(value) when value > 10 do
factor = value |> :math.log10() |> floor()

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/radial.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Radial do
@moduledoc false
alias Matplotex.Utils.Algebra

@callback create(struct(), list(), keyword()) :: struct()
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/radial/accumulator.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Radial.Accumulator do
@moduledoc false
alias Matplotex.Figure.Radial.LegendAcc

@start_angle :math.pi() / 2
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/radial/dataset.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Radial.Dataset do
@moduledoc false
defstruct sizes: [],
labels: [],
colors: [],
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/radial/legend_acc.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
defmodule Matplotex.Figure.Radial.LegendAcc do
@moduledoc false
defstruct [:x, :y, :uheight, :uwidth]
end
1 change: 1 addition & 0 deletions lib/matplotex/figure/radial/pie.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Radial.Pie do
@moduledoc false
alias Matplotex.Figure.RcParams
alias Matplotex.Utils.Algebra
alias Matplotex.Figure.Areal.Region
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/rc_params.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.RcParams do
@moduledoc false
alias Matplotex.Figure.Font
@default_figsize {8, 6}
@default_dpi 96
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/sketch.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Sketch do
@moduledoc false
alias Matplotex.Figure
@dpi 96

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/text.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.Text do
@moduledoc false
alias Matplotex.Figure.Text
alias Matplotex.Figure.Font

Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/figure/two_d.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Figure.TwoD do
@moduledoc false
defstruct [:x, :y]

def update(%__MODULE__{x: x, y: y} = twod, opts, context) do
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/helpers.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Helpers do
@moduledoc false
def copy(term) do
text =
if is_binary(term) do
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/utils/algebra.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Utils.Algebra do
@moduledoc false
alias Nx

@tensor_data_type_bits 64
Expand Down
23 changes: 12 additions & 11 deletions lib/matplotex/utils/helpers.ex
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
defmodule Matplotex.Utils.Helpers do
@moduledoc """
Module contains some misslenious helper functions
"""
@moduledoc false
# @moduledoc """
# Module contains some misslenious helper functions
# """

@doc """
Input params may contains params for that chart struct and params for
content struct this functions sgregates that and return a tuple with
params for chart struct and content struct.
### Params
* params - Map contains input params
* content_fields - list of atoms contains field names
"""
# @doc """
# Input params may contains params for that chart struct and params for
# content struct this functions sgregates that and return a tuple with
# params for chart struct and content struct.
# ### Params
# * params - Map contains input params
# * content_fields - list of atoms contains field names
# """

@spec segregate_content(any(), list()) :: {any(), any()}
def segregate_content(params, content_fields) do
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/utils/input_error.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
defmodule Matplotex.InputError do
@moduledoc false
defexception [:keys, :message]
end
1 change: 1 addition & 0 deletions lib/matplotex/utils/math_func.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Utilities.MathFunc do
@moduledoc false
alias NX
@tensor_double_data_type_bits 64
def euclidean_distance(x1, y1, x2, y2) do
Expand Down
5 changes: 2 additions & 3 deletions lib/matplotex/utils/svg.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule Matplotex.Utils.Svg do
@moduledoc """
Modules to wrap function shares common svg functions
"""
@moduledoc false

def wrap_with_frame(%{width: width, height: height}, svg) do
~s(<svg width="#{width}"
height="#{height}"
Expand Down
1 change: 1 addition & 0 deletions lib/matplotex/validation/helpers.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Matplotex.Validation.Helpers do
@moduledoc false
alias Matplotex.InputError

# TODO: Move module specific validators to particular module
Expand Down
6 changes: 6 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"complex": {:hex, :complex, "0.5.0", "af2d2331ff6170b61bb738695e481b27a66780e18763e066ee2cd863d0b1dd92", [:mix], [], "hexpm", "2683bd3c184466cfb94fad74cbfddfaa94b860e27ad4ca1bffe3bff169d91ef1"},
"csv": {:hex, :csv, "3.2.1", "6d401f1ed33acb2627682a9ab6021e96d33ca6c1c6bccc243d8f7e2197d032f5", [:mix], [], "hexpm", "8f55a0524923ae49e97ff2642122a2ce7c61e159e7fe1184670b2ce847aee6c8"},
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"},
"earmark_parser": {:hex, :earmark_parser, "1.4.42", "f23d856f41919f17cd06a493923a722d87a2d684f143a1e663c04a2b93100682", [:mix], [], "hexpm", "6915b6ca369b5f7346636a2f41c6a6d78b5af419d61a611079189233358b8b8b"},
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
"ex_doc": {:hex, :ex_doc, "0.36.1", "4197d034f93e0b89ec79fac56e226107824adcce8d2dd0a26f5ed3a95efc36b1", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "d7d26a7cf965dacadcd48f9fa7b5953d7d0cfa3b44fa7a65514427da44eafd89"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"nx": {:hex, :nx, "0.7.3", "51ff45d9f9ff58b616f4221fa54ccddda98f30319bb8caaf86695234a469017a", [:mix], [{:complex, "~> 0.5", [hex: :complex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5ff29af84f08db9bda66b8ef7ce92ab583ab4f983629fe00b479f1e5c7c705a6"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
}
Loading