Commit d6b0e23a authored by Mike Greiling's avatar Mike Greiling

add dashed and dotted line styles for multiple-query graphs

parent 5af31d6e
...@@ -247,6 +247,7 @@ ...@@ -247,6 +247,7 @@
:key="index" :key="index"
:generated-line-path="path.linePath" :generated-line-path="path.linePath"
:generated-area-path="path.areaPath" :generated-area-path="path.areaPath"
:line-style="path.lineStyle"
:line-color="path.lineColor" :line-color="path.lineColor"
:area-color="path.areaColor" :area-color="path.areaColor"
/> />
......
...@@ -92,6 +92,12 @@ ...@@ -92,6 +92,12 @@
} }
return `${this.legendTitle} series ${index + 1} ${this.formatMetricUsage(series)}`; return `${this.legendTitle} series ${index + 1} ${this.formatMetricUsage(series)}`;
}, },
strokeDashArray(type) {
if (type === 'dashed') return '6, 3';
if (type === 'dotted') return '3, 3';
return null;
},
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -162,13 +168,15 @@ ...@@ -162,13 +168,15 @@
v-for="(series, index) in timeSeries" v-for="(series, index) in timeSeries"
:key="index" :key="index"
:transform="translateLegendGroup(index)"> :transform="translateLegendGroup(index)">
<rect <line
:fill="series.areaColor" :stroke="series.lineColor"
:width="measurements.legends.width" :stroke-width="measurements.legends.height"
:height="measurements.legends.height" :stroke-dasharray="strokeDashArray(series.lineStyle)"
x="20" x1="20"
:y="graphHeight - measurements.legendOffset"> :x2="20 + measurements.legends.width"
</rect> :y1="graphHeight - measurements.legendOffset"
:y2="graphHeight - measurements.legendOffset">
</line>
<text <text
v-if="timeSeries.length > 1" v-if="timeSeries.length > 1"
class="legend-metric-title" class="legend-metric-title"
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
type: String, type: String,
required: true, required: true,
}, },
lineStyle: {
type: String,
required: true,
},
lineColor: { lineColor: {
type: String, type: String,
required: true, required: true,
...@@ -18,6 +22,13 @@ ...@@ -18,6 +22,13 @@
required: true, required: true,
}, },
}, },
computed: {
strokeDashArray() {
if (this.lineStyle === 'dashed') return '3, 1';
if (this.lineStyle === 'dotted') return '1, 1';
return null;
},
},
}; };
</script> </script>
<template> <template>
...@@ -34,6 +45,7 @@ ...@@ -34,6 +45,7 @@
:stroke="lineColor" :stroke="lineColor"
fill="none" fill="none"
stroke-width="1" stroke-width="1"
:stroke-dasharray="strokeDashArray"
transform="translate(-5, 20)"> transform="translate(-5, 20)">
</path> </path>
</g> </g>
......
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
left: 40, left: 40,
}, },
legends: { legends: {
width: 10, width: 15,
height: 3, height: 3,
}, },
backgroundLegend: { backgroundLegend: {
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
height: 50, height: 50,
}, },
axisLabelLineOffset: -20, axisLabelLineOffset: -20,
legendOffset: 33, legendOffset: 32,
}, },
large: { // This covers both md and lg screen sizes large: { // This covers both md and lg screen sizes
margin: { margin: {
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
height: 150, height: 150,
}, },
axisLabelLineOffset: 20, axisLabelLineOffset: 20,
legendOffset: 36, legendOffset: 34,
}, },
xTicks: 8, xTicks: 8,
yTicks: 3, yTicks: 3,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment