# `Visualize.Shape.XBand`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/shape/x_band.ex#L1)

X-band generator: a shaded region between two domain x values, with an optional label
(spec/04 §13, D-27).

The edge accessors yield *domain* values that `scale/2` maps; without a scale they are
pixels. Each datum is one annotation; by default a `{start, stop}` tuple.

## Examples

    band =
      Visualize.Shape.XBand.new()
      |> Visualize.Shape.XBand.scale(x_scale)
      |> Visualize.Shape.XBand.y1(height)
      |> Visualize.Shape.XBand.label("incident")

    [group] = Visualize.Shape.XBand.generate(band, [{t0, t1}])

# `t`

```elixir
@type t() :: %Visualize.Shape.XBand{
  fill: (any() -&gt; String.t() | nil) | nil,
  label: (any() -&gt; String.t() | nil) | nil,
  scale: struct() | nil,
  x0: Visualize.Shape.Line.accessor() | nil,
  x1: Visualize.Shape.Line.accessor() | nil,
  y0: Visualize.Shape.Line.accessor(),
  y1: Visualize.Shape.Line.accessor()
}
```

# `text_accessor`

```elixir
@type text_accessor() :: (any() -&gt; String.t() | nil) | atom() | String.t()
```

An accessor whose value is text or a fill: a 1-arity function, an atom field, or a string.

# `fill`

```elixir
@spec fill(t(), text_accessor() | nil) :: t()
```

Sets the fill accessor: function, atom field, or string constant

# `generate`

```elixir
@spec generate(t(), Visualize.Data.Table.source()) :: [Visualize.IR.Element.t()]
```

Returns one `:group` element per datum: the rectangle, then the label when there is one.

# `label`

```elixir
@spec label(t(), text_accessor() | nil) :: t()
```

Sets the label accessor: function, atom field, or string constant; `nil` clears it

# `new`

```elixir
@spec new() :: t()
```

Creates an x-band generator reading tuple elements 0 and 1 as its edges

# `scale`

```elixir
@spec scale(t(), struct() | nil) :: t()
```

Sets the x scale the edges map through; `nil` means the values are pixels

# `x0`

```elixir
@spec x0(t(), Visualize.Shape.Line.accessor()) :: t()
```

Sets the first-edge domain-value accessor

# `x1`

```elixir
@spec x1(t(), Visualize.Shape.Line.accessor()) :: t()
```

Sets the second-edge domain-value accessor

# `y0`

```elixir
@spec y0(t(), Visualize.Shape.Line.accessor()) :: t()
```

Sets the first vertical-extent accessor, in pixels

# `y1`

```elixir
@spec y1(t(), Visualize.Shape.Line.accessor()) :: t()
```

Sets the second vertical-extent accessor, in pixels

---

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