-
-
Notifications
You must be signed in to change notification settings - Fork 837
/
Copy pathApp.vue
188 lines (172 loc) Β· 4.3 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<template>
<div class="container">
<div class="Chart">
<h1 style="text-align: center">Barchart</h1>
<bar-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Horizontal Barchart</h1>
<horizontal-bar-example />
</div>
<div class="Chart">
<h1 style="text-align: center">
Barchart with reactive mixing for live data
</h1>
<reactive-example />
</div>
<div class="Chart">
<h1 style="text-align: center">
Barchart with reactive mixing for live data as props
</h1>
<reactive-prop-example :chart-data="dataPoints" />
</div>
<div class="Chart">
<h1 style="text-align: center">Linechart</h1>
<line-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Doughnutchart</h1>
<doughnut-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Piechart</h1>
<pie-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Radarchart</h1>
<radar-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Polararea</h1>
<polar-area-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Bubblechart</h1>
<bubble-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Scatter Chart</h1>
<scatter-example />
</div>
<div class="Chart">
<h1 style="text-align: center">Custom Line Chart</h1>
<custom-line />
</div>
</div>
</template>
<script>
import BarExample from './components/bar/BarExample'
import LineExample from './components/line/LineExample'
import DoughnutExample from './components/doughnut/DoughnutExample'
import PieExample from './components/pie/PieExample'
import RadarExample from './components/radar/RadarExample'
import PolarAreaExample from './components/polar-area/PolarAreaExample'
import BubbleExample from './components/bubble/BubbleExample'
import ReactiveExample from './components/reactive/ReactiveExample'
import ReactivePropExample from './components/reactive-prop/ReactivePropExample'
import ScatterExample from './components/scatter/ScatterExample'
import HorizontalBarExample from './components/horizontal-bar/HorizontalBarExample'
import CustomLine from './components/custom/CustomExample'
export default {
components: {
BarExample,
LineExample,
DoughnutExample,
CustomLine,
PieExample,
RadarExample,
PolarAreaExample,
BubbleExample,
ReactiveExample,
ReactivePropExample,
ScatterExample,
HorizontalBarExample
},
data() {
return {
dataPoints: {},
height: 20
}
},
computed: {
myStyles() {
return {
height: `${this.height}px`,
position: 'relative'
}
}
},
mounted() {
setInterval(() => {
this.fillData()
}, 2000)
},
methods: {
increaseHeight() {
this.height += 10
},
getRandomInt() {
return Math.floor(Math.random() * (50 - 5 + 1)) + 5
},
fillData() {
this.dataPoints = {
labels: [
'January' + this.getRandomInt(),
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
],
datasets: [
{
label: 'Data One',
backgroundColor: '#f87979',
data: [
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt(),
this.getRandomInt()
]
}
]
}
}
}
}
</script>
<style>
.container {
max-width: 800px;
margin: 0 auto;
}
h1 {
font-family: 'Helvetica', Arial;
color: #464646;
text-transform: uppercase;
border-bottom: 1px solid #f1f1f1;
padding-bottom: 15px;
font-size: 28px;
margin-top: 0;
}
.Chart {
padding: 20px;
box-shadow: 0px 0px 20px 2px rgba(0, 0, 0, 0.4);
border-radius: 20px;
margin: 50px 0;
}
</style>