diff --git a/lib/sparkline_svg/core.ex b/lib/sparkline_svg/core.ex index f83d227..d9add14 100644 --- a/lib/sparkline_svg/core.ex +++ b/lib/sparkline_svg/core.ex @@ -11,7 +11,7 @@ defmodule SparklineSvg.Core do @typedoc false @typep min_max :: {number(), number()} - @typedoc "Internal representation of a x value of a point" + @typedoc "Internal representation of an x value of a point" @type x :: number() @typedoc "Internal representation of a y value of a point" @@ -105,7 +105,12 @@ defmodule SparklineSvg.Core do end) end - @spec calc_resize_ref_lines(SparklineSvg.ref_lines(), points(), min_max(), SparklineSvg.opts()) :: + @spec calc_resize_ref_lines( + SparklineSvg.ref_lines(), + Datapoint.points(), + min_max(), + SparklineSvg.opts() + ) :: SparklineSvg.ref_lines() defp calc_resize_ref_lines(ref_lines, datapoints, min_max_y, options) do ref_lines diff --git a/lib/sparkline_svg/datapoint.ex b/lib/sparkline_svg/datapoint.ex index 6fca78b..0129e94 100644 --- a/lib/sparkline_svg/datapoint.ex +++ b/lib/sparkline_svg/datapoint.ex @@ -1,16 +1,17 @@ defmodule SparklineSvg.Datapoint do @moduledoc false - alias SparklineSvg.Type + alias SparklineSvg.Core alias SparklineSvg.Datapoint + alias SparklineSvg.Type @typedoc false @type points :: list(Datapoint.t()) @typedoc false @type t :: %Datapoint{ - source: SparklineSvg.datapoints(), - computed: points() + source: Core.point(), + computed: Core.point() } @enforce_keys [:source, :computed] defstruct [:source, :computed] diff --git a/lib/sparkline_svg/reference_line.ex b/lib/sparkline_svg/reference_line.ex index dfe2d27..e7a65dd 100644 --- a/lib/sparkline_svg/reference_line.ex +++ b/lib/sparkline_svg/reference_line.ex @@ -64,7 +64,7 @@ defmodule SparklineSvg.ReferenceLine do alias SparklineSvg.ReferenceLine @typedoc "A reference line function." - @type ref_line_function :: (Datapoint.t() -> Core.y()) + @type ref_line_function :: (Datapoint.points() -> Core.y()) @typedoc false @type t :: %ReferenceLine{ @@ -177,7 +177,7 @@ defmodule SparklineSvg.ReferenceLine do """ @doc since: "0.4.0" - @spec median(Datapoint.t()) :: Core.y() + @spec median(Datapoint.points()) :: Core.y() def median(datapoints) do percentile(50).(datapoints) end @@ -207,6 +207,7 @@ defmodule SparklineSvg.ReferenceLine do end @spec find_interpolated_value(Datapoint.t(), number()) :: Core.y() + @spec find_interpolated_value(Datapoint.points(), number()) :: Core.y() defp find_interpolated_value(_datapoints, index) when index < 1, do: 0 defp find_interpolated_value(datapoints, index) do