Debian Codegraph @

htdocs/samples/regions_timeseries.html

raw
1 <html>
2 <head>
3 <link rel="stylesheet" type="text/css" href="/css/c3.css">
4 </head>
5 <body>
6 <div id="chart"></div>
7
8 <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
9 <script src="/js/c3.js"></script>
10 <script>
11
12 var chart = c3.generate({
13 data: {
14 x: 'date',
15 columns: [
16 ['date', '2014-01-01', '2014-01-10', '2014-01-20', '2014-01-30', '2014-02-01'],
17 ['sample', 30, 200, 100, 400, 150, 250]
18 ]
19 },
20 axis: {
21 x: {
22 type: 'timeseries',
23 tick: {
24 format: '%Y%m%d %H:%M:%S'
25 }
26 },
27 },
28 regions: [
29 {start: '2014-01-05', end: '2014-01-10'},
30 // {start: new Date('2014-01-10'), end: new Date('2014-01-15')},
31 {start: 1390608000000, end: 1391040000000}
32 ]
33 });
34
35 setTimeout(function () {
36 chart.load({
37 columns: [
38 ['date', +new Date('2014-01-01'), +new Date('2014-01-10'), +new Date('2014-03-01')],
39 ['sample', 100, 200, 300]
40 ]
41 });
42 chart.regions([
43 {start: +new Date('2014-01-10'), end: +new Date('2014-01-15')}
44 ]);
45 }, 1000);
46
47 </script>
48 </body>
49 </html>