@gitlab/ui 56.3.0 → 56.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/charts/area/area.js +17 -3
  3. package/dist/components/charts/bar/bar.js +17 -3
  4. package/dist/components/charts/chart/chart.js +3 -0
  5. package/dist/components/charts/column/column.js +17 -3
  6. package/dist/components/charts/discrete_scatter/discrete_scatter.js +17 -2
  7. package/dist/components/charts/gauge/gauge.js +1 -1
  8. package/dist/components/charts/heatmap/heatmap.js +17 -3
  9. package/dist/components/charts/line/line.js +17 -3
  10. package/dist/components/charts/sparkline/sparkline.js +11 -4
  11. package/dist/components/charts/stacked_column/stacked_column.js +17 -3
  12. package/dist/utils/charts/constants.js +5 -1
  13. package/package.json +5 -5
  14. package/src/components/charts/area/area.spec.js +9 -0
  15. package/src/components/charts/area/area.stories.js +3 -0
  16. package/src/components/charts/area/area.vue +22 -2
  17. package/src/components/charts/bar/bar.spec.js +11 -2
  18. package/src/components/charts/bar/bar.stories.js +21 -7
  19. package/src/components/charts/bar/bar.vue +22 -3
  20. package/src/components/charts/chart/chart.vue +3 -0
  21. package/src/components/charts/column/column.stories.js +3 -0
  22. package/src/components/charts/column/column.vue +26 -3
  23. package/src/components/charts/column/column_chart.spec.js +9 -0
  24. package/src/components/charts/discrete_scatter/discrete_scatter.spec.js +41 -0
  25. package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +3 -0
  26. package/src/components/charts/discrete_scatter/discrete_scatter.vue +22 -2
  27. package/src/components/charts/gauge/gauge.stories.js +5 -2
  28. package/src/components/charts/gauge/gauge.vue +1 -3
  29. package/src/components/charts/heatmap/heatmap.spec.js +25 -5
  30. package/src/components/charts/heatmap/heatmap.stories.js +3 -0
  31. package/src/components/charts/heatmap/heatmap.vue +22 -3
  32. package/src/components/charts/line/line.spec.js +9 -0
  33. package/src/components/charts/line/line.stories.js +3 -0
  34. package/src/components/charts/line/line.vue +22 -2
  35. package/src/components/charts/sparkline/sparkline.spec.js +28 -1
  36. package/src/components/charts/sparkline/sparkline.stories.js +18 -10
  37. package/src/components/charts/sparkline/sparkline.vue +14 -3
  38. package/src/components/charts/stacked_column/stacked_column.spec.js +9 -0
  39. package/src/components/charts/stacked_column/stacked_column.stories.js +3 -0
  40. package/src/components/charts/stacked_column/stacked_column.vue +22 -2
  41. package/src/utils/charts/constants.js +4 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [56.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v56.3.0...v56.4.0) (2023-03-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **charts:** fill to container height when height is "auto" ([dab39d8](https://gitlab.com/gitlab-org/gitlab-ui/commit/dab39d8116f97ef5c459e8872bfa97058dae65d4))
7
+
1
8
  # [56.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v56.2.1...v56.3.0) (2023-03-08)
2
9
 
3
10
 
@@ -1,6 +1,6 @@
1
1
  import merge from 'lodash/merge';
2
2
  import { defaultAreaOpacity, lineStyle, getThresholdConfig, generateAnnotationSeries, defaultChartOptions, dataZoomAdjustments, mergeSeriesToOptions, mergeAnnotationAxisToOptions, grid, getDefaultTooltipContent } from '../../../utils/charts/config';
3
- import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, DATA_TOOLTIP_LEFT_OFFSET, ANNOTATION_TOOLTIP_TOP_OFFSET } from '../../../utils/charts/constants';
3
+ import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, DATA_TOOLTIP_LEFT_OFFSET, ANNOTATION_TOOLTIP_TOP_OFFSET, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
4
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
5
5
  import { seriesHasAnnotations, isDataPointAnnotation } from '../../../utils/charts/utils';
6
6
  import { debounceByAnimationFrame } from '../../../utils/utils';
@@ -81,6 +81,14 @@ var script = {
81
81
  validator(layout) {
82
82
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
83
83
  }
84
+ },
85
+ /**
86
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
87
+ */
88
+ height: {
89
+ type: [Number, String],
90
+ required: false,
91
+ default: null
84
92
  }
85
93
  },
86
94
  data() {
@@ -197,6 +205,9 @@ var script = {
197
205
  }
198
206
  return acc;
199
207
  }, []);
208
+ },
209
+ autoHeight() {
210
+ return this.height === 'auto';
200
211
  }
201
212
  },
202
213
  beforeDestroy() {
@@ -282,14 +293,17 @@ var script = {
282
293
  onLabelChange(params) {
283
294
  this.selectedFormatTooltipText(params);
284
295
  }
285
- }
296
+ },
297
+ HEIGHT_AUTO_CLASSES
286
298
  };
287
299
 
288
300
  /* script */
289
301
  const __vue_script__ = script;
290
302
 
291
303
  /* template */
292
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"chart":_vm.chart,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",staticClass:"gl-pointer-events-none",attrs:{"id":"dataTooltip","show":_vm.showDataTooltip,"chart":_vm.chart,"top":_vm.dataTooltipPosition.top,"left":_vm.dataTooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):[_vm._v("\n "+_vm._s(_vm.dataTooltipTitle)+"\n "),(_vm.options.xAxis.name)?[_vm._v("("+_vm._s(_vm.options.xAxis.name)+")")]:_vm._e()]]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.dataTooltipContent}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
304
+ var __vue_render__ = function () {
305
+ var _obj;
306
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"chart":_vm.chart,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",staticClass:"gl-pointer-events-none",attrs:{"id":"dataTooltip","show":_vm.showDataTooltip,"chart":_vm.chart,"top":_vm.dataTooltipPosition.top,"left":_vm.dataTooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):[_vm._v("\n "+_vm._s(_vm.dataTooltipTitle)+"\n "),(_vm.options.xAxis.name)?[_vm._v("("+_vm._s(_vm.options.xAxis.name)+")")]:_vm._e()]]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.dataTooltipContent}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
293
307
  var __vue_staticRenderFns__ = [];
294
308
 
295
309
  /* style */
@@ -1,7 +1,7 @@
1
1
  import merge from 'lodash/merge';
2
2
  import truncate from 'lodash/truncate';
3
3
  import { dataZoomAdjustments, mergeSeriesToOptions, grid } from '../../../utils/charts/config';
4
- import { TOOLTIP_LEFT_OFFSET } from '../../../utils/charts/constants';
4
+ import { TOOLTIP_LEFT_OFFSET, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
5
5
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
6
6
  import { engineeringNotation } from '../../../utils/number_utils';
7
7
  import { debounceByAnimationFrame, hexToRgba } from '../../../utils/utils';
@@ -83,6 +83,14 @@ var script = {
83
83
  type: String,
84
84
  required: false,
85
85
  default: 'value'
86
+ },
87
+ /**
88
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
89
+ */
90
+ height: {
91
+ type: [Number, String],
92
+ required: false,
93
+ default: null
86
94
  }
87
95
  },
88
96
  data() {
@@ -151,6 +159,9 @@ var script = {
151
159
  // All chart options can be merged but series
152
160
  // needs to be handled specially
153
161
  return mergeSeriesToOptions(mergedOptions, this.series);
162
+ },
163
+ autoHeight() {
164
+ return this.height === 'auto';
154
165
  }
155
166
  },
156
167
  beforeDestroy() {
@@ -218,14 +229,17 @@ var script = {
218
229
  tooltipContent
219
230
  };
220
231
  }
221
- }
232
+ },
233
+ HEIGHT_AUTO_CLASSES
222
234
  };
223
235
 
224
236
  /* script */
225
237
  const __vue_script__ = script;
226
238
 
227
239
  /* template */
228
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.yAxisTitle)+")")])]},proxy:true}],null,false,1644826356)},[_vm._v(" "),_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})],1):_vm._e()],1)};
240
+ var __vue_render__ = function () {
241
+ var _obj;
242
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.yAxisTitle)+")")])]},proxy:true}],null,false,1644826356)},[_vm._v(" "),_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})],1):_vm._e()],1)};
229
243
  var __vue_staticRenderFns__ = [];
230
244
 
231
245
  /* style */
@@ -51,6 +51,9 @@ var script = {
51
51
  default: null,
52
52
  validator: sizeValidator
53
53
  },
54
+ /**
55
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
56
+ */
54
57
  height: {
55
58
  type: [Number, String],
56
59
  required: false,
@@ -1,6 +1,6 @@
1
1
  import merge from 'lodash/merge';
2
2
  import { yAxis, generateBarSeries, generateLineSeries, defaultChartOptions, gridWithSecondaryYAxis, grid, dataZoomAdjustments, mergeSeriesToOptions, getDefaultTooltipContent } from '../../../utils/charts/config';
3
- import { CHART_TYPE_LINE, TOOLTIP_LEFT_OFFSET } from '../../../utils/charts/constants';
3
+ import { CHART_TYPE_LINE, TOOLTIP_LEFT_OFFSET, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
4
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
5
5
  import { columnOptions } from '../../../utils/constants';
6
6
  import { debounceByAnimationFrame } from '../../../utils/utils';
@@ -62,6 +62,14 @@ var script = {
62
62
  type: String,
63
63
  required: true,
64
64
  validator: value => ['value', 'category', 'time', 'log'].indexOf(value) !== -1
65
+ },
66
+ /**
67
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
68
+ */
69
+ height: {
70
+ type: [Number, String],
71
+ required: false,
72
+ default: null
65
73
  }
66
74
  },
67
75
  data() {
@@ -175,6 +183,9 @@ var script = {
175
183
  // All chart options can be merged but series
176
184
  // needs to be handled specially
177
185
  return mergeSeriesToOptions(mergedOptions, this.series);
186
+ },
187
+ autoHeight() {
188
+ return this.height === 'auto';
178
189
  }
179
190
  },
180
191
  beforeDestroy() {
@@ -203,14 +214,17 @@ var script = {
203
214
  this.$set(this, 'tooltipContent', tooltipContent);
204
215
  this.tooltipTitle = xLabels.join(', ');
205
216
  }
206
- }
217
+ },
218
+ HEIGHT_AUTO_CLASSES
207
219
  };
208
220
 
209
221
  /* script */
210
222
  const __vue_script__ = script;
211
223
 
212
224
  /* template */
213
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")])]},proxy:true}],null,false,643259221)},[_vm._v(" "),_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})],1):_vm._e()],1)};
225
+ var __vue_render__ = function () {
226
+ var _obj;
227
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")])]},proxy:true}],null,false,643259221)},[_vm._v(" "),_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})],1):_vm._e()],1)};
214
228
  var __vue_staticRenderFns__ = [];
215
229
 
216
230
  /* style */
@@ -2,6 +2,7 @@ import merge from 'lodash/merge';
2
2
  import { defaultChartOptions, dataZoomAdjustments, mergeSeriesToOptions } from '../../../utils/charts/config';
3
3
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
4
4
  import { debounceByAnimationFrame } from '../../../utils/utils';
5
+ import { HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
5
6
  import TooltipDefaultFormat from '../../shared_components/charts/tooltip_default_format';
6
7
  import Chart from '../chart/chart';
7
8
  import ChartTooltip from '../tooltip/tooltip';
@@ -43,6 +44,14 @@ var script = {
43
44
  type: Function,
44
45
  required: false,
45
46
  default: null
47
+ },
48
+ /**
49
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
50
+ */
51
+ height: {
52
+ type: [Number, String],
53
+ required: false,
54
+ default: null
46
55
  }
47
56
  },
48
57
  data() {
@@ -106,6 +115,9 @@ var script = {
106
115
  // All chart options can be merged but series
107
116
  // needs to be handled specially
108
117
  return mergeSeriesToOptions(mergedOptions, this.series);
118
+ },
119
+ autoHeight() {
120
+ return this.height === 'auto';
109
121
  }
110
122
  },
111
123
  methods: {
@@ -146,14 +158,17 @@ var script = {
146
158
  };
147
159
  }
148
160
  }
149
- }
161
+ },
162
+ HEIGHT_AUTO_CLASSES
150
163
  };
151
164
 
152
165
  /* script */
153
166
  const __vue_script__ = script;
154
167
 
155
168
  /* template */
156
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],2):_vm._e()],1)};
169
+ var __vue_render__ = function () {
170
+ var _obj;
171
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],2):_vm._e()],1)};
157
172
  var __vue_staticRenderFns__ = [];
158
173
 
159
174
  /* style */
@@ -172,7 +172,7 @@ var script = {
172
172
  const __vue_script__ = script;
173
173
 
174
174
  /* template */
175
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners))],1)};
175
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners))};
176
176
  var __vue_staticRenderFns__ = [];
177
177
 
178
178
  /* style */
@@ -1,6 +1,6 @@
1
1
  import merge from 'lodash/merge';
2
2
  import { getDefaultTooltipContent } from '../../../utils/charts/config';
3
- import { TOOLTIP_LEFT_OFFSET } from '../../../utils/charts/constants';
3
+ import { TOOLTIP_LEFT_OFFSET, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
4
  import { heatmapHues } from '../../../utils/charts/theme';
5
5
  import { engineeringNotation } from '../../../utils/number_utils';
6
6
  import { debounceByAnimationFrame } from '../../../utils/utils';
@@ -98,6 +98,14 @@ var script = {
98
98
  type: Boolean,
99
99
  required: false,
100
100
  default: true
101
+ },
102
+ /**
103
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
104
+ */
105
+ height: {
106
+ type: [Number, String],
107
+ required: false,
108
+ default: null
101
109
  }
102
110
  },
103
111
  data() {
@@ -212,6 +220,9 @@ var script = {
212
220
  type: 'solid'
213
221
  };
214
222
  });
223
+ },
224
+ autoHeight() {
225
+ return this.height === 'auto';
215
226
  }
216
227
  },
217
228
  beforeDestroy() {
@@ -256,14 +267,17 @@ var script = {
256
267
  };
257
268
  }
258
269
  }
259
- }
270
+ },
271
+ HEIGHT_AUTO_CLASSES
260
272
  };
261
273
 
262
274
  /* script */
263
275
  const __vue_script__ = script;
264
276
 
265
277
  /* template */
266
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-heatmap"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.computedOptions},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.tooltip.show,"chart":_vm.chart,"top":_vm.tooltip.top,"left":_vm.tooltip.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n "),(_vm.computedOptions.xAxis.name)?[_vm._v("("+_vm._s(_vm.computedOptions.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltip.content}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText}}):_vm._e()],1)};
278
+ var __vue_render__ = function () {
279
+ var _obj;
280
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-heatmap",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.computedOptions},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.tooltip.show,"chart":_vm.chart,"top":_vm.tooltip.top,"left":_vm.tooltip.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n "),(_vm.computedOptions.xAxis.name)?[_vm._v("("+_vm._s(_vm.computedOptions.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltip.content}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText}}):_vm._e()],1)};
267
281
  var __vue_staticRenderFns__ = [];
268
282
 
269
283
  /* style */
@@ -1,6 +1,6 @@
1
1
  import merge from 'lodash/merge';
2
2
  import { symbolSize, lineStyle, getThresholdConfig, generateAnnotationSeries, defaultChartOptions, dataZoomAdjustments, mergeSeriesToOptions, mergeAnnotationAxisToOptions, grid, getDefaultTooltipContent } from '../../../utils/charts/config';
3
- import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, DATA_TOOLTIP_LEFT_OFFSET, ANNOTATION_TOOLTIP_TOP_OFFSET } from '../../../utils/charts/constants';
3
+ import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, DATA_TOOLTIP_LEFT_OFFSET, ANNOTATION_TOOLTIP_TOP_OFFSET, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
4
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
5
5
  import { seriesHasAnnotations, isDataPointAnnotation } from '../../../utils/charts/utils';
6
6
  import { debounceByAnimationFrame } from '../../../utils/utils';
@@ -83,6 +83,14 @@ var script = {
83
83
  type: Boolean,
84
84
  required: false,
85
85
  default: true
86
+ },
87
+ /**
88
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
89
+ */
90
+ height: {
91
+ type: [Number, String],
92
+ required: false,
93
+ default: null
86
94
  }
87
95
  },
88
96
  data() {
@@ -200,6 +208,9 @@ var script = {
200
208
  }
201
209
  return acc;
202
210
  }, []);
211
+ },
212
+ autoHeight() {
213
+ return this.height === 'auto';
203
214
  }
204
215
  },
205
216
  beforeDestroy() {
@@ -285,14 +296,17 @@ var script = {
285
296
  onLabelChange(params) {
286
297
  this.selectedFormatTooltipText(params);
287
298
  }
288
- }
299
+ },
300
+ HEIGHT_AUTO_CLASSES
289
301
  };
290
302
 
291
303
  /* script */
292
304
  const __vue_script__ = script;
293
305
 
294
306
  /* template */
295
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"chart":_vm.chart,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",staticClass:"gl-pointer-events-none",attrs:{"id":"dataTooltip","show":_vm.showDataTooltip,"chart":_vm.chart,"top":_vm.dataTooltipPosition.top,"left":_vm.dataTooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.dataTooltipTitle)+"\n "),(_vm.options.xAxis.name)?[_vm._v("("+_vm._s(_vm.options.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.dataTooltipContent}})],2):_vm._e(),_vm._v(" "),(_vm.hasLegend)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
307
+ var __vue_render__ = function () {
308
+ var _obj;
309
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.shouldShowAnnotationsTooltip)?_c('chart-tooltip',{ref:"annotationsTooltip",attrs:{"id":"annotationsTooltip","show":_vm.showAnnotationsTooltip,"chart":_vm.chart,"top":_vm.annotationsTooltipPosition.top,"left":_vm.annotationsTooltipPosition.left,"placement":"bottom"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipTitle))])]},proxy:true}],null,false,1889294429)},[_vm._v(" "),_c('div',[_vm._v(_vm._s(_vm.annotationsTooltipContent))])]):_vm._e(),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{ref:"dataTooltip",staticClass:"gl-pointer-events-none",attrs:{"id":"dataTooltip","show":_vm.showDataTooltip,"chart":_vm.chart,"top":_vm.dataTooltipPosition.top,"left":_vm.dataTooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.dataTooltipTitle)+"\n "),(_vm.options.xAxis.name)?[_vm._v("("+_vm._s(_vm.options.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.dataTooltipContent}})],2):_vm._e(),_vm._v(" "),(_vm.hasLegend)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
296
310
  var __vue_staticRenderFns__ = [];
297
311
 
298
312
  /* style */
@@ -2,6 +2,7 @@ import merge from 'lodash/merge';
2
2
  import { graphic } from 'echarts';
3
3
  import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
4
4
  import { defaultChartOptions, mergeSeriesToOptions, symbolSize } from '../../../utils/charts/config';
5
+ import { HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES } from '../../../utils/charts/constants';
5
6
  import Chart from '../chart/chart';
6
7
  import ChartTooltip from '../tooltip/tooltip';
7
8
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -44,10 +45,10 @@ var script = {
44
45
  default: ''
45
46
  },
46
47
  /**
47
- * Sets the chart's height in pixel.
48
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
48
49
  */
49
50
  height: {
50
- type: Number,
51
+ type: [Number, String],
51
52
  required: false,
52
53
  default: 50
53
54
  },
@@ -167,6 +168,9 @@ var script = {
167
168
  lastYValue() {
168
169
  const latestEntry = this.data.slice(-1)[0];
169
170
  return latestEntry[1];
171
+ },
172
+ autoHeight() {
173
+ return this.height === 'auto';
170
174
  }
171
175
  },
172
176
  methods: {
@@ -218,14 +222,17 @@ var script = {
218
222
  this.setTooltipPosition(data);
219
223
  }
220
224
  }
221
- }
225
+ },
226
+ HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES
222
227
  };
223
228
 
224
229
  /* script */
225
230
  const __vue_script__ = script;
226
231
 
227
232
  /* template */
228
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-display-flex gl-align-items-center",on:{"mouseleave":_vm.hideTooltip}},[_vm._t("default"),_vm._v(" "),_c('div',{staticClass:"gl-flex-grow-1 gl-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onChartCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chartInstance)?_c('chart-tooltip',{style:({ pointerEvents: 'none' }),attrs:{"show":_vm.tooltip.show,"chart":_vm.chartInstance,"top":_vm.tooltip.position.top,"left":_vm.tooltip.position.left,"placement":"top"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',{staticClass:"gl-white-space-nowrap",attrs:{"data-testid":"tooltip-title"}},[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n ")])]},proxy:true},{key:"default",fn:function(){return [_c('div',{staticClass:"gl-display-flex",attrs:{"data-testid":"tooltip-content"}},[(_vm.tooltipLabel)?_c('span',{staticClass:"gl-pr-6 gl-mr-auto"},[_vm._v(_vm._s(_vm.tooltipLabel))]):_vm._e(),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.tooltip.content))])])]},proxy:true}],null,false,2830367259)}):_vm._e()],1),_vm._v(" "),(_vm.showLastYValue)?_c('span',{staticClass:"gl-display-inline-flex gl-justify-content-center gl-ml-5",attrs:{"data-testid":"last-y-value"}},[_vm._v("\n "+_vm._s(_vm.lastYValue)+"\n ")]):_vm._e()],2)};
233
+ var __vue_render__ = function () {
234
+ var _obj;
235
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-display-flex gl-align-items-center",class:{ 'gl-h-full': _vm.autoHeight },on:{"mouseleave":_vm.hideTooltip}},[_vm._t("default"),_vm._v(" "),_c('div',{staticClass:"gl-flex-grow-1 gl-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES] = _vm.autoHeight, _obj ),attrs:{"data-testid":"chart-container"}},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onChartCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chartInstance)?_c('chart-tooltip',{style:({ pointerEvents: 'none' }),attrs:{"show":_vm.tooltip.show,"chart":_vm.chartInstance,"top":_vm.tooltip.position.top,"left":_vm.tooltip.position.left,"placement":"top"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',{staticClass:"gl-white-space-nowrap",attrs:{"data-testid":"tooltip-title"}},[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n ")])]},proxy:true},{key:"default",fn:function(){return [_c('div',{staticClass:"gl-display-flex",attrs:{"data-testid":"tooltip-content"}},[(_vm.tooltipLabel)?_c('span',{staticClass:"gl-pr-6 gl-mr-auto"},[_vm._v(_vm._s(_vm.tooltipLabel))]):_vm._e(),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.tooltip.content))])])]},proxy:true}],null,false,2830367259)}):_vm._e()],1),_vm._v(" "),(_vm.showLastYValue)?_c('span',{staticClass:"gl-display-inline-flex gl-justify-content-center gl-ml-5",attrs:{"data-testid":"last-y-value"}},[_vm._v("\n "+_vm._s(_vm.lastYValue)+"\n ")]):_vm._e()],2)};
229
236
  var __vue_staticRenderFns__ = [];
230
237
 
231
238
  /* style */
@@ -1,6 +1,6 @@
1
1
  import merge from 'lodash/merge';
2
2
  import { yAxis, generateBarSeries, generateLineSeries, defaultChartOptions, gridWithSecondaryYAxis, grid, dataZoomAdjustments, mergeSeriesToOptions } from '../../../utils/charts/config';
3
- import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, CHART_TYPE_LINE, ANNOTATION_TOOLTIP_TOP_OFFSET } from '../../../utils/charts/constants';
3
+ import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, CHART_TYPE_LINE, ANNOTATION_TOOLTIP_TOP_OFFSET, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
4
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
5
5
  import { columnOptions } from '../../../utils/constants';
6
6
  import { debounceByAnimationFrame } from '../../../utils/utils';
@@ -116,6 +116,14 @@ var script = {
116
116
  type: Array,
117
117
  required: false,
118
118
  default: null
119
+ },
120
+ /**
121
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
122
+ */
123
+ height: {
124
+ type: [Number, String],
125
+ required: false,
126
+ default: null
119
127
  }
120
128
  },
121
129
  data() {
@@ -251,6 +259,9 @@ var script = {
251
259
  });
252
260
  return acc;
253
261
  }, []);
262
+ },
263
+ autoHeight() {
264
+ return this.height === 'auto';
254
265
  }
255
266
  },
256
267
  beforeDestroy() {
@@ -298,14 +309,17 @@ var script = {
298
309
  this.defaultFormatTooltipText(params);
299
310
  }
300
311
  }
301
- }
312
+ },
313
+ HEIGHT_AUTO_CLASSES
302
314
  };
303
315
 
304
316
  /* script */
305
317
  const __vue_script__ = script;
306
318
 
307
319
  /* template */
308
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
320
+ var __vue_render__ = function () {
321
+ var _obj;
322
+ var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-flex-grow-1': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._t("tooltip-title",function(){return [_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")]})]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("tooltip-content",function(){return [_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})]})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"min-text":_vm.legendMinText,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText,"current-text":_vm.legendCurrentText,"layout":_vm.legendLayout}}):_vm._e()],1)};
309
323
  var __vue_staticRenderFns__ = [];
310
324
 
311
325
  /* style */
@@ -64,4 +64,8 @@ const arrowSymbol = 'path://m5 229 5 8h-10z';
64
64
  const CHART_TYPE_BAR = 'bar';
65
65
  const CHART_TYPE_LINE = 'line';
66
66
 
67
- export { ANNOTATIONS_COMPONENT_TYPE, ANNOTATIONS_SERIES_NAME, ANNOTATION_TOOLTIP_TOP_OFFSET, CHART_TYPE_BAR, CHART_TYPE_LINE, DATA_TOOLTIP_LEFT_OFFSET, LEGEND_AVERAGE_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, TOOLTIP_LEFT_OFFSET, arrowSymbol };
67
+ // Constants for height "auto"
68
+ const HEIGHT_AUTO_CLASSES = 'gl-display-flex gl-flex-direction-column gl-h-full';
69
+ const HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES = 'gl-display-flex gl-h-full';
70
+
71
+ export { ANNOTATIONS_COMPONENT_TYPE, ANNOTATIONS_SERIES_NAME, ANNOTATION_TOOLTIP_TOP_OFFSET, CHART_TYPE_BAR, CHART_TYPE_LINE, DATA_TOOLTIP_LEFT_OFFSET, HEIGHT_AUTO_CLASSES, HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES, LEGEND_AVERAGE_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, TOOLTIP_LEFT_OFFSET, arrowSymbol };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "56.3.0",
3
+ "version": "56.4.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -88,7 +88,7 @@
88
88
  "@gitlab/eslint-plugin": "18.2.0",
89
89
  "@gitlab/fonts": "^1.2.0",
90
90
  "@gitlab/stylelint-config": "4.1.0",
91
- "@gitlab/svgs": "3.22.0",
91
+ "@gitlab/svgs": "3.24.0",
92
92
  "@rollup/plugin-commonjs": "^11.1.0",
93
93
  "@rollup/plugin-node-resolve": "^7.1.3",
94
94
  "@rollup/plugin-replace": "^2.3.2",
@@ -125,9 +125,9 @@
125
125
  "glob": "^7.2.0",
126
126
  "identity-obj-proxy": "^3.0.0",
127
127
  "inquirer-select-directory": "^1.2.0",
128
- "jest": "^29.4.3",
129
- "jest-circus": "29.4.3",
130
- "jest-environment-jsdom": "29.4.3",
128
+ "jest": "^29.5.0",
129
+ "jest-circus": "29.5.0",
130
+ "jest-environment-jsdom": "29.5.0",
131
131
  "markdownlint-cli": "^0.29.0",
132
132
  "mockdate": "^2.0.5",
133
133
  "npm-run-all": "^4.1.5",
@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils';
2
2
 
3
3
  import { LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE } from '~/utils/charts/constants';
4
4
  import { createMockChartInstance, ChartTooltipStub } from '~helpers/chart_stubs';
5
+ import { expectHeightAutoClasses } from '~helpers/chart_height';
5
6
  import Chart from '../chart/chart.vue';
6
7
  import ChartLegend from '../legend/legend.vue';
7
8
  import AreaChart from './area.vue';
@@ -183,4 +184,12 @@ describe('area component', () => {
183
184
  expect(findLegend().props('layout')).toBe(LEGEND_LAYOUT_TABLE);
184
185
  });
185
186
  });
187
+
188
+ describe('height', () => {
189
+ expectHeightAutoClasses({
190
+ createComponent: createShallowWrapper,
191
+ findContainer: () => wrapper,
192
+ findChart,
193
+ });
194
+ });
186
195
  });
@@ -34,6 +34,7 @@ const template = `<gl-area-chart
34
34
  :thresholds="thresholds"
35
35
  :annotations="annotations"
36
36
  :includeLegendAvgMax="includeLegendAvgMax"
37
+ :height="height"
37
38
  />`;
38
39
 
39
40
  const generateProps = ({
@@ -42,12 +43,14 @@ const generateProps = ({
42
43
  thresholds = [],
43
44
  annotations = [],
44
45
  includeLegendAvgMax = true,
46
+ height = null,
45
47
  } = {}) => ({
46
48
  data,
47
49
  option,
48
50
  thresholds,
49
51
  annotations,
50
52
  includeLegendAvgMax,
53
+ height,
51
54
  });
52
55
 
53
56
  const Template = (args, { argTypes }) => ({
@@ -38,6 +38,7 @@ import {
38
38
  LEGEND_CURRENT_TEXT,
39
39
  LEGEND_MIN_TEXT,
40
40
  LEGEND_MAX_TEXT,
41
+ HEIGHT_AUTO_CLASSES,
41
42
  } from '../../../utils/charts/constants';
42
43
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
43
44
  import { seriesHasAnnotations, isDataPointAnnotation } from '../../../utils/charts/utils';
@@ -118,6 +119,14 @@ export default {
118
119
  return [LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE].indexOf(layout) !== -1;
119
120
  },
120
121
  },
122
+ /**
123
+ * Sets the chart's height in pixels. Set to `"auto"` to use the height of the container.
124
+ */
125
+ height: {
126
+ type: [Number, String],
127
+ required: false,
128
+ default: null,
129
+ },
121
130
  },
122
131
  data() {
123
132
  // Part of the tooltip related data can be
@@ -247,6 +256,9 @@ export default {
247
256
  return acc;
248
257
  }, []);
249
258
  },
259
+ autoHeight() {
260
+ return this.height === 'auto';
261
+ },
250
262
  },
251
263
  beforeDestroy() {
252
264
  this.chart.getDom().removeEventListener('mousemove', this.debouncedShowHideTooltip);
@@ -328,12 +340,20 @@ export default {
328
340
  this.selectedFormatTooltipText(params);
329
341
  },
330
342
  },
343
+ HEIGHT_AUTO_CLASSES,
331
344
  };
332
345
  </script>
333
346
 
334
347
  <template>
335
- <div class="position-relative">
336
- <chart v-bind="$attrs" :options="options" v-on="$listeners" @created="onCreated" />
348
+ <div class="position-relative" :class="{ [$options.HEIGHT_AUTO_CLASSES]: autoHeight }">
349
+ <chart
350
+ v-bind="$attrs"
351
+ :class="{ 'gl-flex-grow-1': autoHeight }"
352
+ :height="height"
353
+ :options="options"
354
+ v-on="$listeners"
355
+ @created="onCreated"
356
+ />
337
357
  <chart-tooltip
338
358
  v-if="shouldShowAnnotationsTooltip"
339
359
  id="annotationsTooltip"