debian-mirror-gitlab/app/assets/javascripts/monitoring/components/graph/path.vue

66 lines
1.3 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-05-09 12:01:36 +05:30
export default {
props: {
generatedLinePath: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-05-09 12:01:36 +05:30
generatedAreaPath: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-05-09 12:01:36 +05:30
lineStyle: {
type: String,
required: false,
default: '',
},
lineColor: {
type: String,
required: true,
},
areaColor: {
type: String,
required: true,
},
2018-10-15 14:42:47 +05:30
currentCoordinates: {
type: Object,
required: false,
default: () => ({ currentX: 0, currentY: 0 }),
},
showDot: {
type: Boolean,
required: true,
},
2018-05-09 12:01:36 +05:30
},
computed: {
strokeDashArray() {
if (this.lineStyle === 'dashed') return '3, 1';
if (this.lineStyle === 'dotted') return '1, 1';
return null;
},
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
2018-10-15 14:42:47 +05:30
<g transform="translate(-5, 20)">
<circle
2018-11-08 19:23:39 +05:30
v-if="showDot"
2018-10-15 14:42:47 +05:30
:cx="currentCoordinates.currentX"
:cy="currentCoordinates.currentY"
:fill="lineColor"
:stroke="lineColor"
2018-11-08 19:23:39 +05:30
class="circle-path"
2018-10-15 14:42:47 +05:30
r="3"
/>
2018-12-23 12:14:25 +05:30
<path :d="generatedAreaPath" :fill="areaColor" class="metric-area" />
2018-03-17 18:26:18 +05:30
<path
:d="generatedLinePath"
:stroke="lineColor"
2018-11-08 19:23:39 +05:30
:stroke-dasharray="strokeDashArray"
class="metric-line"
2018-03-17 18:26:18 +05:30
fill="none"
stroke-width="1"
/>
</g>
</template>