Commit 65d9fb08 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '351905-heatmap-chart-responsiveness' into 'master'

Refactored heatmap chart responsiveness

See merge request gitlab-org/gitlab!81453
parents 418d36e0 c2b6a241
<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,26 +57,18 @@ export default { ...@@ -61,26 +57,18 @@ 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"
:x-axis-labels="xAxisLabels" :x-axis-labels="xAxisLabels"
: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