<!doctype html>
<html>
<head>
<title>Timeline</title>
<script type="text/javascript" src="https://unpkg.com/vis-timeline@latest/standalone/umd/vis-timeline-graph2d.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<link href="https://unpkg.com/vis-timeline@latest/styles/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body,
html {
font-family: sans-serif;
}
#visualization {
width: 600px;
}
</style>
</head>
<body>
<div id="visualization"></div>
<script type="text/javascript">
var container = document.getElementById("visualization");
var items = [
{ x: "2014-06-11", y: 10 },
{ x: "2014-06-12", y: 25 },
{ x: "2014-06-13", y: 30 },
{ x: "2014-06-14", y: 10 },
{ x: "2014-06-15", y: 15 },
{ x: "2014-06-16", y: 30 },
{ x: "2014-06-11", y: 100 },
{ x: "2014-06-12", y: 250 },
{ x: "2014-06-13", y: 300 },
{ x: "2014-06-14", y: 100 },
{ x: "2014-06-15", y: 150 },
{ x: "2014-06-16", y: 300 },
{ x: "2014-06-11", y: 400 },
{ x: "2014-06-12", y: 450 },
{ x: "2014-06-13", y: 400 },
{ x: "2014-06-14", y: 500 },
{ x: "2014-06-15", y: 420 },
{ x: "2014-06-16", y: 600 },
{ x: "2014-06-11", y: 810 },
{ x: "2014-06-12", y: 825 },
{ x: "2014-06-13", y: 830 },
{ x: "2014-06-14", y: 810 },
{ x: "2014-06-15", y: 815 },
{ x: "2014-06-16", y: 900 },
];
var dataset = new vis.DataSet(items);
var options = {
legend: true,
sort: false,
defaultGroup: "doodle",
graphHeight: "1500px",
height: "500px",
start: "2014-06-10",
end: "2014-06-18",
};
var graph2d = new vis.Graph2d(container, dataset, options);
</script>
</body>
</html>
点击查看详情