origam 2.37.37 → 2.37.38

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 (27) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +6 -7
  3. package/dist/src/components/Chart/OrigamChartBullet.vue +7 -8
  4. package/dist/src/components/Chart/OrigamChartCandlestick.vue +10 -11
  5. package/dist/src/components/Chart/OrigamChartGauge.vue +8 -6
  6. package/dist/src/components/Chart/OrigamChartHeatmap.vue +9 -5
  7. package/dist/src/components/Chart/OrigamChartMap.vue +14 -15
  8. package/dist/src/components/Chart/OrigamChartPareto.vue +9 -10
  9. package/dist/src/components/Chart/OrigamChartPictorial.vue +10 -11
  10. package/dist/src/components/Chart/OrigamChartPolar.vue +6 -7
  11. package/dist/src/components/Chart/OrigamChartPolarBar.vue +8 -8
  12. package/dist/src/components/Chart/OrigamChartPyramid.vue +6 -7
  13. package/dist/src/components/Chart/OrigamChartRadar.vue +7 -9
  14. package/dist/src/components/Chart/OrigamChartSankey.vue +6 -7
  15. package/dist/src/components/Chart/OrigamChartSparkline.vue +15 -17
  16. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +9 -10
  17. package/dist/src/components/Chart/OrigamChartSunburst.vue +8 -8
  18. package/dist/src/components/Chart/OrigamChartTreemap.vue +6 -7
  19. package/dist/src/components/Chart/OrigamChartVariwide.vue +8 -9
  20. package/dist/src/components/Chart/OrigamChartWordCloud.vue +16 -13
  21. package/dist/src/composables/Chart/chart-size.composable.cjs +8 -3
  22. package/dist/src/composables/Chart/chart-size.composable.d.ts +9 -0
  23. package/dist/src/composables/Chart/chart-size.composable.js +8 -3
  24. package/dist/src/consts/Chart/chart.const.cjs +81 -2
  25. package/dist/src/consts/Chart/chart.const.d.ts +100 -0
  26. package/dist/src/consts/Chart/chart.const.js +25 -0
  27. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -18,6 +18,22 @@ This project follows [Semantic Versioning](https://semver.org).
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [2.37.38] - 2026-11-05
22
+
23
+ ### Fixed — Charts : la surface de dessin suit la taille du conteneur sur 19 charts (#1324)
24
+
25
+ Suite de #1317 : `useChartSize` est désormais branché sur 19 charts. Son option `aspectRatio` (hauteur / largeur) remplace le mode carré.
26
+
27
+ - **Rectangulaires**, sur la boîte mesurée : BoxPlot, Bullet, Candlestick, Heatmap, Pareto, Pictorial, Pyramid, Sankey, Streamgraph, Treemap, Variwide, WordCloud.
28
+ - **1:1** : Polar, Radar, PolarBar, Sunburst.
29
+ - **Gauge**, ratio du demi-anneau : 280/360.
30
+ - **Map** en 2:1. La projection Mercator est recalculée dans la boîte mesurée, donc la géographie n'est jamais déformée.
31
+ - **Sparkline** : le `viewBox` mesuré remplace `preserveAspectRatio="none"`. Les marqueurs restent ronds et les traits gardent leur épaisseur réelle en px.
32
+ - **Honeycomb** n'est pas branché, par conception : `tileSize` pilote sa taille intrinsèque.
33
+ - **⚠ Changement de rendu** : Gauge, Map et les charts radiaux n'ont plus de `height` par défaut, qui devient un plafond optionnel. Sans `height`, un radial forme un carré de la largeur du conteneur. WordCloud adapte `minFontSize` et `maxFontSize` à la boîte mesurée ; sans cela, 2 mots sur 20 disparaissaient.
34
+ - **Constantes** : `CHART_ASPECT_RATIO` et `CHART_SIZE_FALLBACK`, dans `consts/Chart/chart.const.ts`.
35
+ - **Vérifié** : la spec `chart-responsive-size.spec.ts` (39 tests, inscrite dans `GREEN_SPECS`) est rouge 39/39 sur le parent et verte avec le correctif. Mesures sur le parent : Gauge, svg 456×242 pour un viewBox de 360×280 ; Sparkline, marqueur de 20×5 puis 27,5×5 px. `e2e/chart*` : 376 passés, aucun échec (PR #1336).
36
+
21
37
  ## [2.37.37] - 2026-11-04
22
38
 
23
39
  ### Fixed — `OrigamChartCartesian` : la surface de dessin suit la largeur réelle du conteneur (#1317)
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-box-plot__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -250,7 +250,7 @@
250
250
  </template>
251
251
 
252
252
  <script lang="ts" setup>
253
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
253
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
254
254
  import {
255
255
  computed,
256
256
  ref
@@ -258,6 +258,7 @@ import {
258
258
  import OrigamChartLegend from "./OrigamChartLegend.vue";
259
259
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
260
260
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
261
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
261
262
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
262
263
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
263
264
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -348,21 +349,20 @@ const { paddingClasses, paddingStyles } = usePadding(props);
348
349
  const { roundedClasses, roundedStyles } = useRounded(props);
349
350
  const { headerTypographyStyles } = useChartHeaderTypography(props);
350
351
  const chartAnimationStyle = useChartAnimationStyle(props);
351
- const SVG_WIDTH = 600;
352
- const SVG_HEIGHT = 400;
352
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.boxPlot);
353
353
  const PADDING = { top: 20, right: 20, bottom: 40, left: 52 };
354
354
  const PLOT = {
355
355
  get left() {
356
356
  return PADDING.left;
357
357
  },
358
358
  get right() {
359
- return SVG_WIDTH - PADDING.right;
359
+ return svgWidth.value - PADDING.right;
360
360
  },
361
361
  get top() {
362
362
  return PADDING.top;
363
363
  },
364
364
  get bottom() {
365
- return SVG_HEIGHT - PADDING.bottom;
365
+ return svgHeight.value - PADDING.bottom;
366
366
  }
367
367
  };
368
368
  const DEFAULT_PALETTE = [
@@ -533,7 +533,6 @@ const xLabelFor = (category) => {
533
533
  if (props.xAxisFormat) return props.xAxisFormat(category);
534
534
  return category;
535
535
  };
536
- const svgRef = ref(null);
537
536
  const mousePos = ref({ x: 0, y: 0 });
538
537
  const hoveredIndex = ref(null);
539
538
  const hoveredBox = computed(() => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-bullet__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -115,7 +115,7 @@
115
115
  v-else
116
116
  class="origam-chart__bullet-label"
117
117
  :x="bullet.slotX + bullet.slotW / 2"
118
- :y="SVG_HEIGHT - PADDING.bottom + LABEL_GAP"
118
+ :y="svgHeight - PADDING.bottom + LABEL_GAP"
119
119
  text-anchor="middle"
120
120
  dominant-baseline="hanging"
121
121
  :data-cy="`origam-chart-bullet-label-${ bullet.index }`"
@@ -214,7 +214,7 @@
214
214
  </template>
215
215
 
216
216
  <script lang="ts" setup>
217
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
217
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
218
218
  import {
219
219
  computed,
220
220
  ref
@@ -222,6 +222,7 @@ import {
222
222
  import OrigamChartLegend from "./OrigamChartLegend.vue";
223
223
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
224
224
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
225
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
225
226
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
226
227
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
227
228
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
@@ -312,8 +313,7 @@ const { paddingClasses, paddingStyles } = usePadding(props);
312
313
  const { roundedClasses, roundedStyles } = useRounded(props);
313
314
  const { headerTypographyStyles } = useChartHeaderTypography(props);
314
315
  const chartAnimationStyle = useChartAnimationStyle(props);
315
- const SVG_WIDTH = 600;
316
- const SVG_HEIGHT = 400;
316
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.bullet);
317
317
  const AXIS_TICK_COUNT = 5;
318
318
  const TARGET_TICK_FRACTION = 0.7;
319
319
  const LABEL_GAP = 6;
@@ -321,8 +321,8 @@ const isHorizontal = computed(() => props.orientation !== DIRECTION.VERTICAL);
321
321
  const PADDING = computed(
322
322
  () => isHorizontal.value ? { top: 12, right: 24, bottom: 32, left: 120 } : { top: 24, right: 24, bottom: 48, left: 40 }
323
323
  );
324
- const plotW = computed(() => SVG_WIDTH - PADDING.value.left - PADDING.value.right);
325
- const plotH = computed(() => SVG_HEIGHT - PADDING.value.top - PADDING.value.bottom);
324
+ const plotW = computed(() => svgWidth.value - PADDING.value.left - PADDING.value.right);
325
+ const plotH = computed(() => svgHeight.value - PADDING.value.top - PADDING.value.bottom);
326
326
  const resolveColor = (raw) => {
327
327
  if (!raw) return "currentColor";
328
328
  if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
@@ -499,7 +499,6 @@ const legendItems = computed(
499
499
  visible: b.visible
500
500
  }))
501
501
  );
502
- const svgRef = ref(null);
503
502
  const mousePos = ref({ x: 0, y: 0 });
504
503
  const hoveredIndex = ref(null);
505
504
  const hoveredBullet = computed(() => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-candlestick__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -59,7 +59,7 @@
59
59
  class="origam-chart-candlestick__grid-line"
60
60
  :x1="PADDING.left"
61
61
  :y1="tick.position"
62
- :x2="SVG_WIDTH - PADDING.right"
62
+ :x2="svgWidth - PADDING.right"
63
63
  :y2="tick.position"
64
64
  data-cy="origam-chart-candlestick-grid-line"
65
65
  />
@@ -85,7 +85,7 @@
85
85
  :key="`x-label-${ i }`"
86
86
  class="origam-chart-candlestick__axis-label origam-chart-candlestick__axis-label--x"
87
87
  :x="candle.cx"
88
- :y="SVG_HEIGHT - PADDING.bottom + 14"
88
+ :y="svgHeight - PADDING.bottom + 14"
89
89
  text-anchor="middle"
90
90
  dominant-baseline="auto"
91
91
  >{{ formatXLabel(candle.datum.date, i) }}</text>
@@ -189,7 +189,7 @@
189
189
  </template>
190
190
 
191
191
  <script lang="ts" setup>
192
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
192
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
193
193
  import {
194
194
  computed,
195
195
  ref
@@ -197,6 +197,7 @@ import {
197
197
  import OrigamChartLegend from "./OrigamChartLegend.vue";
198
198
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
199
199
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
200
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
200
201
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
201
202
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
202
203
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
@@ -287,8 +288,7 @@ const { paddingClasses, paddingStyles } = usePadding(props);
287
288
  const { roundedClasses, roundedStyles } = useRounded(props);
288
289
  const { headerTypographyStyles } = useChartHeaderTypography(props);
289
290
  const chartAnimationStyle = useChartAnimationStyle(props);
290
- const SVG_WIDTH = 600;
291
- const SVG_HEIGHT = 400;
291
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.candlestick);
292
292
  const PADDING = { top: 20, right: 20, bottom: 36, left: 56 };
293
293
  const Y_TICK_COUNT = 5;
294
294
  const Y_PAD_FRACTION = 0.05;
@@ -335,12 +335,12 @@ const yDomain = computed(() => {
335
335
  };
336
336
  });
337
337
  const plotTop = PADDING.top;
338
- const plotBottom = SVG_HEIGHT - PADDING.bottom;
339
- const plotHeight = plotBottom - plotTop;
338
+ const plotBottom = computed(() => svgHeight.value - PADDING.bottom);
339
+ const plotHeight = computed(() => plotBottom.value - plotTop);
340
340
  const yToSvg = (value) => {
341
341
  const { min, max } = yDomain.value;
342
342
  const range = max - min || 1;
343
- return plotBottom - (value - min) / range * plotHeight;
343
+ return plotBottom.value - (value - min) / range * plotHeight.value;
344
344
  };
345
345
  const yTicks = computed(() => {
346
346
  const { min, max } = yDomain.value;
@@ -360,7 +360,7 @@ const candles = computed(() => {
360
360
  const count = data.length;
361
361
  if (!count) return [];
362
362
  const plotLeft = PADDING.left;
363
- const plotRight = SVG_WIDTH - PADDING.right;
363
+ const plotRight = svgWidth.value - PADDING.right;
364
364
  const plotWidth = plotRight - plotLeft;
365
365
  const slotW = plotWidth / count;
366
366
  const candleHalfW = slotW * props.candleWidth / 2;
@@ -410,7 +410,6 @@ const legendItems = computed(() => {
410
410
  visible: s.visible !== false
411
411
  }));
412
412
  });
413
- const svgRef = ref(null);
414
413
  const mousePos = ref({ x: 0, y: 0 });
415
414
  const hoveredIndex = ref(null);
416
415
  const hoveredCandle = computed(() => {
@@ -33,9 +33,10 @@
33
33
  data-cy="origam-chart-gauge-body"
34
34
  >
35
35
  <svg
36
+ ref="svgRef"
36
37
  class="origam-chart-gauge__svg origam-chart__svg"
37
38
  :class="svgClasses"
38
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
39
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
39
40
  role="img"
40
41
  :aria-label="svgAriaLabel"
41
42
  :aria-valuemin="gaugeMin"
@@ -136,6 +137,8 @@ import {
136
137
  import { useChartGauge } from "../../composables/Chart/chart-gauge.composable";
137
138
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
138
139
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
140
+ import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK } from "../../consts/Chart/chart.const";
141
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
139
142
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
140
143
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
141
144
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -170,7 +173,7 @@ const props = defineProps({
170
173
  id: { type: String, required: false },
171
174
  class: { type: [String, Array, Object], required: false },
172
175
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
173
- height: { type: [Number, String], required: false, default: 300 },
176
+ height: { type: [Number, String], required: false },
174
177
  maxHeight: { type: [Number, String], required: false },
175
178
  maxWidth: { type: [Number, String], required: false },
176
179
  minHeight: { type: [Number, String], required: false },
@@ -247,8 +250,7 @@ useUnsupportedProp(
247
250
  "a gauge renders no per-point tooltip \u2014 the centre label already shows the current value.",
248
251
  () => props.showTooltip === true
249
252
  );
250
- const SVG_WIDTH = 360;
251
- const SVG_HEIGHT = 280;
253
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.gauge, { aspectRatio: CHART_ASPECT_RATIO.gauge });
252
254
  const PADDING_GAUGE = { top: 28, right: 28, bottom: 28, left: 28 };
253
255
  const hasData = computed(() => {
254
256
  const first = props.series?.[0];
@@ -281,8 +283,8 @@ const { geometry } = useChartGauge({
281
283
  value: () => value.value,
282
284
  min: () => props.gaugeMin,
283
285
  max: () => props.gaugeMax,
284
- width: () => SVG_WIDTH,
285
- height: () => SVG_HEIGHT,
286
+ width: () => svgWidth.value,
287
+ height: () => svgHeight.value,
286
288
  padding: () => PADDING_GAUGE,
287
289
  thickness: () => props.gaugeThickness,
288
290
  startAngle: () => props.gaugeStartAngle,
@@ -226,6 +226,7 @@ import {
226
226
  } from "vue";
227
227
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
228
228
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
229
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
229
230
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
230
231
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
231
232
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
@@ -394,12 +395,16 @@ const isLegendInline = computed(() => props.legendPosition === "bottom" || props
394
395
  const legendExtraH = computed(
395
396
  () => props.showGradientLegend && isLegendInline.value ? LEGEND_H + LEGEND_MARGIN : 0
396
397
  );
397
- const svgWidth = computed(() => AXIS_LEFT + SVG_PLOT_W);
398
- const svgHeight = computed(() => SVG_PLOT_H + AXIS_BOTTOM + legendExtraH.value);
398
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize({
399
+ width: AXIS_LEFT + SVG_PLOT_W,
400
+ get height() {
401
+ return SVG_PLOT_H + AXIS_BOTTOM + legendExtraH.value;
402
+ }
403
+ });
399
404
  const plotX0 = AXIS_LEFT;
400
405
  const plotY0 = 4;
401
- const plotW = computed(() => SVG_PLOT_W);
402
- const plotH = computed(() => SVG_PLOT_H);
406
+ const plotW = computed(() => Math.max(0, svgWidth.value - AXIS_LEFT));
407
+ const plotH = computed(() => Math.max(0, svgHeight.value - AXIS_BOTTOM - legendExtraH.value));
403
408
  const nx = computed(() => xCats.value.length);
404
409
  const ny = computed(() => yCats.value.length);
405
410
  const cellW = computed(() => {
@@ -471,7 +476,6 @@ const gradientRect = computed(() => {
471
476
  h: LEGEND_H
472
477
  };
473
478
  });
474
- const svgRef = ref(null);
475
479
  const mousePos = ref({ x: 0, y: 0 });
476
480
  const hoveredIndex = ref(null);
477
481
  const hoveredCell = computed(() => {
@@ -36,7 +36,7 @@
36
36
  ref="svgRef"
37
37
  class="origam-chart-map__svg origam-chart__svg"
38
38
  :class="svgClasses"
39
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
39
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
40
40
  :role="CHART_SVG_ROLE"
41
41
  :aria-label="svgAriaLabel"
42
42
  preserveAspectRatio="xMidYMid meet"
@@ -198,13 +198,14 @@
198
198
  </template>
199
199
 
200
200
  <script lang="ts" setup>
201
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
201
+ import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
202
202
  import {
203
203
  computed,
204
204
  ref
205
205
  } from "vue";
206
206
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
207
207
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
208
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
208
209
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
209
210
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
210
211
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
@@ -309,24 +310,23 @@ useUnsupportedProp(
309
310
  () => props.legendPosition !== void 0 && props.legendPosition !== "bottom"
310
311
  );
311
312
  const chartAnimationStyle = useChartAnimationStyle(props);
312
- const SVG_WIDTH = 1e3;
313
- const SVG_HEIGHT = 500;
313
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.map, { aspectRatio: CHART_ASPECT_RATIO.map });
314
314
  const LEGEND_H = 14;
315
315
  const LEGEND_Y_OFFSET = 12;
316
316
  const LEGEND_X = 20;
317
317
  const LEGEND_W = 200;
318
- const WORLD_MAP_PATHS = Object.fromEntries(
318
+ const WORLD_MAP_PATHS = computed(() => Object.fromEntries(
319
319
  Object.entries(WORLD_GEOGRAPHIC_DATA).map(([code, multi]) => [
320
320
  code,
321
- multiPolygonToSvgPath(multi, SVG_WIDTH, SVG_HEIGHT)
321
+ multiPolygonToSvgPath(multi, svgWidth.value, svgHeight.value)
322
322
  ])
323
- );
324
- const COUNTRY_CENTROIDS = Object.fromEntries(
323
+ ));
324
+ const COUNTRY_CENTROIDS = computed(() => Object.fromEntries(
325
325
  Object.entries(WORLD_GEOGRAPHIC_DATA).map(([code, multi]) => [
326
326
  code,
327
- multiPolygonCentroid(multi, SVG_WIDTH, SVG_HEIGHT)
327
+ multiPolygonCentroid(multi, svgWidth.value, svgHeight.value)
328
328
  ])
329
- );
329
+ ));
330
330
  const isChoroplethMode = computed(() => props.mode === CHART_MAP_MODE.CHOROPLETH);
331
331
  const isRoutesMode = computed(() => props.mode === CHART_MAP_MODE.FLIGHT_ROUTES);
332
332
  const resolveColor = (raw) => {
@@ -377,7 +377,7 @@ const formatValue = (v) => {
377
377
  };
378
378
  const allCountries = computed(() => {
379
379
  const { min, max } = valueRange.value;
380
- return Object.entries(WORLD_MAP_PATHS).map(([code, d]) => {
380
+ return Object.entries(WORLD_MAP_PATHS.value).map(([code, d]) => {
381
381
  const datum = choroplethMap.value.get(code);
382
382
  const hasData = isChoroplethMode.value && datum !== void 0;
383
383
  let fill;
@@ -404,8 +404,8 @@ const routeData = computed(() => {
404
404
  });
405
405
  const computedRoutes = computed(() => {
406
406
  return routeData.value.flatMap((datum, index) => {
407
- const fromC = COUNTRY_CENTROIDS[datum.from?.toUpperCase()];
408
- const toC = COUNTRY_CENTROIDS[datum.to?.toUpperCase()];
407
+ const fromC = COUNTRY_CENTROIDS.value[datum.from?.toUpperCase()];
408
+ const toC = COUNTRY_CENTROIDS.value[datum.to?.toUpperCase()];
409
409
  if (!fromC || !toC) return [];
410
410
  const [x1, y1] = fromC;
411
411
  const [x2, y2] = toC;
@@ -451,7 +451,7 @@ const routeNodes = computed(() => {
451
451
  return nodes;
452
452
  });
453
453
  const gradientRect = computed(() => {
454
- const y = SVG_HEIGHT - LEGEND_H - LEGEND_Y_OFFSET - 20;
454
+ const y = svgHeight.value - LEGEND_H - LEGEND_Y_OFFSET - 20;
455
455
  const x2 = LEGEND_X + LEGEND_W;
456
456
  return {
457
457
  x: LEGEND_X,
@@ -462,7 +462,6 @@ const gradientRect = computed(() => {
462
462
  labelY: y + LEGEND_H + 5
463
463
  };
464
464
  });
465
- const svgRef = ref(null);
466
465
  const mousePos = ref({ x: 0, y: 0 });
467
466
  const hoveredCode = ref(null);
468
467
  const hoveredRouteIndex = ref(null);
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-pareto__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -293,7 +293,7 @@
293
293
  </template>
294
294
 
295
295
  <script lang="ts" setup>
296
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
296
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
297
297
  import {
298
298
  computed,
299
299
  ref
@@ -301,6 +301,7 @@ import {
301
301
  import OrigamChartLegend from "./OrigamChartLegend.vue";
302
302
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
303
303
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
304
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
304
305
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
305
306
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
306
307
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -392,8 +393,7 @@ const { paddingClasses, paddingStyles } = usePadding(props);
392
393
  const { roundedClasses, roundedStyles } = useRounded(props);
393
394
  const { headerTypographyStyles } = useChartHeaderTypography(props);
394
395
  const chartAnimationStyle = useChartAnimationStyle(props);
395
- const SVG_WIDTH = 640;
396
- const SVG_HEIGHT = 400;
396
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.pareto);
397
397
  const TICK_SIZE = 4;
398
398
  const PLOT = {
399
399
  top: 24,
@@ -401,8 +401,8 @@ const PLOT = {
401
401
  bottom: 48,
402
402
  left: 52
403
403
  };
404
- const plotWidth = SVG_WIDTH - PLOT.left - PLOT.right;
405
- const plotHeight = SVG_HEIGHT - PLOT.top - PLOT.bottom;
404
+ const plotWidth = computed(() => svgWidth.value - PLOT.left - PLOT.right);
405
+ const plotHeight = computed(() => svgHeight.value - PLOT.top - PLOT.bottom);
406
406
  const resolveColor = (raw) => {
407
407
  if (!raw) return "currentColor";
408
408
  if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
@@ -455,10 +455,10 @@ const yMax = computed(() => {
455
455
  });
456
456
  const scaleY = (value) => {
457
457
  const fraction = value / yMax.value;
458
- return PLOT.top + plotHeight * (1 - fraction);
458
+ return PLOT.top + plotHeight.value * (1 - fraction);
459
459
  };
460
460
  const scaleYCumulative = (fraction) => {
461
- return PLOT.top + plotHeight * (1 - fraction);
461
+ return PLOT.top + plotHeight.value * (1 - fraction);
462
462
  };
463
463
  const Y_TICK_COUNT = 5;
464
464
  const yTicks = computed(() => {
@@ -482,7 +482,7 @@ const bars = computed(() => {
482
482
  const items = sortedData.value;
483
483
  if (!items.length) return [];
484
484
  const count = items.length;
485
- const totalBarSpace = plotWidth - props.barGap * Math.max(0, count - 1);
485
+ const totalBarSpace = plotWidth.value - props.barGap * Math.max(0, count - 1);
486
486
  const barWidth = Math.max(1, totalBarSpace / count);
487
487
  const baseline = scaleY(0);
488
488
  let cumulativeSum = 0;
@@ -558,7 +558,6 @@ const showEmpty = computed(() => {
558
558
  if (!first?.data?.length) return true;
559
559
  return bars.value.length === 0;
560
560
  });
561
- const svgRef = ref(null);
562
561
  const mousePos = ref({ x: 0, y: 0 });
563
562
  const hoveredIndex = ref(null);
564
563
  const hoveredBar = computed(() => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-pictorial__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -289,7 +289,7 @@
289
289
  </template>
290
290
 
291
291
  <script lang="ts" setup>
292
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
292
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
293
293
  import {
294
294
  computed,
295
295
  ref
@@ -298,6 +298,7 @@ import OrigamChartLegend from "./OrigamChartLegend.vue";
298
298
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
299
299
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
300
300
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
301
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
301
302
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
302
303
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
303
304
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -390,8 +391,7 @@ const { paddingClasses, paddingStyles } = usePadding(props);
390
391
  const { roundedClasses, roundedStyles } = useRounded(props);
391
392
  const { headerTypographyStyles } = useChartHeaderTypography(props);
392
393
  const chartAnimationStyle = useChartAnimationStyle(props);
393
- const SVG_WIDTH = 600;
394
- const SVG_HEIGHT = 400;
394
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.pictorial);
395
395
  const ICON_GAP = 2;
396
396
  const AXIS_LABEL_HEIGHT = 20;
397
397
  const VALUE_LABEL_HEIGHT = 16;
@@ -476,15 +476,15 @@ const axisH = computed(() => props.showAxis ? AXIS_LABEL_HEIGHT + AXIS_PADDING :
476
476
  const valueLabelH = computed(() => props.showLabel ? VALUE_LABEL_HEIGHT : 0);
477
477
  const plotHeight = computed(() => {
478
478
  if (props.direction === DIRECTION.HORIZONTAL) {
479
- return SVG_HEIGHT - axisH.value;
479
+ return svgHeight.value - axisH.value;
480
480
  }
481
- return SVG_HEIGHT - axisH.value - valueLabelH.value;
481
+ return svgHeight.value - axisH.value - valueLabelH.value;
482
482
  });
483
483
  const plotWidth = computed(() => {
484
484
  if (props.direction === DIRECTION.HORIZONTAL) {
485
- return SVG_WIDTH - axisH.value - valueLabelH.value;
485
+ return svgWidth.value - axisH.value - valueLabelH.value;
486
486
  }
487
- return SVG_WIDTH;
487
+ return svgWidth.value;
488
488
  });
489
489
  const PLOT_Y = computed(() => props.showLabel ? VALUE_LABEL_HEIGHT : 0);
490
490
  const PLOT_X = computed(() => props.direction === DIRECTION.HORIZONTAL && props.showAxis ? AXIS_LABEL_HEIGHT + AXIS_PADDING : 0);
@@ -558,7 +558,7 @@ const FILL_GAP = 12;
558
558
  const FILL_AXIS_HEIGHT = computed(() => props.showAxis ? AXIS_LABEL_HEIGHT + AXIS_PADDING : 0);
559
559
  const FILL_LABEL_RESERVE = computed(() => props.showLabel ? FILL_LABEL_HEIGHT : 0);
560
560
  const fillPlotHeight = computed(
561
- () => SVG_HEIGHT - FILL_AXIS_HEIGHT.value - FILL_LABEL_RESERVE.value
561
+ () => svgHeight.value - FILL_AXIS_HEIGHT.value - FILL_LABEL_RESERVE.value
562
562
  );
563
563
  const fillCategoryCount = computed(() => {
564
564
  if (!props.series?.length) return 0;
@@ -571,7 +571,7 @@ const fillIconWidth = computed(() => {
571
571
  const totalCols = fillTotalCols.value;
572
572
  if (totalCols <= 0) return 0;
573
573
  const totalGaps = (totalCols - 1) * FILL_GAP;
574
- return Math.max(24, (SVG_WIDTH - totalGaps) / totalCols);
574
+ return Math.max(24, (svgWidth.value - totalGaps) / totalCols);
575
575
  });
576
576
  const fillIconHeight = computed(
577
577
  () => Math.max(24, fillPlotHeight.value)
@@ -678,7 +678,6 @@ const legendItems = computed(() => {
678
678
  visible: !hiddenSeries.value.has(s.name)
679
679
  }));
680
680
  });
681
- const svgRef = ref(null);
682
681
  const mousePos = ref({ x: 0, y: 0 });
683
682
  const hoveredColKey = ref(null);
684
683
  const activeColumns = computed(
@@ -161,12 +161,13 @@
161
161
  </template>
162
162
 
163
163
  <script lang="ts" setup>
164
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
164
+ import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
165
165
  import {
166
166
  computed,
167
167
  ref
168
168
  } from "vue";
169
169
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
170
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
170
171
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
171
172
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
172
173
  import { useChart } from "../../composables/Chart/chart.composable";
@@ -202,7 +203,7 @@ const props = defineProps({
202
203
  id: { type: String, required: false },
203
204
  class: { type: [String, Array, Object], required: false },
204
205
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
205
- height: { type: [Number, String], required: false, default: 300 },
206
+ height: { type: [Number, String], required: false },
206
207
  maxHeight: { type: [Number, String], required: false },
207
208
  maxWidth: { type: [Number, String], required: false },
208
209
  minHeight: { type: [Number, String], required: false },
@@ -305,10 +306,8 @@ const { paddingClasses, paddingStyles } = usePadding(props);
305
306
  const { roundedClasses, roundedStyles } = useRounded(props);
306
307
  const { headerTypographyStyles } = useChartHeaderTypography(props);
307
308
  const chartAnimationStyle = useChartAnimationStyle(props);
308
- const SVG_WIDTH = 600;
309
- const SVG_HEIGHT = 360;
309
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.polar, { aspectRatio: CHART_ASPECT_RATIO.radial });
310
310
  const PADDING_POLAR = { top: 12, right: 12, bottom: 12, left: 12 };
311
- const svgRef = ref(null);
312
311
  const mousePos = ref({ x: 0, y: 0 });
313
312
  const hiddenLabels = ref(/* @__PURE__ */ new Set());
314
313
  const seriesWithVisibility = computed(
@@ -327,8 +326,8 @@ const chart = useChart({
327
326
  smoothing: () => "none",
328
327
  yMin: () => void 0,
329
328
  yMax: () => void 0,
330
- width: () => SVG_WIDTH,
331
- height: () => SVG_HEIGHT,
329
+ width: () => svgWidth.value,
330
+ height: () => svgHeight.value,
332
331
  padding: () => PADDING_POLAR,
333
332
  hiddenLabels: () => hiddenLabels.value
334
333
  });