8f09465a1ceb69a8360e36ae2d73f7054e6e40fc
[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:%S',
24                                 fit: false
25                         }
26                 },
27                 y: {
28                         label: {
29                                 text: '°C',
30                                 position: 'outer-middle'
31                         }
32                 }
33         },
34         zoom: {
35                 enabled: true
36         },
37         tooltip: {
38                 format: {
39                         name: function (name, ratio, id, index) {
40                                 var re = /\d m/;
41                                 var res = re.exec(name);
42                                 return res;
43                         }
44                 }
45         }
46 });
47