JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://cdn.anychart.com/releases/8.0.1/css/anychart-ui.min.css">
<link rel="stylesheet" href="https://cdn.anychart.com/releases/8.0.1/fonts/css/anychart-font.min.css">
<script src="https://cdn.anychart.com/releases/8.0.1/js/anychart-base.min.js"></script>
<script src="https://cdn.anychart.com/releases/8.0.1/js/anychart-ui.min.js"></script>
<script src="https://cdn.anychart.com/releases/8.0.1/js/anychart-exports.min.js"></script>
<div id="container"></div>
CSS
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#container {
max-width: 800px;
height: 400px;
margin: 1em auto;
}
JavaScript
anychart.onDocumentReady(function () {
// create data set on our data
var dataSet = anychart.data.set(getData());
// map data for the first series, take x from the zero column and value from the first column of data set
var seriesData_1 = dataSet.mapAs({'x': 0, 'value': 1});
// map data for the second series, take x from the zero column and value from the second column of data set
var seriesData_2 = dataSet.mapAs({'x': 0, 'value': 2});
// map data for the third series, take x from the zero column and value from the third column of data set
var seriesData_3 = dataSet.mapAs({'x': 0, 'value': 3});
// create line chart
var chart = anychart.line();
// turn on chart animation
chart.animation(true);
// set chart padding
chart.padding([10, 20, 5, 20]);
// turn on the crosshair
chart.crosshair()
.enabled(true)
.yLabel(false)
.yStroke(null);
// set tooltip mode to point
chart.tooltip().positionMode('point');
// set chart title text settings
chart.title('Trend of Sales of the Most Popular Products of ACME Corp.');
// set yAxis title
chart.yAxis().title('Number of Bottles Sold (thousands)');
chart.xAxis().labels().padding(5);
// create first series with mapped data
var series_1 = chart.line(seriesData_1);
series_1.name('Brandy');
series_1.hovered().markers()
.enabled(true)
.type('circle')
.size(4);
series_1.tooltip()
.position('right')
.anchor('left-center')
.offsetX(5)
.offsetY(5);
// create second series with mapped data
var series_2 = chart.line(seriesData_2);
series_2.name('Whiskey');
series_2.hovered().markers()
.enabled(true)
.type('circle')
.size(4);
series_2.tooltip()
.position('right')
.anchor('left-center')
.offsetX(5)
...