* ---------------------------------------
* 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/
* ---------------------------------------
am4core . useTheme ( am4themes_animated );
var chart = am4core . create ( " chartdiv " , am4charts . XYChart );
date: new Date ( 2018 , 0 , 1 ),
date: new Date ( 2018 , 0 , 2 ),
date: new Date ( 2018 , 0 , 3 ),
date: new Date ( 2018 , 0 , 4 ),
date: new Date ( 2018 , 0 , 5 ),
date: new Date ( 2018 , 0 , 6 ),
date: new Date ( 2018 , 0 , 7 ),
var dateAxis = chart . xAxes . push ( new am4charts . DateAxis ());
dateAxis . renderer . grid . template . location = 0 ;
dateAxis . renderer . minGridDistance = 30 ;
var valueAxis = chart . yAxes . push ( new am4charts . ValueAxis ());
function createSeries ( field , name ) {
var series = chart . series . push ( new am4charts . LineSeries ());
series . dataFields . valueY = field ;
series . dataFields . dateX = " date " ;
series . tooltipText = " {dateX}: [b]{valueY}[/] " ;
series . adapter . add ( " tooltipText " , function ( text ) {
var text = " [bold]{dateX}[/] \n " ;
chart . series . each ( function ( item ) {
" [ " + item . stroke . hex + " ]●[/] " + item . name + " : { " + item . dataFields . valueY + " } \n " ;
series . tooltip . getFillFromObject = false ;
series . tooltip . background . fill = am4core . color ( " #fff " );
series . tooltip . label . fill = am4core . color ( " #00 " );
// Prevent cross-fading of tooltips
series . tooltip . defaultState . transitionDuration = 0 ;
series . tooltip . hiddenState . transitionDuration = 0 ;
var bullet = series . bullets . push ( new am4charts . CircleBullet ());
bullet . circle . stroke = am4core . color ( " #fff " );
bullet . circle . strokeWidth = 2 ;
createSeries ( " value " , " Series #1 " );
createSeries ( " value2 " , " Series #2 " );
createSeries ( " value3 " , " Series #3 " );
chart . legend = new am4charts . Legend ();
chart . cursor = new am4charts . XYCursor ();
chart . cursor . maxTooltipDistance = 0 ;