|
|
@@ -7,38 +7,38 @@
|
|
7
|
7
|
</template>
|
|
8
|
8
|
|
|
9
|
9
|
<script>
|
|
10
|
|
- import { GChart } from 'vue-google-charts'
|
|
|
10
|
+ import { GChart } from 'vue-google-charts'
|
|
11
|
11
|
|
|
12
|
|
- export default {
|
|
13
|
|
- name: "ElevationGraph",
|
|
14
|
|
- components: { GChart },
|
|
15
|
|
- data () {
|
|
16
|
|
- return {
|
|
17
|
|
- currentRoute: null,
|
|
18
|
|
- elevationService: null,
|
|
19
|
|
- chartData: [],
|
|
20
|
|
- chartOptions: {
|
|
21
|
|
- chart: {
|
|
22
|
|
- title: 'Elevation Report'
|
|
23
|
|
- }
|
|
24
|
|
- }
|
|
25
|
|
- }
|
|
26
|
|
- },
|
|
27
|
|
- methods: {
|
|
28
|
|
- getPathElevation (currentRoute) {
|
|
29
|
|
- this.chartData = []
|
|
30
|
|
- this.elevationService = new google.maps.ElevationService() // eslint-disable-line no-undef
|
|
31
|
|
- this.elevationService.getElevationAlongPath({
|
|
32
|
|
- 'path': currentRoute,
|
|
33
|
|
- 'samples': 256
|
|
34
|
|
- }, function (elevations, status) {
|
|
35
|
|
- if (status === 'OK') {
|
|
36
|
|
- elevations.forEach(e => this.chartData.push(['', e.elevation]))
|
|
37
|
|
- }
|
|
38
|
|
- })
|
|
|
12
|
+ export default {
|
|
|
13
|
+ name: 'ElevationGraph',
|
|
|
14
|
+ components: { GChart },
|
|
|
15
|
+ data () {
|
|
|
16
|
+ return {
|
|
|
17
|
+ currentRoute: null,
|
|
|
18
|
+ elevationService: null,
|
|
|
19
|
+ chartData: [],
|
|
|
20
|
+ chartOptions: {
|
|
|
21
|
+ chart: {
|
|
|
22
|
+ title: 'Elevation Report'
|
|
39
|
23
|
}
|
|
40
|
24
|
}
|
|
|
25
|
+ }
|
|
|
26
|
+ },
|
|
|
27
|
+ methods: {
|
|
|
28
|
+ getPathElevation () {
|
|
|
29
|
+ this.chartData = []
|
|
|
30
|
+ this.elevationService = new google.maps.ElevationService() // eslint-disable-line no-undef
|
|
|
31
|
+ this.elevationService.getElevationAlongPath({
|
|
|
32
|
+ 'path': this.currentRoute,
|
|
|
33
|
+ 'samples': 256
|
|
|
34
|
+ }, function (elevations, status) {
|
|
|
35
|
+ if (status === 'OK') {
|
|
|
36
|
+ elevations.forEach(e => this.chartData.push(['', e.elevation]))
|
|
|
37
|
+ }
|
|
|
38
|
+ })
|
|
|
39
|
+ }
|
|
41
|
40
|
}
|
|
|
41
|
+ }
|
|
42
|
42
|
</script>
|
|
43
|
43
|
|
|
44
|
44
|
<style scoped>
|