Skip to content

Line Chart

New in Atfinity 17.

The <lineChart> tag connects data points with a line. A line implies that the points belong together, so use it for values that are actually connected, in practice almost always a development over time. For unrelated categories use a <barChart> instead.

See Charts for the data model, sizing and the attributes shared by all charts.

Example

<lineChart width="16cm" height="6cm" legend="top">
  <valueAxis label="Cases"/>
  <categoryAxis label="Week" rotation="45"/>
  {% for segment in segments %}
  <series label="{{ segment.name }}">
    {% for week in weeks %}
    <point label="{{ week.label }}" value="{{ segment.by_week[week.key] }}"/>
    {% endfor %}
  </series>
  {% endfor %}
</lineChart>

Attributes

<lineChart>

lineWidth (optional) \ Thickness of the lines in pt. Defaults to 2.

markers (optional) \ Shape drawn at every data point: none, circle, square, diamond or triangle. Defaults to none, which matches the insights charts.

markerSize (optional) \ Size of the markers in pt, 1 to 12. Defaults to 4.

color (optional) \ A single colour for the line, used when the chart has only one series.

showValues (optional) \ true writes the value at every data point. Defaults to false. On a dense line this gets crowded quickly.

valuePosition (optional) \ outside writes the values above the line, inside below it, none leaves them out. Defaults to outside.

grid, gridColor, gridDash, axisColor (optional) \ Same as on <barChart>. Defaults to horizontal grid lines.

categoryRotation (optional) \ Rotates the category labels by this many degrees, -90 to 90. Useful for dates.

maxCategories, maxSeries (optional) \ Same as on <barChart>, defaulting to 12 and 6.

<valueAxis>, <categoryAxis>, <series>, <point>, <bar>

Identical to <barChart>. Use <bar> for a single line and <series> with <point> children for several.

Notes

Categories are laid out at even spacing in the order they appear, so the labels carry the meaning of the axis. Format dates in Jinja before passing them in, for example with the format_date filter.

A series that skips a category is drawn through 0 at that point, which is usually what you want for counts. If a gap should not be read as zero, leave the category out of the chart entirely.

On insights pages the line chart is restricted to the "Over time" secondary grouping for the same reason. In documents the restriction is not enforced, because the template author decides what the categories mean.