CSS ANIMATION

JanFebMarAprMayJunJulAugSepOctNovDec051015

Specifying the style of your chart in CSS is not only cleaner but also enables you to use awesome CSS animations and transitions to be applied to your SVG elements!

Line

Simple Line Chart

An example of a simple line chart with three series.

MondayTuesdayWednesdayThursdayFriday051015

Line Scatter Diagram

This advanced example uses a line chart to draw a scatter diagram. The data object is created with a functional style random mechanism. There is a mobile first responsive configuration using the responsive options to show less labels on small screens.

W1W5W9W13W17W21W25W29W33W37W41W45W4904080

Line Chart With Tooltips

This is just one of many benefits of using inline-SVG and provides you with the freedom you need in order to create exactly the experience you're looking for.

123456051015

Line Chart With Area

This chart uses the showArea option to draw line, dots but also an area shape. Use the low option to specify a fixed lower bound that will make the area expand. You can also use the areaBase property to specify a data value that will be used to determine the area shape base position (this is 0 by default).

1234567802468

Bi-Polar Line Chart With Area Only

You can also only draw the area shapes of the line chart. Area shapes will always be constructed around their areaBase (that can be configured in the options) which also allows you to draw nice bi-polar areas.

-3-113

Advanced Smil Animations

Chartist provides a simple API to animate the elements on the Chart using SMIL. Usually you can achieve most animation with CSS3 animations but in some cases you'd like to animate SVG properties that are not available in CSS.

123456789101112051015

Svg Path Animation

Path animation is made easy with the SVG Path API. The API allows you to modify complex SVG paths and transform them for different animation morphing states.

MonTueWedThuFriSat02468

Line Interpolation / Smoothing

By default Chartist uses a cardinal spline algorithm to smooth the lines. However, like all other things in Chartist, this can be customized easily!

12345051015

Bar

Bi-Polar Bar Chart

A bi-plar bar chart with a range limit set with low and high. There is also an interpolation function used to skip every odd grid line / label.

W1W3W5W7W9-10-50510

Overlapping Bars On Mobile

This example makes use of label interpolation and the seriesBarDistance property that allows you to make bars overlap over each other. This then can be used to use the available space on mobile better.

JanFebMarAprMaiJunJulAugSepOctNovDec02.557.510

Add Peak Circles Using The Draw Events

With the help of draw events we are able to add a custom SVG shape to the peak of our bars.

W1W3W5W7W9-10-50510

Multi-Line Labels

Chartist will figure out if your browser supports foreignObject and it will use them to create labels that re based on regular HTML text elements. Multi-line and regular CSS styles are just two of many benefits while using foreignObjects!

First quarter of the yearSecond quarter of the yearThird quarter of the yearFourth quarter of the year0 CHF20000 CHF40000 CHF60000 CHF80000 CHF

Stacked Bar Chart

You can also set your bar chart to stack the series bars on top of each other easily by using the stackBars property in your configuration.

Q1Q2Q3Q40k1000k2000k3000k

Horizontal Bar Chart

Guess what! Creating horizontal bar charts is as simple as it can get. There's no new chart type you need to learn, just passing an additional option is enough.

SundaySaturdayFridayThursdayWednesdayTuesdayMonday00.31250.6250.93751.251.56251.8752.18752.52.81253.1253.43753.754.06254.3754.687555.31255.6255.93756.256.56256.8757.18757.57.81258.1258.43758.759.06259.3759.687510

Extreme Responsive Configuration

As all settings of a chart can be customized with the responsive configuration override mechanism of Chartist, you can create a chart that adopts to every media condition!

Quarter 1Quarter 2Quarter 3Quarter 402468

Pie

Simple Pie Chart

A very simple pie chart with label interpolation to show percentage instead of the actual data series value.

42%25%33%

Pie Chart With Custom Labels

This pie chart is configured with custom labels specified in the data object. On desktop we use the labelOffset property to offset the labels from the center. Also labelDirection can be used to control the direction in which the labels are expanding.

BananasApplesGrapes

Gauge Chart

This pie chart uses donut, startAngle and total to draw a gauge chart.