The DateTime Axis maps time values evenly between a minimum and maximum value along
a chart axis. By default, it determines minimum, maximum, interval and intervalType
values from the charting data to fit all of the chart elements on the screen. You
can also explicitly set specific values for these properties.
The DateTime Axis chooses the most reasonable intervals to mark the axis by examining
the range between the minimum and maximum values of the axis.
In this sample the minimum, maximum, interval and intervalType are set explicitly.
For detailed implementation, please take a look at the HTML code tab.
<!DOCTYPE html>
<html>
<head>
<title>DateTime Axis Example - JavaScript Chart by dvxCharts</title>
<link rel="stylesheet" type="text/css" href="../../css/dvxCharts.chart.min.css" />
<link rel="stylesheet" type="text/css" href="../../themes/base/styles.css" />
<script src="../../js/dvxCharts.chart.min.js" type="text/javascript"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
.example-container {
width: 100%;
max-width: 500px;
height: 300px;
}
</style>
<script lang="javascript" type="text/javascript">
var chart = new dvxCharts.Chart({
title: {
text: 'DateTime Axis'
},
animation: {
duration: 1
},
axes: [
{
type: 'dateTime',
location: 'bottom',
minimum: new Date(2011, 1, 4),
maximum: new Date(2011, 1, 18),
interval: 1,
intervalType: 'days' // 'years' | 'months' | 'weeks' | 'days' | 'minutes' | 'seconds' | 'millisecond'
}
],
series: [
{
type: 'line',
data: [[new Date(2011, 1, 6), 70], [new Date(2011, 1, 8), 82],
[new Date(2011, 1, 10), 85], [new Date(2011, 1, 12), 70],
[new Date(2011, 1, 14), 65], [new Date(2011, 1, 16), 68]]
}
]
});
chart.write('container');
</script>
</head>
<body>
<div>
<div id="container" class="example-container">
</div>
</div>
</body>
</html>