ChartAct / web /AnyChart /line /chart_0049_line.html
wumumu's picture
Add files using upload-large-folder tool
7b52e07 verified
Raw History Blame Contribute Delete
2.84 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>CS Scroller 14</title>
<link href="https://playground.anychart.com/docs/samples/CS_Scroller_14/iframe" rel="canonical">
<meta content="Line Chart" name="keywords">
<meta content="AnyChart - JavaScript Charts designed to be embedded and integrated" name="description">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="_deps/cdn.anychart.com/releases/8.14.1/css/anychart-ui.min_qe95e7e741b.css" rel="stylesheet" type="text/css">
<style>html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}</style>
</head>
<body>
<div id="container"></div>
<script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-base.min_qe95e7e741b.js"></script>
<script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-exports.min_qe95e7e741b.js"></script>
<script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-ui.min_qe95e7e741b.js"></script>
<script type="text/javascript">anychart.onDocumentReady(function () {
// create a chart
var chart = anychart.line();
// enable the scroller
chart.xScroller(true);
var xZoom = chart.xZoom();
// zooms settings
xZoom.setToPointsCount(6);
var startRatio = xZoom.getStartRatio();
var endRatio = xZoom.getEndRatio();
// get the limits ratio
chart.title("The chart shows the part from " + startRatio + " to " + endRatio);
// adding a listener
chart.xScroller().listen("scrollerchangefinish", function(e){
var startRatio = e.startRatio;
var endRatio = e.endRatio;
// change the chart title
chart.title("The chart shows the part from " + startRatio + " to " + endRatio);
});
// create a series
var series = chart.line(getData());
series.name("Total support requests");
// create a chart settings
chart.xAxis().title("Hours");
chart.yAxis().title("Support requests");
// display a chart
chart.container("container");
chart.draw();
});
function getData(){
return [
["00:00", 10],
["01:00", 4],
["02:00", 17],
["03:00", 20],
["04:00", 20],
["05:00", 16],
["06:00", 35],
["07:00", 6],
["08:00", 15],
["09:00", 19],
["10:00", 25],
["11:00", 34],
["12:00", 42],
["13:00", 14],
["14:00", 50],
["15:00", 25],
["16:00", 34],
["17:00", 40],
["18:00", 64],
["19:00", 48],
["20:00", 22],
["21:00", 37],
["22:00", 53],
["23:00", 62]
];
}</script>
</body>
</html>