Commit 56a33152 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '351903-gauge-chart-responsiveness' into 'master'

Refactored gauge chart responsiveness

See merge request gitlab-org/gitlab!81451
parents 0eff2c2c e49ce626
<script> <script>
import { GlResizeObserverDirective } from '@gitlab/ui';
import { GlGaugeChart } from '@gitlab/ui/dist/charts'; import { GlGaugeChart } from '@gitlab/ui/dist/charts';
import { isFinite, isArray, isInteger } from 'lodash'; import { isFinite, isArray, isInteger } from 'lodash';
import { getFormatter, SUPPORTED_FORMATS } from '~/lib/utils/unit_format'; import { getFormatter, SUPPORTED_FORMATS } from '~/lib/utils/unit_format';
...@@ -10,9 +9,6 @@ export default { ...@@ -10,9 +9,6 @@ export default {
components: { components: {
GlGaugeChart, GlGaugeChart,
}, },
directives: {
GlResizeObserverDirective,
},
props: { props: {
graphData: { graphData: {
type: Object, type: Object,
...@@ -96,27 +92,19 @@ export default { ...@@ -96,27 +92,19 @@ export default {
return this.queryResult || NaN; return this.queryResult || NaN;
}, },
}, },
methods: {
onResize() {
if (!this.$refs.gaugeChart) return;
const { width } = this.$refs.gaugeChart.$el.getBoundingClientRect();
this.width = width;
},
},
}; };
</script> </script>
<template> <template>
<div v-gl-resize-observer-directive="onResize"> <gl-gauge-chart
<gl-gauge-chart ref="gaugeChart"
ref="gaugeChart" v-bind="$attrs"
v-bind="$attrs" :responsive="true"
:value="value" :value="value"
:min="rangeValues.min" :min="rangeValues.min"
:max="rangeValues.max" :max="rangeValues.max"
:thresholds="thresholdsValue" :thresholds="thresholdsValue"
:text="textValue" :text="textValue"
:split-number="splitValue" :split-number="splitValue"
:width="width" :width="width"
/> />
</div>
</template> </template>
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