commit | author | age | ||
9bcb19 | 1 | <template> |
I | 2 | <div :style="{ padding: '0 0 32px 32px' }"> |
3 | <h4 :style="{ marginBottom: '20px' }">{{ title }}</h4> | |
4 | <v-chart | |
5 | height="254" | |
6 | :data="data" | |
7 | :forceFit="true" | |
8 | :padding="['auto', 'auto', '40', '50']"> | |
9 | <v-tooltip /> | |
10 | <v-axis /> | |
11 | <v-bar position="x*y"/> | |
12 | </v-chart> | |
13 | </div> | |
14 | </template> | |
15 | ||
16 | <script> | |
17 | export default { | |
18 | name: 'Bar', | |
19 | props: { | |
20 | title: { | |
21 | type: String, | |
22 | default: '' | |
23 | }, | |
24 | data: { | |
25 | type: Array, | |
26 | default: () => { | |
27 | return [] | |
28 | } | |
29 | }, | |
30 | scale: { | |
31 | type: Array, | |
32 | default: () => { | |
33 | return [{ | |
34 | dataKey: 'x', | |
35 | min: 2 | |
36 | }, { | |
37 | dataKey: 'y', | |
38 | title: '时间', | |
39 | min: 1, | |
40 | max: 22 | |
41 | }] | |
42 | } | |
43 | }, | |
44 | tooltip: { | |
45 | type: Array, | |
46 | default: () => { | |
47 | return [ | |
48 | 'x*y', | |
49 | (x, y) => ({ | |
50 | name: x, | |
51 | value: y | |
52 | }) | |
53 | ] | |
54 | } | |
55 | } | |
56 | }, | |
57 | data () { | |
58 | return { | |
59 | } | |
60 | } | |
61 | } | |
62 | </script> |