Files: ca44a0a40e4d24c2b6b42467fac6072170073817 / config / chart.js
1202 bytesRaw
1 | const { resolve } = require('mutant') |
2 | |
3 | const DAY = 24 * 60 * 60 * 1000 |
4 | |
5 | module.exports = function chartConfig ({ context }) { |
6 | const { lower, upper } = resolve(context.range) |
7 | |
8 | // Ticktack Primary color:'hsla(215, 57%, 43%, 1)', |
9 | const barColor = 'hsla(215, 57%, 60%, 1)' |
10 | |
11 | return { |
12 | type: 'bar', |
13 | data: { |
14 | datasets: [{ |
15 | backgroundColor: barColor, |
16 | borderColor: barColor, |
17 | data: [] |
18 | }] |
19 | }, |
20 | options: { |
21 | legend: { |
22 | display: false |
23 | }, |
24 | scales: { |
25 | xAxes: [{ |
26 | type: 'time', |
27 | distribution: 'linear', |
28 | time: { |
29 | unit: 'day', |
30 | min: lower, |
31 | max: upper, |
32 | tooltipFormat: 'MMMM D', |
33 | stepSize: 7 |
34 | }, |
35 | bounds: 'ticks', |
36 | ticks: { |
37 | // maxTicksLimit: 4 |
38 | }, |
39 | gridLines: { |
40 | display: false |
41 | }, |
42 | maxBarThickness: 20 |
43 | }], |
44 | |
45 | yAxes: [{ |
46 | ticks: { |
47 | min: 0, |
48 | suggestedMax: 10, |
49 | // max: Math.max(localMax, 10), |
50 | stepSize: 5 |
51 | } |
52 | }] |
53 | }, |
54 | animation: { |
55 | // duration: 300 |
56 | } |
57 | } |
58 | } |
59 | } |
60 |
Built with git-ssb-web