# `Backpex.Metric`
[🔗](https://github.com/naymspace/backpex/blob/0.18.3/lib/backpex/metric.ex#L1)

Behaviour implemented by all metrics.

Metrics are info boxes for your resources displaying key indicators prominently on the index view in your application.
An example could be to show the current total of all orders received today. You may create your own metrics by
implementing this behaviour.

# `format`

```elixir
@callback format(data :: any(), format :: any()) :: term()
```

# `query`

```elixir
@callback query(query :: Ecto.Queryable.t(), select :: any(), repo :: Ecto.Repo.t()) ::
  Ecto.Schema.t() | term() | nil
```

# `render`

```elixir
@callback render(assigns :: map()) :: %Phoenix.LiveView.Rendered{
  caller: term(),
  dynamic: term(),
  fingerprint: term(),
  root: term(),
  static: term()
}
```

Used to render the metric as a heex template on the index views.

# `metrics_visible?`

Determine if metrics are visible for given live_resource.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
