summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/monitoring/components/graph/path.vue
blob: c9721c4cb018692dd5c0b50c178215032e7584dd (plain)
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
<script>
  export default {
    props: {
      generatedLinePath: {
        type: String,
        required: true,
      },
      generatedAreaPath: {
        type: String,
        required: true,
      },
      lineStyle: {
        type: String,
        required: false,
        default: '',
      },
      lineColor: {
        type: String,
        required: true,
      },
      areaColor: {
        type: String,
        required: true,
      },
    },
    computed: {
      strokeDashArray() {
        if (this.lineStyle === 'dashed') return '3, 1';
        if (this.lineStyle === 'dotted') return '1, 1';
        return null;
      },
    },
  };
</script>
<template>
  <g>
    <path
      class="metric-area"
      :d="generatedAreaPath"
      :fill="areaColor"
      transform="translate(-5, 20)"
    />
    <path
      class="metric-line"
      :d="generatedLinePath"
      :stroke="lineColor"
      fill="none"
      stroke-width="1"
      :stroke-dasharray="strokeDashArray"
      transform="translate(-5, 20)"
    />
  </g>
</template>