85a10d3afc1bc1b2ce85605f3bf76bd25bb3b70d
[chrisu/seepark.git] / web / static / seepark_web.js
1 var chart = c3.generate({
2         bindto: '#chart',
3         title: {
4                 text: 'Temperaturen'
5         },
6         data: {
7                 url: '/data',
8                 mimeType: 'json',
9                 xs: {
10                         '0316a2193bff': '0316a2193bff_x',
11                         '0316a21383ff': '0316a21383ff_x'
12                 },
13                 names: {
14                         '0316a2193bff': 'Wassertemperatur in 4 m Tiefe',
15                         '0316a21383ff': 'Wassertemperatur in 5 m Tiefe'
16                 },
17                 xFormat: '%Y-%m-%d %H:%M:%S'
18         },
19         axis: {
20                 x: {
21                         type: 'timeseries',
22                         tick: {
23                                 format: '%Y-%m-%d %H:%M',
24                                 fit: false,
25                                 multiline: true, // broken? so →
26                                 rotate: -90
27                         }
28                 },
29                 y: {
30                         label: {
31                                 text: '°C',
32                                 position: 'outer-middle'
33                         }
34                 }
35         },
36         zoom: {
37                 enabled: true
38         },
39         tooltip: {
40                 format: {
41                         name: function (name, ratio, id, index) {
42                                 var re = /\d m/;
43                                 var res = re.exec(name);
44                                 return res;
45                         }
46                 }
47         }
48 });
49