Line Style: Thickness and Dashes

A line chart draws every series one pixel wide and solid. chls sets the width of the line in pixels, and turns a solid line into a dashed one.

What chls Controls

chls takes one group of up to three numbers per series, in the order the series appear in chd, separated by |: chls=<thickness>,<dash_length>,<space_length>. Only the thickness is required.

  • thickness is the width of the line in pixels. A series with no group of its own is drawn one pixel wide.
  • dash_length is the length of each dash, in pixels. Leave it out, or set it to 0, and the line stays solid.
  • space_length is the gap between two dashes, in pixels. Leave it out and the gap matches the dash length, so chls=2,8 draws eight pixel dashes separated by eight pixel gaps.

The syntax is the one Google Image Charts used, so a chls value copied out of an old chart.googleapis.com URL renders the same line here.

Line Thickness

A single number per series sets the width and leaves the line solid. Below, chls=1|4|8 draws the three series at one, four and eight pixels.

https://image-charts.com/chart?cht=lc&chd=a:10,14,12,18,22,20%7C30,34,32,38,42,40%7C50,54,52,58,62,60&chco=1F3B99,00A550,E8622A&chls=1%7C4%7C8&chs=700x280&chxt=x,y&chdl=chls%3D1%7Cchls%3D4%7Cchls%3D8&chdlp=b&chtt=Line+thickness

Line chart with three series drawn at one, four and eight pixels wide
The legend below the chart names the chls value used for each series.

Dashed Lines

The second number turns the line into a dashed one, and the third sets the gap. chls=2,6,3 is a two pixel line drawn as six pixel dashes with three pixel gaps.

https://image-charts.com/chart?cht=lc&chd=a:10,14,12,18,22,20%7C30,34,32,38,42,40%7C50,54,52,58,62,60&chco=1F3B99,00A550,E8622A&chls=2%7C2,6,3%7C2,14,6&chs=700x280&chxt=x,y&chdl=solid%7C6+and+3%7C14+and+6&chdlp=b&chtt=Dash+patterns

Line chart comparing a solid line with two dash patterns of different lengths
All three series are two pixels wide. Only the dash and gap lengths differ, so the pattern is what separates them rather than the weight.

Dashes are the usual way to mark a series the reader should read differently, a forecast or a threshold rather than a measurement. Keeping the dashed series the same width as the solid one keeps it legible without making it shout.

Which Chart Types Read chls

The three line chart types all accept chls, and they differ in what they draw around the line.

Line chart types and their default axes
cht valueWhat It Draws
lcA line chart with points spaced evenly along the x-axis. Axis lines are drawn by default.
lsThe same chart with no axis lines, which is what a sparkline is. Useful when the chart sits inline in a table or an email.
lxyA line chart where you give both coordinates of every point instead of the y values alone, as alternating x and y series.

Appending :nda to any of them, as in cht=lc:nda, hides the axis lines even when chxt asked for them.

https://image-charts.com/chart?cht=lxy&chd=a:5,20,40,70,90%7C10,35,25,60,50&chls=3&chco=1F3B99&chs=700x260&chxt=x,y&chtt=cht%3Dlxy

An lxy line chart with x and y coordinates given per point, drawn three pixels wide
An lxy chart reads its coordinates in pairs of series, x first, then y. chls applies to it exactly as it does to lc.

Colour, Markers and the Curve

chls covers width and dashes and nothing else. Line colours come from chco, and the shapes drawn at each data point come from chm.

The curve is not configurable. Image-Charts applies the same small rounding at every data point on every line chart, and no query parameter changes it, so a request for perfectly straight segments or for a heavily smoothed spline cannot be expressed in the URL. The reference documentation lists every parameter the API accepts.

Style a Line Chart

Build a Chart