origam 2.37.37 → 2.37.39

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 (32) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/src/components/Chart/OrigamChartAxis.vue +15 -1
  3. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +6 -7
  4. package/dist/src/components/Chart/OrigamChartBullet.vue +7 -8
  5. package/dist/src/components/Chart/OrigamChartCandlestick.vue +10 -11
  6. package/dist/src/components/Chart/OrigamChartGauge.vue +8 -6
  7. package/dist/src/components/Chart/OrigamChartHeatmap.vue +9 -5
  8. package/dist/src/components/Chart/OrigamChartMap.vue +14 -15
  9. package/dist/src/components/Chart/OrigamChartPareto.vue +9 -10
  10. package/dist/src/components/Chart/OrigamChartPictorial.vue +10 -11
  11. package/dist/src/components/Chart/OrigamChartPolar.vue +6 -7
  12. package/dist/src/components/Chart/OrigamChartPolarBar.vue +8 -8
  13. package/dist/src/components/Chart/OrigamChartPyramid.vue +6 -7
  14. package/dist/src/components/Chart/OrigamChartRadar.vue +7 -9
  15. package/dist/src/components/Chart/OrigamChartSankey.vue +6 -7
  16. package/dist/src/components/Chart/OrigamChartSparkline.vue +15 -17
  17. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +9 -10
  18. package/dist/src/components/Chart/OrigamChartSunburst.vue +8 -8
  19. package/dist/src/components/Chart/OrigamChartTreemap.vue +6 -7
  20. package/dist/src/components/Chart/OrigamChartVariwide.vue +8 -9
  21. package/dist/src/components/Chart/OrigamChartWordCloud.vue +16 -13
  22. package/dist/src/composables/Chart/chart-size.composable.cjs +8 -3
  23. package/dist/src/composables/Chart/chart-size.composable.d.ts +9 -0
  24. package/dist/src/composables/Chart/chart-size.composable.js +8 -3
  25. package/dist/src/consts/Chart/chart.const.cjs +83 -2
  26. package/dist/src/consts/Chart/chart.const.d.ts +113 -0
  27. package/dist/src/consts/Chart/chart.const.js +27 -0
  28. package/dist/src/interfaces/Chart/chart-axis.interface.d.ts +11 -0
  29. package/dist/src/utils/Chart/chart-axis-label.util.cjs +35 -0
  30. package/dist/src/utils/Chart/chart-axis-label.util.d.ts +24 -0
  31. package/dist/src/utils/Chart/chart-axis-label.util.js +24 -0
  32. package/package.json +1 -1
@@ -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
  });
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-polar-bar__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_SIZE } ${ SVG_SIZE }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgWidth }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -50,7 +50,7 @@
50
50
 
51
51
  <g
52
52
  class="origam-chart__series"
53
- :transform="`translate(${ CENTER }, ${ CENTER })`"
53
+ :transform="`translate(${ svgWidth / 2 }, ${ svgWidth / 2 })`"
54
54
  data-cy="origam-chart-polar-bar-series"
55
55
  >
56
56
  <path
@@ -154,7 +154,7 @@
154
154
  </template>
155
155
 
156
156
  <script lang="ts" setup>
157
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
157
+ import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
158
158
  import {
159
159
  computed,
160
160
  ref
@@ -163,6 +163,7 @@ import OrigamChartLegend from "./OrigamChartLegend.vue";
163
163
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
164
164
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
165
165
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
166
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
166
167
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
167
168
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
168
169
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -198,7 +199,7 @@ const props = defineProps({
198
199
  id: { type: String, required: false },
199
200
  class: { type: [String, Array, Object], required: false },
200
201
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
201
- height: { type: [Number, String], required: false, default: 400 },
202
+ height: { type: [Number, String], required: false },
202
203
  maxHeight: { type: [Number, String], required: false },
203
204
  maxWidth: { type: [Number, String], required: false },
204
205
  minHeight: { type: [Number, String], required: false },
@@ -257,8 +258,8 @@ useUnsupportedProp(
257
258
  () => props.xAxisFormat !== void 0
258
259
  );
259
260
  const chartAnimationStyle = useChartAnimationStyle(props);
260
- const SVG_SIZE = 400;
261
- const CENTER = SVG_SIZE / 2;
261
+ const { resizeRef: svgRef, width: svgWidth } = useChartSize(CHART_SIZE_FALLBACK.polarBar, { aspectRatio: CHART_ASPECT_RATIO.radial });
262
+ const center = computed(() => svgWidth.value / 2);
262
263
  const LABEL_RADIAL_OFFSET = 14;
263
264
  const VALUE_LABEL_MIN_ANGLE = 0.25;
264
265
  const DEFAULT_PALETTE = [
@@ -329,7 +330,7 @@ const wedges = computed(() => {
329
330
  if (count === 0) return [];
330
331
  const total = values.reduce((s, v) => s + (Number.isFinite(v) && v >= 0 ? v : 0), 0) || 1e-9;
331
332
  const effectiveMax = props.maxValue != null && props.maxValue > 0 ? props.maxValue : Math.max(...values.filter((v) => Number.isFinite(v) && v >= 0), 1e-9);
332
- const totalR = CENTER - LABEL_RADIAL_OFFSET - 20;
333
+ const totalR = center.value - LABEL_RADIAL_OFFSET - 20;
333
334
  const innerR = totalR * Math.max(0, Math.min(0.99, props.innerRadius));
334
335
  const totalAngularSpace = 2 * Math.PI - count * props.gap;
335
336
  const slotAngle = Math.max(0, totalAngularSpace / count);
@@ -402,7 +403,6 @@ const legendItems = computed(() => {
402
403
  visible: w.visible
403
404
  }));
404
405
  });
405
- const svgRef = ref(null);
406
406
  const mousePos = ref({ x: 0, y: 0 });
407
407
  const hoveredIndex = ref(null);
408
408
  const hoveredWedge = computed(() => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-pyramid__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"
@@ -153,7 +153,7 @@
153
153
  </template>
154
154
 
155
155
  <script lang="ts" setup>
156
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
156
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
157
157
  import {
158
158
  computed,
159
159
  ref
@@ -161,6 +161,7 @@ import {
161
161
  import OrigamChartLegend from "./OrigamChartLegend.vue";
162
162
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
163
163
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
164
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
164
165
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
165
166
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
166
167
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -246,8 +247,7 @@ const { paddingClasses, paddingStyles } = usePadding(props);
246
247
  const { roundedClasses, roundedStyles } = useRounded(props);
247
248
  const { headerTypographyStyles } = useChartHeaderTypography(props);
248
249
  const chartAnimationStyle = useChartAnimationStyle(props);
249
- const SVG_WIDTH = 600;
250
- const SVG_HEIGHT = 400;
250
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.pyramid);
251
251
  const PADDING = { top: 20, right: 120, bottom: 20, left: 20 };
252
252
  const LABEL_FITS_INSIDE_MIN_HEIGHT = 18;
253
253
  const LABEL_FITS_INSIDE_MIN_WIDTH = 90;
@@ -302,9 +302,9 @@ const slices = computed(() => {
302
302
  if (count === 0) return [];
303
303
  const total = values.reduce((s, v) => s + (Number.isFinite(v) && v >= 0 ? v : 0), 0) || 1e-9;
304
304
  const x0 = PADDING.left;
305
- const x1 = SVG_WIDTH - PADDING.right;
305
+ const x1 = svgWidth.value - PADDING.right;
306
306
  const y0 = PADDING.top;
307
- const y1 = SVG_HEIGHT - PADDING.bottom;
307
+ const y1 = svgHeight.value - PADDING.bottom;
308
308
  const cx = (x0 + x1) / 2;
309
309
  const plotW = x1 - x0;
310
310
  const totalH = y1 - y0;
@@ -384,7 +384,6 @@ const effectiveLabelPlacement = (slice) => {
384
384
  if (props.labelPlacement === "outside") return "outside";
385
385
  return slice.labelFitsInside ? "inside" : "outside";
386
386
  };
387
- const svgRef = ref(null);
388
387
  const mousePos = ref({ x: 0, y: 0 });
389
388
  const hoveredIndex = ref(null);
390
389
  const hoveredSlice = computed(() => {
@@ -142,13 +142,13 @@
142
142
  </template>
143
143
 
144
144
  <script lang="ts" setup>
145
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
145
+ import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
146
146
  import {
147
- computed,
148
- ref
147
+ computed
149
148
  } from "vue";
150
149
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
151
150
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
151
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
152
152
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
153
153
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
154
154
  import { useChart } from "../../composables/Chart/chart.composable";
@@ -177,7 +177,7 @@ const props = defineProps({
177
177
  id: { type: String, required: false },
178
178
  class: { type: [String, Array, Object], required: false },
179
179
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
180
- height: { type: [Number, String], required: false, default: 300 },
180
+ height: { type: [Number, String], required: false },
181
181
  maxHeight: { type: [Number, String], required: false },
182
182
  maxWidth: { type: [Number, String], required: false },
183
183
  minHeight: { type: [Number, String], required: false },
@@ -236,11 +236,9 @@ useUnsupportedProp(
236
236
  () => props.showTooltip !== void 0
237
237
  );
238
238
  const chartAnimationStyle = useChartAnimationStyle(props);
239
- const SVG_WIDTH = 600;
240
- const SVG_HEIGHT = 360;
239
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.radar, { aspectRatio: CHART_ASPECT_RATIO.radial });
241
240
  const PADDING_RADAR = { top: 20, right: 20, bottom: 20, left: 20 };
242
241
  const RADAR_RINGS = [0.25, 0.5, 0.75, 1];
243
- const svgRef = ref(null);
244
242
  const chart = useChart({
245
243
  type: () => "radar",
246
244
  series: () => props.series,
@@ -251,8 +249,8 @@ const chart = useChart({
251
249
  smoothing: () => "none",
252
250
  yMin: () => void 0,
253
251
  yMax: () => void 0,
254
- width: () => SVG_WIDTH,
255
- height: () => SVG_HEIGHT,
252
+ width: () => svgWidth.value,
253
+ height: () => svgHeight.value,
256
254
  padding: () => PADDING_RADAR
257
255
  });
258
256
  const { viewBox, paths, legend, plot, slotCount } = chart;
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-sankey__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"
@@ -166,7 +166,7 @@
166
166
  </template>
167
167
 
168
168
  <script lang="ts" setup>
169
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
169
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
170
170
  import {
171
171
  computed,
172
172
  ref
@@ -175,6 +175,7 @@ import OrigamChartLegend from "./OrigamChartLegend.vue";
175
175
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
176
176
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
177
177
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
178
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
178
179
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
179
180
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
180
181
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -267,8 +268,7 @@ useUnsupportedProp(
267
268
  () => props.categories !== void 0
268
269
  );
269
270
  const chartAnimationStyle = useChartAnimationStyle(props);
270
- const SVG_WIDTH = 600;
271
- const SVG_HEIGHT = 400;
271
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.sankey);
272
272
  const PADDING = { top: 20, right: 100, bottom: 20, left: 100 };
273
273
  const DEFAULT_PALETTE = [
274
274
  "primary",
@@ -366,9 +366,9 @@ const layoutNodes = computed(() => {
366
366
  nodeValues.set(name, Math.max(incomingSum.get(name) ?? 0, outgoingSum.get(name) ?? 0));
367
367
  }
368
368
  const plotLeft = PADDING.left;
369
- const plotRight = SVG_WIDTH - PADDING.right;
369
+ const plotRight = svgWidth.value - PADDING.right;
370
370
  const plotTop = PADDING.top;
371
- const plotBottom = SVG_HEIGHT - PADDING.bottom;
371
+ const plotBottom = svgHeight.value - PADDING.bottom;
372
372
  const plotWidth = plotRight - plotLeft;
373
373
  const plotHeight = plotBottom - plotTop;
374
374
  const colXStep = totalColumns > 1 ? (plotWidth - props.nodeWidth) / (totalColumns - 1) : 0;
@@ -582,7 +582,6 @@ const nodeLabelAnchor = (node) => {
582
582
  if (node.column === 0) return "end";
583
583
  return "start";
584
584
  };
585
- const svgRef = ref(null);
586
585
  const mousePos = ref({ x: 0, y: 0 });
587
586
  const hoveredNodeName = ref(null);
588
587
  const hoveredLinkIndex = ref(null);
@@ -10,10 +10,9 @@
10
10
  <svg
11
11
  ref="svgRef"
12
12
  class="origam-chart-sparkline__svg"
13
- :viewBox="`0 0 ${ SVG_WIDTH } ${ SVG_HEIGHT }`"
13
+ :viewBox="`0 0 ${ svgWidth } ${ svgHeight }`"
14
14
  :role="CHART_SVG_ROLE"
15
15
  :aria-label="svgAriaLabel"
16
- preserveAspectRatio="none"
17
16
  data-cy="origam-chart-sparkline-svg"
18
17
  @mousemove="onSvgMouseMove"
19
18
  @mouseleave="onSvgMouseLeave"
@@ -158,11 +157,12 @@
158
157
  </template>
159
158
 
160
159
  <script lang="ts" setup>
161
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
160
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
162
161
  import {
163
162
  computed,
164
163
  ref
165
164
  } from "vue";
165
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
166
166
  import { useLocale } from "../../composables/Commons/locale.composable";
167
167
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
168
168
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -245,8 +245,7 @@ const { elevationClasses, elevationStyles } = useElevation(props);
245
245
  const { marginClasses, marginStyles } = useMargin(props);
246
246
  const { paddingClasses, paddingStyles } = usePadding(props);
247
247
  const { roundedClasses, roundedStyles } = useRounded(props);
248
- const SVG_WIDTH = 120;
249
- const SVG_HEIGHT = 30;
248
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.sparkline);
250
249
  const PADDING_X = 2;
251
250
  const PADDING_Y = 2;
252
251
  const activeSeries = computed(() => props.series?.[0] ?? null);
@@ -267,9 +266,9 @@ const resolvedColor = computed(() => resolveColor(props.color));
267
266
  const MIN_COLOR = "var(--origam-color__feedback--danger---bg, #ef4444)";
268
267
  const MAX_COLOR = "var(--origam-color__feedback--success---bg, #22c55e)";
269
268
  const plotX0 = PADDING_X;
270
- const plotX1 = SVG_WIDTH - PADDING_X;
269
+ const plotX1 = computed(() => svgWidth.value - PADDING_X);
271
270
  const plotY0 = PADDING_Y;
272
- const plotY1 = SVG_HEIGHT - PADDING_Y;
271
+ const plotY1 = computed(() => svgHeight.value - PADDING_Y);
273
272
  const dataMin = computed(() => {
274
273
  if (!values.value.length) return 0;
275
274
  return Math.min(...values.value);
@@ -280,14 +279,14 @@ const dataMax = computed(() => {
280
279
  });
281
280
  const scaleX = computed(() => {
282
281
  const n = values.value.length;
283
- if (n < 2) return (_i) => (plotX0 + plotX1) / 2;
284
- return (i) => plotX0 + i / (n - 1) * (plotX1 - plotX0);
282
+ if (n < 2) return (_i) => (plotX0 + plotX1.value) / 2;
283
+ return (i) => plotX0 + i / (n - 1) * (plotX1.value - plotX0);
285
284
  });
286
285
  const scaleY = computed(() => {
287
286
  const min = dataMin.value;
288
287
  const max = dataMax.value;
289
288
  const range = max - min || 1;
290
- return (v) => plotY1 - (v - min) / range * (plotY1 - plotY0);
289
+ return (v) => plotY1.value - (v - min) / range * (plotY1.value - plotY0);
291
290
  });
292
291
  const points = computed(
293
292
  () => values.value.map((v, i) => ({
@@ -307,7 +306,7 @@ const areaPath = computed(() => {
307
306
  const pts = points.value;
308
307
  if (pts.length < 2) return null;
309
308
  const line = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
310
- const close = `L ${pts[pts.length - 1].cx} ${plotY1} L ${pts[0].cx} ${plotY1} Z`;
309
+ const close = `L ${pts[pts.length - 1].cx} ${plotY1.value} L ${pts[0].cx} ${plotY1.value} Z`;
311
310
  return `${line} ${close}`;
312
311
  });
313
312
  const markerPoints = computed(() => {
@@ -318,30 +317,30 @@ const columnBars = computed(() => {
318
317
  const pts = points.value;
319
318
  if (!pts.length) return [];
320
319
  const n = pts.length;
321
- const totalW = plotX1 - plotX0;
320
+ const totalW = plotX1.value - plotX0;
322
321
  const barW = Math.max(1, totalW / n * 0.7);
323
322
  const gap = totalW / n;
324
323
  const min = dataMin.value;
325
324
  const max = dataMax.value;
326
325
  const range = max - min || 1;
327
326
  return pts.map((p, i) => {
328
- const barH = Math.max(1, (p.value - min) / range * (plotY1 - plotY0));
327
+ const barH = Math.max(1, (p.value - min) / range * (plotY1.value - plotY0));
329
328
  const x = plotX0 + i * gap + (gap - barW) / 2;
330
- const y = plotY1 - barH;
329
+ const y = plotY1.value - barH;
331
330
  return { index: i, x, y, width: barW, height: barH };
332
331
  });
333
332
  });
334
333
  const horizontalBars = computed(() => {
335
334
  const n = values.value.length;
336
335
  if (!n) return [];
337
- const totalH = plotY1 - plotY0;
336
+ const totalH = plotY1.value - plotY0;
338
337
  const barH = Math.max(1, totalH / n * 0.7);
339
338
  const gap = totalH / n;
340
339
  const min = dataMin.value;
341
340
  const max = dataMax.value;
342
341
  const range = max - min || 1;
343
342
  return values.value.map((v, i) => {
344
- const barW = Math.max(1, (v - min) / range * (plotX1 - plotX0));
343
+ const barW = Math.max(1, (v - min) / range * (plotX1.value - plotX0));
345
344
  const y = plotY0 + i * gap + (gap - barH) / 2;
346
345
  return { index: i, x: plotX0, y, width: barW, height: barH };
347
346
  });
@@ -387,7 +386,6 @@ const specialMarkers = computed(() => {
387
386
  }
388
387
  return result;
389
388
  });
390
- const svgRef = ref(null);
391
389
  const mousePos = ref({ x: 0, y: 0 });
392
390
  const hoveredIndex = ref(null);
393
391
  const pointAt = (index) => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-streamgraph__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"
@@ -177,7 +177,7 @@
177
177
  </template>
178
178
 
179
179
  <script lang="ts" setup>
180
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
180
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
181
181
  import {
182
182
  computed,
183
183
  ref
@@ -185,6 +185,7 @@ import {
185
185
  import OrigamChartLegend from "./OrigamChartLegend.vue";
186
186
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
187
187
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
188
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
188
189
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
189
190
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
190
191
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -271,17 +272,16 @@ const { paddingClasses, paddingStyles } = usePadding(props);
271
272
  const { roundedClasses, roundedStyles } = useRounded(props);
272
273
  const { headerTypographyStyles } = useChartHeaderTypography(props);
273
274
  const chartAnimationStyle = useChartAnimationStyle(props);
274
- const SVG_WIDTH = 700;
275
- const SVG_HEIGHT = 420;
275
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.streamgraph);
276
276
  const PADDING = { top: 24, right: 24, bottom: 40, left: 40 };
277
277
  const AXIS_LABEL_OFFSET = 6;
278
278
  const plot = computed(() => ({
279
279
  left: PADDING.left,
280
- right: SVG_WIDTH - PADDING.right,
280
+ right: svgWidth.value - PADDING.right,
281
281
  top: PADDING.top,
282
- bottom: SVG_HEIGHT - PADDING.bottom,
283
- width: SVG_WIDTH - PADDING.left - PADDING.right,
284
- height: SVG_HEIGHT - PADDING.top - PADDING.bottom
282
+ bottom: svgHeight.value - PADDING.bottom,
283
+ width: svgWidth.value - PADDING.left - PADDING.right,
284
+ height: svgHeight.value - PADDING.top - PADDING.bottom
285
285
  }));
286
286
  const DEFAULT_PALETTE = [
287
287
  "primary",
@@ -552,7 +552,6 @@ const svgDesc = computed(() => t("origam.chart.streamgraph.desc", {
552
552
  points: t("origam.chart.streamgraph.desc_points", columnCount.value)
553
553
  }));
554
554
  const ribbonAriaLabel = (ribbon) => `${ribbon.name}: ${ribbon.values.map((v) => formatValue(v)).join(", ")}`;
555
- const svgRef = ref(null);
556
555
  const mousePos = ref({ x: 0, y: 0 });
557
556
  const hoveredSeriesIndex = ref(null);
558
557
  const hoveredXIndex = ref(null);
@@ -621,7 +620,7 @@ const onSvgMouseMove = (event) => {
621
620
  const clientX = event.clientX - rect.left;
622
621
  const clientY = event.clientY - rect.top;
623
622
  mousePos.value = { x: clientX, y: clientY };
624
- const svgScaleX = SVG_WIDTH / rect.width;
623
+ const svgScaleX = svgWidth.value / rect.width;
625
624
  hoveredXIndex.value = nearestXIndex(clientX * svgScaleX);
626
625
  };
627
626
  const onSvgMouseLeave = () => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-sunburst__svg origam-chart__svg"
39
39
  :class="svgClasses"
40
- :viewBox="`0 0 ${ SVG_SIZE } ${ SVG_SIZE }`"
40
+ :viewBox="`0 0 ${ svgWidth } ${ svgWidth }`"
41
41
  :role="CHART_SVG_ROLE"
42
42
  :aria-label="svgAriaLabel"
43
43
  preserveAspectRatio="xMidYMid meet"
@@ -50,7 +50,7 @@
50
50
 
51
51
  <g
52
52
  class="origam-chart__series"
53
- :transform="`translate(${ CENTER }, ${ CENTER })`"
53
+ :transform="`translate(${ svgWidth / 2 }, ${ svgWidth / 2 })`"
54
54
  data-cy="origam-chart-sunburst-series"
55
55
  >
56
56
  <path
@@ -162,7 +162,7 @@
162
162
  </template>
163
163
 
164
164
  <script lang="ts" setup>
165
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
165
+ import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
166
166
  import {
167
167
  computed,
168
168
  ref
@@ -170,6 +170,7 @@ import {
170
170
  import OrigamChartLegend from "./OrigamChartLegend.vue";
171
171
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
172
172
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
173
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
173
174
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
174
175
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
175
176
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -200,7 +201,7 @@ const props = defineProps({
200
201
  id: { type: String, required: false },
201
202
  class: { type: [String, Array, Object], required: false },
202
203
  style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
203
- height: { type: [Number, String], required: false, default: 400 },
204
+ height: { type: [Number, String], required: false },
204
205
  maxHeight: { type: [Number, String], required: false },
205
206
  maxWidth: { type: [Number, String], required: false },
206
207
  minHeight: { type: [Number, String], required: false },
@@ -253,8 +254,8 @@ const { paddingClasses, paddingStyles } = usePadding(props);
253
254
  const { roundedClasses, roundedStyles } = useRounded(props);
254
255
  const { headerTypographyStyles } = useChartHeaderTypography(props);
255
256
  const chartAnimationStyle = useChartAnimationStyle(props);
256
- const SVG_SIZE = 400;
257
- const CENTER = SVG_SIZE / 2;
257
+ const { resizeRef: svgRef, width: svgWidth } = useChartSize(CHART_SIZE_FALLBACK.sunburst, { aspectRatio: CHART_ASPECT_RATIO.radial });
258
+ const center = computed(() => svgWidth.value / 2);
258
259
  const MAX_DEPTH_CAP = 4;
259
260
  const LABEL_ANGLE_INLINE = 0.1;
260
261
  const LABEL_ANGLE_ROTATED = 0.05;
@@ -381,7 +382,7 @@ const allNodes = computed(() => {
381
382
  if (!rawData.length) return [];
382
383
  const maxDepth = Math.min(computeMaxDepth(rawData), MAX_DEPTH_CAP);
383
384
  if (maxDepth === 0) return [];
384
- const totalR = CENTER - 4;
385
+ const totalR = center.value - 4;
385
386
  const holeR = totalR * props.innerRadius;
386
387
  const ringWidth = (totalR - holeR) / maxDepth;
387
388
  const totalValue = rawData.reduce((acc, d) => acc + resolveValue(d), 0);
@@ -532,7 +533,6 @@ const legendItems = computed(() => {
532
533
  visible: node.visible
533
534
  }));
534
535
  });
535
- const svgRef = ref(null);
536
536
  const mousePos = ref({ x: 0, y: 0 });
537
537
  const hoveredId = ref(null);
538
538
  const hoveredNode = computed(() => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-treemap__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"
@@ -158,7 +158,7 @@
158
158
  </template>
159
159
 
160
160
  <script lang="ts" setup>
161
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
161
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
162
162
  import {
163
163
  computed,
164
164
  ref
@@ -167,6 +167,7 @@ import OrigamChartLegend from "./OrigamChartLegend.vue";
167
167
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
168
168
  import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
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 { useDimension } from "../../composables/Commons/dimension.composable";
@@ -256,8 +257,7 @@ useUnsupportedProp(
256
257
  () => (props.categories?.length ?? 0) > 0
257
258
  );
258
259
  const chartAnimationStyle = useChartAnimationStyle(props);
259
- const SVG_WIDTH = 600;
260
- const SVG_HEIGHT = 400;
260
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.treemap);
261
261
  const PADDING = { top: 8, right: 8, bottom: 8, left: 8 };
262
262
  const LABEL_MIN_WIDTH = 60;
263
263
  const LABEL_MIN_HEIGHT = 24;
@@ -387,8 +387,8 @@ const tiles = computed(() => {
387
387
  if (total <= 0) return [];
388
388
  const plotX = PADDING.left;
389
389
  const plotY = PADDING.top;
390
- const plotW = SVG_WIDTH - PADDING.left - PADDING.right;
391
- const plotH = SVG_HEIGHT - PADDING.top - PADDING.bottom;
390
+ const plotW = svgWidth.value - PADDING.left - PADDING.right;
391
+ const plotH = svgHeight.value - PADDING.top - PADDING.bottom;
392
392
  const plotArea = plotW * plotH;
393
393
  const sortedItems = items.map((item, originalIndex) => ({ ...item, originalIndex })).sort((a, b) => b.value - a.value);
394
394
  const scaledValues = sortedItems.map((item) => Math.max(0, item.value) / total * plotArea);
@@ -430,7 +430,6 @@ const legendItems = computed(() => {
430
430
  visible: tile.visible
431
431
  }));
432
432
  });
433
- const svgRef = ref(null);
434
433
  const mousePos = ref({ x: 0, y: 0 });
435
434
  const hoveredIndex = ref(null);
436
435
  const hoveredTile = computed(() => {
@@ -37,7 +37,7 @@
37
37
  ref="svgRef"
38
38
  class="origam-chart-variwide__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"
@@ -233,7 +233,7 @@
233
233
  </template>
234
234
 
235
235
  <script lang="ts" setup>
236
- import { CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
236
+ import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
237
237
  import {
238
238
  computed,
239
239
  ref
@@ -241,6 +241,7 @@ import {
241
241
  import OrigamChartLegend from "./OrigamChartLegend.vue";
242
242
  import OrigamChartTooltip from "./OrigamChartTooltip.vue";
243
243
  import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
244
+ import { useChartSize } from "../../composables/Chart/chart-size.composable";
244
245
  import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
245
246
  import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
246
247
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -329,8 +330,7 @@ const { paddingClasses, paddingStyles } = usePadding(props);
329
330
  const { roundedClasses, roundedStyles } = useRounded(props);
330
331
  const { headerTypographyStyles } = useChartHeaderTypography(props);
331
332
  const chartAnimationStyle = useChartAnimationStyle(props);
332
- const SVG_WIDTH = 600;
333
- const SVG_HEIGHT = 400;
333
+ const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.variwide);
334
334
  const TICK_SIZE = 4;
335
335
  const PLOT = {
336
336
  top: 24,
@@ -338,8 +338,8 @@ const PLOT = {
338
338
  bottom: 40,
339
339
  left: 48
340
340
  };
341
- const plotWidth = SVG_WIDTH - PLOT.left - PLOT.right;
342
- const plotHeight = SVG_HEIGHT - PLOT.top - PLOT.bottom;
341
+ const plotWidth = computed(() => svgWidth.value - PLOT.left - PLOT.right);
342
+ const plotHeight = computed(() => svgHeight.value - PLOT.top - PLOT.bottom);
343
343
  const DEFAULT_PALETTE = [
344
344
  "primary",
345
345
  "success",
@@ -403,7 +403,7 @@ const scaleY = (value) => {
403
403
  const { min, max } = yDomain.value;
404
404
  const range = max - min || 1;
405
405
  const fraction = (value - min) / range;
406
- return PLOT.top + plotHeight * (1 - fraction);
406
+ return PLOT.top + plotHeight.value * (1 - fraction);
407
407
  };
408
408
  const Y_TICK_COUNT = 5;
409
409
  const yTicks = computed(() => {
@@ -420,7 +420,7 @@ const columns = computed(() => {
420
420
  const items = datums.value;
421
421
  if (!items.length) return [];
422
422
  const totalW = items.reduce((acc, d) => acc + (Number.isFinite(d.width) && d.width > 0 ? d.width : 1), 0);
423
- const usableW = plotWidth - props.barGap * Math.max(0, items.length - 1);
423
+ const usableW = plotWidth.value - props.barGap * Math.max(0, items.length - 1);
424
424
  const baseline = scaleY(0);
425
425
  let cursorX = PLOT.left;
426
426
  return items.map((datum, i) => {
@@ -470,7 +470,6 @@ const showEmpty = computed(() => {
470
470
  if (!first?.data?.length) return true;
471
471
  return columns.value.length === 0;
472
472
  });
473
- const svgRef = ref(null);
474
473
  const mousePos = ref({ x: 0, y: 0 });
475
474
  const hoveredIndex = ref(null);
476
475
  const hoveredColumn = computed(() => {