Commit c2b6a241 authored by Anshul Riyal's avatar Anshul Riyal

Refactored heatmap chart responsiveness

parent 6172b14a
<script> <script>
import { GlResizeObserverDirective } from '@gitlab/ui';
import { GlHeatmap } from '@gitlab/ui/dist/charts'; import { GlHeatmap } from '@gitlab/ui/dist/charts';
import { formatDate, timezones, formats } from '../../format_date'; import { formatDate, timezones, formats } from '../../format_date';
import { graphDataValidatorForValues } from '../../utils'; import { graphDataValidatorForValues } from '../../utils';
...@@ -8,9 +7,6 @@ export default { ...@@ -8,9 +7,6 @@ export default {
components: { components: {
GlHeatmap, GlHeatmap,
}, },
directives: {
GlResizeObserverDirective,
},
props: { props: {
graphData: { graphData: {
type: Object, type: Object,
...@@ -61,20 +57,13 @@ export default { ...@@ -61,20 +57,13 @@ export default {
return this.graphData.metrics[0]; return this.graphData.metrics[0];
}, },
}, },
methods: {
onResize() {
if (this.$refs.heatmapChart) return;
const { width } = this.$refs.heatmapChart.$el.getBoundingClientRect();
this.width = width;
},
},
}; };
</script> </script>
<template> <template>
<div v-gl-resize-observer-directive="onResize">
<gl-heatmap <gl-heatmap
ref="heatmapChart" ref="heatmapChart"
v-bind="$attrs" v-bind="$attrs"
:responsive="true"
:data-series="chartData" :data-series="chartData"
:x-axis-name="xAxisName" :x-axis-name="xAxisName"
:y-axis-name="yAxisName" :y-axis-name="yAxisName"
...@@ -82,5 +71,4 @@ export default { ...@@ -82,5 +71,4 @@ export default {
:y-axis-labels="yAxisLabels" :y-axis-labels="yAxisLabels"
: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