Commit 418d36e0 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '351906-stacked-column-chart-responsiveness' into 'master'

Refactored stack column chart responsiveness

See merge request gitlab-org/gitlab!81452
parents 859ec584 9f1722e4
<script> <script>
import { GlResizeObserverDirective } from '@gitlab/ui';
import { GlStackedColumnChart } from '@gitlab/ui/dist/charts'; import { GlStackedColumnChart } from '@gitlab/ui/dist/charts';
import { getSvgIconPathContent } from '~/lib/utils/icon_utils'; import { getSvgIconPathContent } from '~/lib/utils/icon_utils';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -12,9 +11,6 @@ export default { ...@@ -12,9 +11,6 @@ export default {
components: { components: {
GlStackedColumnChart, GlStackedColumnChart,
}, },
directives: {
GlResizeObserverDirective,
},
props: { props: {
graphData: { graphData: {
type: Object, type: Object,
...@@ -125,19 +121,14 @@ export default { ...@@ -125,19 +121,14 @@ export default {
console.error('SVG could not be rendered correctly: ', e); console.error('SVG could not be rendered correctly: ', e);
}); });
}, },
onResize() {
if (!this.$refs.chart) return;
const { width } = this.$refs.chart.$el.getBoundingClientRect();
this.width = width;
},
}, },
}; };
</script> </script>
<template> <template>
<div v-gl-resize-observer-directive="onResize">
<gl-stacked-column-chart <gl-stacked-column-chart
ref="chart" ref="chart"
v-bind="$attrs" v-bind="$attrs"
:responsive="true"
:bars="chartData" :bars="chartData"
:option="chartOptions" :option="chartOptions"
:x-axis-title="xAxisTitle" :x-axis-title="xAxisTitle"
...@@ -152,5 +143,4 @@ export default { ...@@ -152,5 +143,4 @@ export default {
:legend-max-text="legendMaxText" :legend-max-text="legendMaxText"
:legend-min-text="legendMinText" :legend-min-text="legendMinText"
/> />
</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