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