Browse Source

Add sample for region with timeseries

pull/703/head
Masayuki Tanaka 10 years ago
parent
commit
02e3de23a5
  1. 3
      htdocs/index.html
  2. 49
      htdocs/samples/regions_timeseries.html

3
htdocs/index.html

@ -273,6 +273,9 @@
<a href="./samples/regions.html">
Show regions
</a>
<a href="./samples/regions_timeseries.html">
Show regions with timeseries
</a>
</div>
<div class="col-md-4">
<h3>Legend</h3>

49
htdocs/samples/regions_timeseries.html

@ -0,0 +1,49 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/c3.css">
</head>
<body>
<div id="chart"></div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="/js/c3.js"></script>
<script>
var chart = c3.generate({
data: {
x: 'date',
columns: [
['date', '2014-01-01', '2014-01-10', '2014-01-20', '2014-01-30', '2014-02-01'],
['sample', 30, 200, 100, 400, 150, 250]
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y%m%d %H:%M:%S'
}
},
},
regions: [
{start: '2014-01-05', end: '2014-01-10'},
// {start: new Date('2014-01-10'), end: new Date('2014-01-15')},
{start: 1390608000000, end: 1391040000000}
]
});
setTimeout(function () {
chart.load({
columns: [
['date', +new Date('2014-01-01'), +new Date('2014-01-10'), +new Date('2014-03-01')],
['sample', 100, 200, 300]
]
});
chart.regions([
{start: +new Date('2014-01-10'), end: +new Date('2014-01-15')}
]);
}, 1000);
</script>
</body>
</html>
Loading…
Cancel
Save