# xychart

    .xychart lines:{Boolean = true} \
              bars:{Boolean = false} \
                 x:{String? = null} \
            xrange:{Range? = null} \
             xtags:{Iterable<Any>? = null} \
                 y:{String? = null} \
            yrange:{Range? = null} \
           caption:{InlineMarkdownContent? = null} \
               ref:{String? = null} \
            values:{Iterable<Any>}
    -> Node

Content copied to clipboard

Creates a chart diagram on the XY plane.

The following example plots 4 points at (1, 5), (2, 2), (3, 4), (4, 10), connected by a line:

    .xychart
      - 5
      - 2
      - 4
      - 10

Content copied to clipboard

Multiple lines can be plotted by supplying a list of lists of points. Each list will be plotted as a separate line:

    .xychart
      - - 5
        - 8
        - 3
      - - 3
        - 5
        - 10
      - - 8
        - 3
        - 5

Content copied to clipboard

Complex plottings can be achieved by manipulating collections, for instance via forEach or repeat:

    .xychart
        .repeat {100}
            n:
            .n::pow {2}::divide {100}

Content copied to clipboard

#### Return

the generated diagram node

#### Parameters

lines

- Optional

whether to draw lines

bars

- Optional

whether to draw bars

x

- Optional

optional label for the X axis

xrange

- Optional

optional range for the X axis. If open-ended, the range will be set to the minimum and maximum values of the X values. Incompatible with xtags.

xtags

- Optional

optional categorical tags for the X axis. Incompatible with xrange.

y

- Optional

optional label for the Y axis

yrange

- Optional

optional range for the Y axis. If open-ended, the range will be set to the minimum and maximum values of the Y values

caption

- Optional
- Likely named

optional caption. If a caption is present, the diagram will be numbered as a figure

ref

- Optional

optional ID for cross-referencing via reference

values

- Likely a body argument

the Y values to plot. They can be a list of points, which will be plotted as a single line, or a list of lists of points, which will be plotted as multiple lines.

#### Throws

IllegalArgumentException

if both xrange and xtags are set

#### Wiki page

xy-chart