Timeline

Timelines are used to depict a sequence of events. This demo shows how you can use a simple <code>LineSeries</code> together with some states and data binding to implement a good looking Timeline. For down-to-the-bold details on how it is implement, please read our "<a href="https://www.amcharts.com/docs/v4/tutorials/creating-timeline-charts/">Creating Timeline Charts</a>" tutorial.

by navinleon

HTML

<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<div id="chartdiv"></div>

CSS

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

#chartdiv {
  width: 100%;
  height: 350px;
}

JavaScript

/**
 * ---------------------------------------
 * This demo was created using amCharts 4.
 * 
 * For more information visit:
 * https://www.amcharts.com/
 * 
 * Documentation is available at:
 * https://www.amcharts.com/docs/v4/
 * ---------------------------------------
 */

// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end

// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);

// Add data
chart.data = [{
  "x": 1,
  "y": 1,
  "text": "[bold]2018 Q1[/]\nThere seems to be some furry animal living in the neighborhood.",
  "center": "bottom"
}, {
  "x": 2,
  "y": 1,
  "text": "[bold]2018 Q2[/]\nWe're now mostly certain it's a fox.",
  "center": "top"
}, {
  "x": 3,
  "y": 1,
  "text": "[bold]2018 Q3[/]\nOur dog does not seem to mind the newcomer at all.",
  "center": "bottom"
}, {
  "x": 5,
  "y": 1,
  "text": "[bold]2018 Q4[/]\nThe quick brown fox jumps over the lazy dog.",
  "center": "top"
}, {
  "x": 6,
  "y": 1,
  "text": "[bold]2018 Q4[/]\nThe quick brown fox jumps over the lazy dog.",
  "center": "top"
}, {
  "x": 7,
  "y": 1,
  "text": "[bold]2018 Q4[/]\nThe quick brown fox jumps over the lazy dog.",
  "center": "top"
}, {
  "x": 8,
  "y": 1,
  "text": "[bold]2018 Q4[/]\nThe quick brown fox jumps over the lazy dog.",
  "center": "top"
}, {
  "x": 9,
  "y": 1,
  "text": "[bold]2018 Q4[/]\nThe quick brown fox jumps over the lazy dog.",
  "center": "top"
}, {
  "x": 11,
  "y": 1,
  "text": "[bold]2018 Q4[/]\nThe quick brown fox jumps over the lazy dog.",
  "center": "top"
}];

// Create axes
var xAxis = chart.xAxes.push(new am4charts.CategoryAxis());
xAxis.dataFields.category = "x";
xAxis.renderer.grid.template.disabled = true;
xAxis.renderer.labels.template.disabled = true;
xAxis.tooltip.disabled = true;

var yAxis = chart.yAxes.push(new am4charts.ValueAxis());
yAxis.min = 0;
yAxis.max = 1.99;
yAxis.renderer.grid.template.disabled = true;
yAxis.renderer.labels.template.disabled =...