pptx-react-viewer 4.10.0 → 4.11.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.
- package/CHANGELOG.md +24 -0
- package/dist/{AiChatPanel-SIEMT43N.mjs → AiChatPanel-3IKRPPUX.mjs} +3 -3
- package/dist/AiChatPanel-3IKRPPUX.mjs.br +0 -0
- package/dist/AiChatPanel-3IKRPPUX.mjs.gz +0 -0
- package/dist/{AiChatPanel-RBQFM6JK.js → AiChatPanel-537JJCV4.js} +27 -27
- package/dist/AiChatPanel-537JJCV4.js.br +0 -0
- package/dist/AiChatPanel-537JJCV4.js.gz +0 -0
- package/dist/{Model3DScene-ITAVIIVY.js → Model3DScene-3XT5SBU4.js} +2 -2
- package/dist/Model3DScene-3XT5SBU4.js.br +0 -0
- package/dist/Model3DScene-3XT5SBU4.js.gz +0 -0
- package/dist/{Model3DScene-HZ7SOUFQ.mjs → Model3DScene-WBJV27OR.mjs} +1 -1
- package/dist/Model3DScene-WBJV27OR.mjs.br +0 -0
- package/dist/Model3DScene-WBJV27OR.mjs.gz +0 -0
- package/dist/{chunk-WM33FDLD.mjs → chunk-4MI3PMQT.mjs} +1 -1
- package/dist/chunk-4MI3PMQT.mjs.br +0 -0
- package/dist/chunk-4MI3PMQT.mjs.gz +0 -0
- package/dist/{chunk-LMJU46E5.mjs → chunk-BR4GXQSN.mjs} +1 -1
- package/dist/chunk-BR4GXQSN.mjs.br +0 -0
- package/dist/chunk-BR4GXQSN.mjs.gz +0 -0
- package/dist/{chunk-A5A6B2PA.mjs → chunk-G353KKQX.mjs} +3 -3
- package/dist/chunk-G353KKQX.mjs.br +0 -0
- package/dist/{chunk-A5A6B2PA.mjs.gz → chunk-G353KKQX.mjs.gz} +0 -0
- package/dist/{chunk-ZI57KREY.js → chunk-GLFTASJH.js} +806 -806
- package/dist/chunk-GLFTASJH.js.br +0 -0
- package/dist/chunk-GLFTASJH.js.gz +0 -0
- package/dist/{chunk-PPDIZ3XP.js → chunk-LVWMKZPS.js} +5 -5
- package/dist/chunk-LVWMKZPS.js.br +0 -0
- package/dist/chunk-LVWMKZPS.js.gz +0 -0
- package/dist/{chunk-ZEQVK2FT.js → chunk-NCUM2X4H.js} +1182 -1183
- package/dist/chunk-NCUM2X4H.js.br +0 -0
- package/dist/chunk-NCUM2X4H.js.gz +0 -0
- package/dist/{chunk-3UZYGG6W.mjs → chunk-SDEBL4LY.mjs} +9 -10
- package/dist/chunk-SDEBL4LY.mjs.br +0 -0
- package/dist/chunk-SDEBL4LY.mjs.gz +0 -0
- package/dist/{chunk-E5565MDK.js → chunk-TLKFCZWS.js} +228 -2882
- package/dist/chunk-TLKFCZWS.js.br +0 -0
- package/dist/chunk-TLKFCZWS.js.gz +0 -0
- package/dist/{chunk-NTMJSTXL.js → chunk-XGDCECDK.js} +187 -187
- package/dist/chunk-XGDCECDK.js.br +0 -0
- package/dist/chunk-XGDCECDK.js.gz +0 -0
- package/dist/{chunk-ZBFDEYLQ.mjs → chunk-ZVBB3CC5.mjs} +228 -2882
- package/dist/chunk-ZVBB3CC5.mjs.br +0 -0
- package/dist/chunk-ZVBB3CC5.mjs.gz +0 -0
- package/dist/index.js +61 -61
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.js +104 -104
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -3
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/viewer/index.js +26 -26
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -5
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/AiChatPanel-RBQFM6JK.js.br +0 -0
- package/dist/AiChatPanel-RBQFM6JK.js.gz +0 -0
- package/dist/AiChatPanel-SIEMT43N.mjs.br +0 -0
- package/dist/AiChatPanel-SIEMT43N.mjs.gz +0 -0
- package/dist/Model3DScene-HZ7SOUFQ.mjs.br +0 -0
- package/dist/Model3DScene-HZ7SOUFQ.mjs.gz +0 -0
- package/dist/Model3DScene-ITAVIIVY.js.br +0 -0
- package/dist/Model3DScene-ITAVIIVY.js.gz +0 -0
- package/dist/chunk-3UZYGG6W.mjs.br +0 -0
- package/dist/chunk-3UZYGG6W.mjs.gz +0 -0
- package/dist/chunk-A5A6B2PA.mjs.br +0 -0
- package/dist/chunk-E5565MDK.js.br +0 -0
- package/dist/chunk-E5565MDK.js.gz +0 -0
- package/dist/chunk-LMJU46E5.mjs.br +0 -0
- package/dist/chunk-LMJU46E5.mjs.gz +0 -0
- package/dist/chunk-NTMJSTXL.js.br +0 -0
- package/dist/chunk-NTMJSTXL.js.gz +0 -0
- package/dist/chunk-PPDIZ3XP.js.br +0 -0
- package/dist/chunk-PPDIZ3XP.js.gz +0 -0
- package/dist/chunk-WM33FDLD.mjs.br +0 -0
- package/dist/chunk-WM33FDLD.mjs.gz +0 -0
- package/dist/chunk-ZBFDEYLQ.mjs.br +0 -0
- package/dist/chunk-ZBFDEYLQ.mjs.gz +0 -0
- package/dist/chunk-ZEQVK2FT.js.br +0 -0
- package/dist/chunk-ZEQVK2FT.js.gz +0 -0
- package/dist/chunk-ZI57KREY.js.br +0 -0
- package/dist/chunk-ZI57KREY.js.gz +0 -0
|
@@ -27272,6 +27272,19 @@ var init_element_xml_builders = __esm({
|
|
|
27272
27272
|
init_stroke_utils();
|
|
27273
27273
|
}
|
|
27274
27274
|
});
|
|
27275
|
+
function srgb255ToLinear(channel) {
|
|
27276
|
+
const c = clampUnitInterval(channel / 255);
|
|
27277
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
27278
|
+
}
|
|
27279
|
+
function linearToSrgb255(linear) {
|
|
27280
|
+
const c = clampUnitInterval(linear);
|
|
27281
|
+
return 255 * (c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055);
|
|
27282
|
+
}
|
|
27283
|
+
var init_color_linear = __esm({
|
|
27284
|
+
"src/core/color/color-linear.ts"() {
|
|
27285
|
+
init_color_primitives();
|
|
27286
|
+
}
|
|
27287
|
+
});
|
|
27275
27288
|
function applyDrawingColorTransforms(baseColor, colorNode) {
|
|
27276
27289
|
const rgb2 = hexToRgbChannels(baseColor);
|
|
27277
27290
|
if (!rgb2) {
|
|
@@ -27314,15 +27327,15 @@ function applyDrawingColorTransforms(baseColor, colorNode) {
|
|
|
27314
27327
|
}
|
|
27315
27328
|
const shade3 = parseDrawingPercent(getVal("a:shade"));
|
|
27316
27329
|
if (shade3 !== void 0) {
|
|
27317
|
-
r
|
|
27318
|
-
g2
|
|
27319
|
-
b
|
|
27330
|
+
r = linearToSrgb255(srgb255ToLinear(r) * shade3);
|
|
27331
|
+
g2 = linearToSrgb255(srgb255ToLinear(g2) * shade3);
|
|
27332
|
+
b = linearToSrgb255(srgb255ToLinear(b) * shade3);
|
|
27320
27333
|
}
|
|
27321
27334
|
const tint3 = parseDrawingPercent(getVal("a:tint"));
|
|
27322
27335
|
if (tint3 !== void 0) {
|
|
27323
|
-
r =
|
|
27324
|
-
g2 =
|
|
27325
|
-
b =
|
|
27336
|
+
r = linearToSrgb255(1 - (1 - srgb255ToLinear(r)) * tint3);
|
|
27337
|
+
g2 = linearToSrgb255(1 - (1 - srgb255ToLinear(g2)) * tint3);
|
|
27338
|
+
b = linearToSrgb255(1 - (1 - srgb255ToLinear(b)) * tint3);
|
|
27326
27339
|
}
|
|
27327
27340
|
const hslKeys = [
|
|
27328
27341
|
"a:hue",
|
|
@@ -27435,6 +27448,7 @@ function applySrgbGammaDecode(r, g2, b) {
|
|
|
27435
27448
|
}
|
|
27436
27449
|
var init_color_transforms = __esm({
|
|
27437
27450
|
"src/core/color/color-transforms.ts"() {
|
|
27451
|
+
init_color_linear();
|
|
27438
27452
|
init_color_primitives();
|
|
27439
27453
|
}
|
|
27440
27454
|
});
|
|
@@ -169327,8 +169341,8 @@ function hexToRgb2(hex22) {
|
|
|
169327
169341
|
];
|
|
169328
169342
|
}
|
|
169329
169343
|
function rgbToHex(r, g2, b) {
|
|
169330
|
-
const
|
|
169331
|
-
return `#${
|
|
169344
|
+
const clamp12 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
169345
|
+
return `#${clamp12(r).toString(16).padStart(2, "0")}${clamp12(g2).toString(16).padStart(2, "0")}${clamp12(b).toString(16).padStart(2, "0")}`;
|
|
169332
169346
|
}
|
|
169333
169347
|
function tint(hex22, amount) {
|
|
169334
169348
|
const [r, g2, b] = hexToRgb2(hex22);
|
|
@@ -169828,8 +169842,8 @@ function hexToRgb3(hex22) {
|
|
|
169828
169842
|
];
|
|
169829
169843
|
}
|
|
169830
169844
|
function rgbToHex2(r, g2, b) {
|
|
169831
|
-
const
|
|
169832
|
-
return `#${
|
|
169845
|
+
const clamp12 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
169846
|
+
return `#${clamp12(r).toString(16).padStart(2, "0")}${clamp12(g2).toString(16).padStart(2, "0")}${clamp12(b).toString(16).padStart(2, "0")}`;
|
|
169833
169847
|
}
|
|
169834
169848
|
function tint2(hex22, amount) {
|
|
169835
169849
|
const [r, g2, b] = hexToRgb3(hex22);
|
|
@@ -170694,15 +170708,6 @@ var init_chart_view_model_bars = __esm2({
|
|
|
170694
170708
|
init_chart_view_model_scale();
|
|
170695
170709
|
}
|
|
170696
170710
|
});
|
|
170697
|
-
function resolveChart3DWallColors(surfaces) {
|
|
170698
|
-
const floor = surfaces.floor?.spPr?.fillColor;
|
|
170699
|
-
const sideWall = surfaces.sideWall?.spPr?.fillColor;
|
|
170700
|
-
const backWall = surfaces.backWall?.spPr?.fillColor;
|
|
170701
|
-
if (!floor && !sideWall && !backWall) {
|
|
170702
|
-
return void 0;
|
|
170703
|
-
}
|
|
170704
|
-
return { floor, sideWall, backWall };
|
|
170705
|
-
}
|
|
170706
170711
|
function primitivesBounds(prims) {
|
|
170707
170712
|
let minX = Number.POSITIVE_INFINITY;
|
|
170708
170713
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -178419,7 +178424,7 @@ function formatRegionMapValue(value, cultureLanguage) {
|
|
|
178419
178424
|
}
|
|
178420
178425
|
}
|
|
178421
178426
|
function lerpColor(a, b, t) {
|
|
178422
|
-
const
|
|
178427
|
+
const clamp12 = (v) => Math.max(0, Math.min(255, Math.round(v))), ha = a.replace("#", ""), hb = b.replace("#", ""), r1 = parseInt(ha.substring(0, 2), 16), g1 = parseInt(ha.substring(2, 4), 16), b1 = parseInt(ha.substring(4, 6), 16), r22 = parseInt(hb.substring(0, 2), 16), g2 = parseInt(hb.substring(2, 4), 16), b2 = parseInt(hb.substring(4, 6), 16), r = clamp12(r1 + (r22 - r1) * t), g3 = clamp12(g1 + (g2 - g1) * t), bl = clamp12(b1 + (b2 - b1) * t), toHex23 = (n) => n.toString(16).padStart(2, "0");
|
|
178423
178428
|
return `#${toHex23(r)}${toHex23(g3)}${toHex23(bl)}`;
|
|
178424
178429
|
}
|
|
178425
178430
|
function resolveValueColorStops(valueColors, valueColorPositions, minVal, maxVal) {
|
|
@@ -180887,9 +180892,13 @@ function smartArt3DRigSpecularLights(rig, perspective2) {
|
|
|
180887
180892
|
const own = perspective2 && rig ? SMARTART_RIG_SPECULAR_LIGHTS[rig] : void 0;
|
|
180888
180893
|
return own ?? DEFAULT_HIGHLIGHT;
|
|
180889
180894
|
}
|
|
180895
|
+
function smartArt3DRigKeyLight(rig, sceneCamera) {
|
|
180896
|
+
return sceneCamera && rig ? SMARTART_RIG_SCENE_KEY_LIGHTS[rig] : void 0;
|
|
180897
|
+
}
|
|
180890
180898
|
var DEFAULT_HIGHLIGHT_ELEVATION_DEG;
|
|
180891
180899
|
var DEFAULT_HIGHLIGHT;
|
|
180892
180900
|
var SMARTART_RIG_SPECULAR_LIGHTS;
|
|
180901
|
+
var SMARTART_RIG_SCENE_KEY_LIGHTS;
|
|
180893
180902
|
var init_smartart_3d_light_rig = __esm2({
|
|
180894
180903
|
"src/render/smartart-3d-light-rig.ts"() {
|
|
180895
180904
|
DEFAULT_HIGHLIGHT_ELEVATION_DEG = 60;
|
|
@@ -180899,6 +180908,12 @@ var init_smartart_3d_light_rig = __esm2({
|
|
|
180899
180908
|
SMARTART_RIG_SPECULAR_LIGHTS = {
|
|
180900
180909
|
threePt: [{ azimuthDeg: 64, elevationDeg: 44, intensity: 4.6, sharpness: 3 }]
|
|
180901
180910
|
};
|
|
180911
|
+
SMARTART_RIG_SCENE_KEY_LIGHTS = {
|
|
180912
|
+
flat: { azimuthDeg: 0, elevationDeg: 40 },
|
|
180913
|
+
threePt: { azimuthDeg: 0, elevationDeg: 90 },
|
|
180914
|
+
morning: { azimuthDeg: 0, elevationDeg: 60 },
|
|
180915
|
+
soft: { azimuthDeg: 0, elevationDeg: 80 }
|
|
180916
|
+
};
|
|
180902
180917
|
}
|
|
180903
180918
|
});
|
|
180904
180919
|
function srgbChannelToLinear(c) {
|
|
@@ -180919,7 +180934,7 @@ function normalize2(v) {
|
|
|
180919
180934
|
const len = Math.hypot(v.x, v.y, v.z) || 1;
|
|
180920
180935
|
return { x: v.x / len, y: v.y / len, z: v.z / len };
|
|
180921
180936
|
}
|
|
180922
|
-
function resolveSmartArt3DLightModel(lighting, material, perspective2 = false) {
|
|
180937
|
+
function resolveSmartArt3DLightModel(lighting, material, perspective2 = false, sceneCamera = perspective2) {
|
|
180923
180938
|
const snap2 = getBevelHighlightDirection(lighting?.direction ?? "t");
|
|
180924
180939
|
const rev = (lighting?.revDeg ?? 0) * Math.PI / 180;
|
|
180925
180940
|
const ax = snap2.dx;
|
|
@@ -180940,8 +180955,9 @@ function resolveSmartArt3DLightModel(lighting, material, perspective2 = false) {
|
|
|
180940
180955
|
};
|
|
180941
180956
|
const response = getMaterialLighting(material);
|
|
180942
180957
|
const specular = response.specularConstant * SPECULAR_GAIN;
|
|
180958
|
+
const key2 = smartArt3DRigKeyLight(lighting?.rig, sceneCamera);
|
|
180943
180959
|
return {
|
|
180944
|
-
light: toward(KEY_ELEVATION_DEG),
|
|
180960
|
+
light: key2 ? toward(key2.elevationDeg, key2.azimuthDeg) : toward(KEY_ELEVATION_DEG),
|
|
180945
180961
|
highlights: smartArt3DRigSpecularLights(lighting?.rig, perspective2).map((rigLight) => ({
|
|
180946
180962
|
direction: toward(rigLight.elevationDeg, rigLight.azimuthDeg),
|
|
180947
180963
|
weight: specular * rigLight.intensity,
|
|
@@ -181136,173 +181152,6 @@ var init_smartart_3d_drawing_solid = __esm2({
|
|
|
181136
181152
|
DEG_PER_UNIT2 = 6e4;
|
|
181137
181153
|
}
|
|
181138
181154
|
});
|
|
181139
|
-
function transposeForHorizontalBar3D(point) {
|
|
181140
|
-
return [point[1], -point[0], point[2]];
|
|
181141
|
-
}
|
|
181142
|
-
function computeCartesianGridExtent(cols, rows, depthPercent) {
|
|
181143
|
-
const gridWidth = Math.max(cols - 1, 1) * GRID_SPACING;
|
|
181144
|
-
const depthScale = Math.min(Math.max((depthPercent ?? 100) / 100, 0.05), 3);
|
|
181145
|
-
const gridDepth = Math.max(gridWidth * depthScale, rows > 1 ? GRID_SPACING : GRID_SPACING * 0.5);
|
|
181146
|
-
return { gridWidth, gridDepth };
|
|
181147
|
-
}
|
|
181148
|
-
function clamp7(value, min, max) {
|
|
181149
|
-
return Math.min(Math.max(value, min), max);
|
|
181150
|
-
}
|
|
181151
|
-
function normalizeAzimuth(deg3) {
|
|
181152
|
-
const wrapped = deg3 % 360;
|
|
181153
|
-
return wrapped < 0 ? wrapped + 360 : wrapped;
|
|
181154
|
-
}
|
|
181155
|
-
function resolveCartesianCameraFov(view3D) {
|
|
181156
|
-
if (view3D?.rAngAx) {
|
|
181157
|
-
return RIGHT_ANGLE_FOV;
|
|
181158
|
-
}
|
|
181159
|
-
const perspective2 = clamp7(
|
|
181160
|
-
view3D?.rperspective ?? DEFAULT_PERSPECTIVE_DEG,
|
|
181161
|
-
0,
|
|
181162
|
-
PERSPECTIVE_MAX_DEG
|
|
181163
|
-
);
|
|
181164
|
-
return FOV_MIN + perspective2 / PERSPECTIVE_MAX_DEG * (FOV_MAX - FOV_MIN);
|
|
181165
|
-
}
|
|
181166
|
-
function computeSphericalCameraPlacement(maxExtent, targetY, view3D) {
|
|
181167
|
-
const fov = resolveCartesianCameraFov(view3D);
|
|
181168
|
-
const halfFovRad = fov * Math.PI / 360;
|
|
181169
|
-
const radius = Math.max(maxExtent, 0.01) / Math.tan(halfFovRad) * 0.75;
|
|
181170
|
-
const target = [0, targetY, 0];
|
|
181171
|
-
const elevationDeg = clamp7(view3D?.rotX ?? DEFAULT_ELEVATION_DEG, -89, 89);
|
|
181172
|
-
const azimuthDeg = normalizeAzimuth(view3D?.rotY ?? DEFAULT_AZIMUTH_DEG);
|
|
181173
|
-
const phi = (90 - elevationDeg) * Math.PI / 180;
|
|
181174
|
-
const theta = azimuthDeg * Math.PI / 180;
|
|
181175
|
-
const sinPhi = Math.sin(phi);
|
|
181176
|
-
return {
|
|
181177
|
-
position: [
|
|
181178
|
-
radius * sinPhi * Math.sin(theta),
|
|
181179
|
-
radius * Math.cos(phi) + target[1],
|
|
181180
|
-
radius * sinPhi * Math.cos(theta)
|
|
181181
|
-
],
|
|
181182
|
-
target,
|
|
181183
|
-
fov
|
|
181184
|
-
};
|
|
181185
|
-
}
|
|
181186
|
-
function computeCartesianCameraPlacement(cols, rows, view3D, horizontal = false) {
|
|
181187
|
-
const { gridWidth, gridDepth } = computeCartesianGridExtent(cols, rows, view3D?.depthPercent);
|
|
181188
|
-
const maxExtent = Math.max(gridWidth, gridDepth, MAX_VALUE_HEIGHT);
|
|
181189
|
-
const placement = computeSphericalCameraPlacement(maxExtent, MAX_VALUE_HEIGHT * 0.2, view3D);
|
|
181190
|
-
if (!horizontal) {
|
|
181191
|
-
return placement;
|
|
181192
|
-
}
|
|
181193
|
-
return {
|
|
181194
|
-
...placement,
|
|
181195
|
-
position: transposeForHorizontalBar3D(placement.position),
|
|
181196
|
-
target: transposeForHorizontalBar3D(placement.target)
|
|
181197
|
-
};
|
|
181198
|
-
}
|
|
181199
|
-
function buildCartesianChart3DLabels(cols, rows, categoryLabels, seriesNames, depthPercent, maxCat = 8, maxSer = 6, horizontal = false) {
|
|
181200
|
-
const { gridWidth, gridDepth } = computeCartesianGridExtent(cols, rows, depthPercent);
|
|
181201
|
-
const labels = [];
|
|
181202
|
-
const remap = (anchor) => horizontal ? transposeForHorizontalBar3D(anchor) : anchor;
|
|
181203
|
-
const catStep = Math.max(1, Math.ceil(categoryLabels.length / maxCat));
|
|
181204
|
-
for (let i2 = 0; i2 < categoryLabels.length; i2 += catStep) {
|
|
181205
|
-
const x = -gridWidth / 2 + i2 / Math.max(cols - 1, 1) * gridWidth;
|
|
181206
|
-
labels.push({
|
|
181207
|
-
key: `cat-${i2}`,
|
|
181208
|
-
text: categoryLabels[i2],
|
|
181209
|
-
anchor: remap([x, -0.15, gridDepth / 2 + 0.25]),
|
|
181210
|
-
axis: "category"
|
|
181211
|
-
});
|
|
181212
|
-
}
|
|
181213
|
-
const serStep = Math.max(1, Math.ceil(seriesNames.length / maxSer));
|
|
181214
|
-
for (let i2 = 0; i2 < seriesNames.length; i2 += serStep) {
|
|
181215
|
-
const z = -gridDepth / 2 + i2 / Math.max(rows - 1, 1) * gridDepth;
|
|
181216
|
-
labels.push({
|
|
181217
|
-
key: `ser-${i2}`,
|
|
181218
|
-
text: seriesNames[i2],
|
|
181219
|
-
anchor: remap([gridWidth / 2 + 0.3, -0.15, z]),
|
|
181220
|
-
axis: "series"
|
|
181221
|
-
});
|
|
181222
|
-
}
|
|
181223
|
-
return labels;
|
|
181224
|
-
}
|
|
181225
|
-
var GRID_SPACING;
|
|
181226
|
-
var MAX_VALUE_HEIGHT;
|
|
181227
|
-
var DEFAULT_ELEVATION_DEG;
|
|
181228
|
-
var DEFAULT_AZIMUTH_DEG;
|
|
181229
|
-
var DEFAULT_PERSPECTIVE_DEG;
|
|
181230
|
-
var FOV_MIN;
|
|
181231
|
-
var FOV_MAX;
|
|
181232
|
-
var RIGHT_ANGLE_FOV;
|
|
181233
|
-
var PERSPECTIVE_MAX_DEG;
|
|
181234
|
-
var init_cartesian_chart_3d_geom = __esm2({
|
|
181235
|
-
"src/render/cartesian-chart-3d-geom.ts"() {
|
|
181236
|
-
GRID_SPACING = 0.5;
|
|
181237
|
-
MAX_VALUE_HEIGHT = 1.5;
|
|
181238
|
-
DEFAULT_ELEVATION_DEG = 15;
|
|
181239
|
-
DEFAULT_AZIMUTH_DEG = 20;
|
|
181240
|
-
DEFAULT_PERSPECTIVE_DEG = 30;
|
|
181241
|
-
FOV_MIN = 15;
|
|
181242
|
-
FOV_MAX = 75;
|
|
181243
|
-
RIGHT_ANGLE_FOV = 20;
|
|
181244
|
-
PERSPECTIVE_MAX_DEG = 120;
|
|
181245
|
-
}
|
|
181246
|
-
});
|
|
181247
|
-
function normalizeToHeight(value, range) {
|
|
181248
|
-
if (range.span <= 0) {
|
|
181249
|
-
return 0;
|
|
181250
|
-
}
|
|
181251
|
-
return (value - range.min) / range.span * MAX_VALUE_HEIGHT;
|
|
181252
|
-
}
|
|
181253
|
-
function layoutCartesianLine3DSeries(points4, cols, rows, range, depthPercent) {
|
|
181254
|
-
const { gridWidth, gridDepth } = computeCartesianGridExtent(cols, rows, depthPercent);
|
|
181255
|
-
const rowStep = gridDepth / Math.max(rows, 1);
|
|
181256
|
-
const baselineY = normalizeToHeight(0, range);
|
|
181257
|
-
const bySeries = /* @__PURE__ */ new Map();
|
|
181258
|
-
for (const p of points4) {
|
|
181259
|
-
const list2 = bySeries.get(p.seriesIndex);
|
|
181260
|
-
if (list2) {
|
|
181261
|
-
list2.push(p);
|
|
181262
|
-
} else {
|
|
181263
|
-
bySeries.set(p.seriesIndex, [p]);
|
|
181264
|
-
}
|
|
181265
|
-
}
|
|
181266
|
-
const paths = [];
|
|
181267
|
-
for (const [seriesIndex, seriesPoints] of bySeries) {
|
|
181268
|
-
const sorted = [...seriesPoints].sort((a, b) => a.categoryIndex - b.categoryIndex);
|
|
181269
|
-
const z = -gridDepth / 2 + rowStep * (seriesIndex + 0.5);
|
|
181270
|
-
const vertices = sorted.map((p) => {
|
|
181271
|
-
const x = -gridWidth / 2 + p.categoryIndex / Math.max(cols - 1, 1) * gridWidth;
|
|
181272
|
-
const y = normalizeToHeight(p.value, range);
|
|
181273
|
-
return {
|
|
181274
|
-
seriesIndex,
|
|
181275
|
-
categoryIndex: p.categoryIndex,
|
|
181276
|
-
value: p.value,
|
|
181277
|
-
position: [x, y, z]
|
|
181278
|
-
};
|
|
181279
|
-
});
|
|
181280
|
-
paths.push({
|
|
181281
|
-
seriesIndex,
|
|
181282
|
-
color: sorted[0]?.color ?? "#4472C4",
|
|
181283
|
-
vertices,
|
|
181284
|
-
depthZ: z,
|
|
181285
|
-
baselineY
|
|
181286
|
-
});
|
|
181287
|
-
}
|
|
181288
|
-
return paths.sort((a, b) => a.seriesIndex - b.seriesIndex);
|
|
181289
|
-
}
|
|
181290
|
-
function buildAreaRibbonTriangles(path) {
|
|
181291
|
-
const { vertices, baselineY } = path;
|
|
181292
|
-
const out = [];
|
|
181293
|
-
for (let i2 = 0; i2 < vertices.length - 1; i2++) {
|
|
181294
|
-
const [x1, y1, z1] = vertices[i2].position;
|
|
181295
|
-
const [x2, y2, z2] = vertices[i2 + 1].position;
|
|
181296
|
-
out.push(x1, y1, z1, x1, baselineY, z1, x2, baselineY, z2);
|
|
181297
|
-
out.push(x1, y1, z1, x2, baselineY, z2, x2, y2, z2);
|
|
181298
|
-
}
|
|
181299
|
-
return out;
|
|
181300
|
-
}
|
|
181301
|
-
var init_cartesian_line_chart_3d_layout = __esm2({
|
|
181302
|
-
"src/render/cartesian-line-chart-3d-layout.ts"() {
|
|
181303
|
-
init_cartesian_chart_3d_geom();
|
|
181304
|
-
}
|
|
181305
|
-
});
|
|
181306
181155
|
function formatValueLabel(chartData, grouping, v) {
|
|
181307
181156
|
if (grouping === "percentStacked") {
|
|
181308
181157
|
return `${Math.round(v * 100)}%`;
|
|
@@ -181705,1197 +181554,6 @@ var init_chart_3d_pie_layout = __esm2({
|
|
|
181705
181554
|
RIM_SAMPLES = 96;
|
|
181706
181555
|
}
|
|
181707
181556
|
});
|
|
181708
|
-
function computePieChart3DThickness(view3D) {
|
|
181709
|
-
const scale2 = Math.min(
|
|
181710
|
-
Math.max((view3D?.hPercent ?? 100) / 100, MIN_THICKNESS_SCALE),
|
|
181711
|
-
MAX_THICKNESS_SCALE
|
|
181712
|
-
);
|
|
181713
|
-
return PIE_RADIUS * BASE_THICKNESS_RATIO * scale2;
|
|
181714
|
-
}
|
|
181715
|
-
function computePieChart3DCameraPlacement(view3D) {
|
|
181716
|
-
const thickness = computePieChart3DThickness(view3D);
|
|
181717
|
-
const maxExtent = PIE_RADIUS * CAMERA_EXTENT_MARGIN;
|
|
181718
|
-
return computeSphericalCameraPlacement(maxExtent, thickness / 2, view3D);
|
|
181719
|
-
}
|
|
181720
|
-
function computePieChart3DSliceAngles(values, explosions, firstSliceAngleDeg, outerRadius) {
|
|
181721
|
-
const total = values.reduce((s, v) => s + Math.abs(v), 0) || 1;
|
|
181722
|
-
let cumAngle = -Math.PI / 2 + (firstSliceAngleDeg ?? 0) * Math.PI / 180;
|
|
181723
|
-
return values.map((value, pointIndex) => {
|
|
181724
|
-
const sliceAngle = Math.abs(value) / total * Math.PI * 2;
|
|
181725
|
-
const startAngle = cumAngle;
|
|
181726
|
-
cumAngle += sliceAngle;
|
|
181727
|
-
const explosion = explosions?.[pointIndex] ?? 0;
|
|
181728
|
-
let explodeOffset = [0, 0];
|
|
181729
|
-
if (explosion > 0) {
|
|
181730
|
-
const mid = (startAngle + cumAngle) / 2;
|
|
181731
|
-
const offset = outerRadius * (explosion / 100);
|
|
181732
|
-
explodeOffset = [Math.cos(mid) * offset, Math.sin(mid) * offset];
|
|
181733
|
-
}
|
|
181734
|
-
return { pointIndex, value, startAngle, thetaLength: sliceAngle, explodeOffset };
|
|
181735
|
-
});
|
|
181736
|
-
}
|
|
181737
|
-
var PIE_RADIUS;
|
|
181738
|
-
var BASE_THICKNESS_RATIO;
|
|
181739
|
-
var MIN_THICKNESS_SCALE;
|
|
181740
|
-
var MAX_THICKNESS_SCALE;
|
|
181741
|
-
var CAMERA_EXTENT_MARGIN;
|
|
181742
|
-
var init_pie_chart_3d_geom = __esm2({
|
|
181743
|
-
"src/render/pie-chart-3d-geom.ts"() {
|
|
181744
|
-
init_cartesian_chart_3d_geom();
|
|
181745
|
-
PIE_RADIUS = 1;
|
|
181746
|
-
BASE_THICKNESS_RATIO = 0.3;
|
|
181747
|
-
MIN_THICKNESS_SCALE = 0.05;
|
|
181748
|
-
MAX_THICKNESS_SCALE = 3;
|
|
181749
|
-
CAMERA_EXTENT_MARGIN = 1.35;
|
|
181750
|
-
}
|
|
181751
|
-
});
|
|
181752
|
-
function computeGridExtent(cols, rows) {
|
|
181753
|
-
return {
|
|
181754
|
-
gridWidth: Math.max(cols - 1, 1) * GRID_SPACING2,
|
|
181755
|
-
gridDepth: Math.max(rows - 1, 1) * GRID_SPACING2
|
|
181756
|
-
};
|
|
181757
|
-
}
|
|
181758
|
-
function buildSurfaceGeometry(three, cols, rows, heightMap, colorMap) {
|
|
181759
|
-
const widthSegs = Math.max(cols - 1, 0);
|
|
181760
|
-
const depthSegs = Math.max(rows - 1, 0);
|
|
181761
|
-
const { gridWidth, gridDepth } = computeGridExtent(cols, rows);
|
|
181762
|
-
const geo = new three.PlaneGeometry(gridWidth, gridDepth, widthSegs, depthSegs);
|
|
181763
|
-
geo.rotateX(-Math.PI / 2);
|
|
181764
|
-
const pos2 = geo.attributes.position;
|
|
181765
|
-
const vertexCount = pos2.count;
|
|
181766
|
-
const colors = new Float32Array(vertexCount * 3);
|
|
181767
|
-
for (let i2 = 0; i2 < vertexCount; i2++) {
|
|
181768
|
-
const row = Math.floor(i2 / cols);
|
|
181769
|
-
const col = i2 % cols;
|
|
181770
|
-
const idx = row * cols + col;
|
|
181771
|
-
const h2 = idx < heightMap.length ? heightMap[idx] : 0;
|
|
181772
|
-
pos2.setY(i2, h2 * MAX_HEIGHT);
|
|
181773
|
-
const ci = idx * 3;
|
|
181774
|
-
colors[i2 * 3] = ci < colorMap.length ? colorMap[ci] : 0.5;
|
|
181775
|
-
colors[i2 * 3 + 1] = ci + 1 < colorMap.length ? colorMap[ci + 1] : 0.5;
|
|
181776
|
-
colors[i2 * 3 + 2] = ci + 2 < colorMap.length ? colorMap[ci + 2] : 0.5;
|
|
181777
|
-
}
|
|
181778
|
-
geo.setAttribute("color", new three.BufferAttribute(colors, 3));
|
|
181779
|
-
geo.computeVertexNormals();
|
|
181780
|
-
pos2.needsUpdate = true;
|
|
181781
|
-
const wireGeometry = new three.WireframeGeometry(geo);
|
|
181782
|
-
return { geometry: geo, wireGeometry };
|
|
181783
|
-
}
|
|
181784
|
-
function surfaceVertexWorldPosition(cols, rows, row, col, heightMap) {
|
|
181785
|
-
const { gridWidth, gridDepth } = computeGridExtent(cols, rows);
|
|
181786
|
-
const x = col * GRID_SPACING2 - gridWidth / 2;
|
|
181787
|
-
const z = row * GRID_SPACING2 - gridDepth / 2;
|
|
181788
|
-
const idx = row * cols + col;
|
|
181789
|
-
const h2 = idx >= 0 && idx < heightMap.length ? heightMap[idx] : 0;
|
|
181790
|
-
return [x, h2 * MAX_HEIGHT, z];
|
|
181791
|
-
}
|
|
181792
|
-
function buildSurfaceLabels(cols, rows, categoryLabels, seriesNames, maxCat = 8, maxSer = 6) {
|
|
181793
|
-
const { gridWidth, gridDepth } = computeGridExtent(cols, rows);
|
|
181794
|
-
const labels = [];
|
|
181795
|
-
const catStep = Math.max(1, Math.ceil(categoryLabels.length / maxCat));
|
|
181796
|
-
for (let i2 = 0; i2 < categoryLabels.length; i2 += catStep) {
|
|
181797
|
-
const x = -gridWidth / 2 + i2 / Math.max(cols - 1, 1) * gridWidth;
|
|
181798
|
-
labels.push({
|
|
181799
|
-
key: `cat-${i2}`,
|
|
181800
|
-
text: categoryLabels[i2],
|
|
181801
|
-
anchor: [x, -0.15, gridDepth / 2 + 0.25],
|
|
181802
|
-
axis: "category"
|
|
181803
|
-
});
|
|
181804
|
-
}
|
|
181805
|
-
const serStep = Math.max(1, Math.ceil(seriesNames.length / maxSer));
|
|
181806
|
-
for (let i2 = 0; i2 < seriesNames.length; i2 += serStep) {
|
|
181807
|
-
const z = -gridDepth / 2 + i2 / Math.max(rows - 1, 1) * gridDepth;
|
|
181808
|
-
labels.push({
|
|
181809
|
-
key: `ser-${i2}`,
|
|
181810
|
-
text: seriesNames[i2],
|
|
181811
|
-
anchor: [gridWidth / 2 + 0.3, -0.15, z],
|
|
181812
|
-
axis: "series"
|
|
181813
|
-
});
|
|
181814
|
-
}
|
|
181815
|
-
labels.push({
|
|
181816
|
-
key: "value-axis",
|
|
181817
|
-
text: "Value",
|
|
181818
|
-
anchor: [-gridWidth / 2 - 0.35, 0.75, -gridDepth / 2],
|
|
181819
|
-
axis: "value"
|
|
181820
|
-
});
|
|
181821
|
-
return labels;
|
|
181822
|
-
}
|
|
181823
|
-
function clamp9(value, min, max) {
|
|
181824
|
-
return Math.min(Math.max(value, min), max);
|
|
181825
|
-
}
|
|
181826
|
-
function normalizeAzimuth2(deg3) {
|
|
181827
|
-
const wrapped = deg3 % 360;
|
|
181828
|
-
return wrapped < 0 ? wrapped + 360 : wrapped;
|
|
181829
|
-
}
|
|
181830
|
-
function computeCameraPlacement(cols, rows, view3D) {
|
|
181831
|
-
const { gridWidth, gridDepth } = computeGridExtent(cols, rows);
|
|
181832
|
-
const maxExtent = Math.max(gridWidth, gridDepth, MAX_HEIGHT);
|
|
181833
|
-
const dist2 = maxExtent * 1.8;
|
|
181834
|
-
const target = [0, 0.3, 0];
|
|
181835
|
-
if (!view3D || view3D.rotX === void 0 && view3D.rotY === void 0) {
|
|
181836
|
-
return { position: [dist2 * 0.8, dist2 * 0.7, dist2 * 0.8], target };
|
|
181837
|
-
}
|
|
181838
|
-
const radius = dist2 * RADIUS_FACTOR;
|
|
181839
|
-
const elevationDeg = clamp9(view3D.rotX ?? DEFAULT_ELEVATION_DEG2, -89, 89);
|
|
181840
|
-
const azimuthDeg = normalizeAzimuth2(view3D.rotY ?? DEFAULT_AZIMUTH_DEG2);
|
|
181841
|
-
const phi = (90 - elevationDeg) * Math.PI / 180;
|
|
181842
|
-
const theta = azimuthDeg * Math.PI / 180;
|
|
181843
|
-
const sinPhi = Math.sin(phi);
|
|
181844
|
-
return {
|
|
181845
|
-
position: [
|
|
181846
|
-
radius * sinPhi * Math.sin(theta),
|
|
181847
|
-
radius * Math.cos(phi),
|
|
181848
|
-
radius * sinPhi * Math.cos(theta)
|
|
181849
|
-
],
|
|
181850
|
-
target
|
|
181851
|
-
};
|
|
181852
|
-
}
|
|
181853
|
-
var GRID_SPACING2;
|
|
181854
|
-
var MAX_HEIGHT;
|
|
181855
|
-
var DEFAULT_ELEVATION_DEG2;
|
|
181856
|
-
var DEFAULT_AZIMUTH_DEG2;
|
|
181857
|
-
var RADIUS_FACTOR;
|
|
181858
|
-
var init_surface_chart_3d_geom = __esm2({
|
|
181859
|
-
"src/render/surface-chart-3d-geom.ts"() {
|
|
181860
|
-
GRID_SPACING2 = 0.5;
|
|
181861
|
-
MAX_HEIGHT = 1.5;
|
|
181862
|
-
DEFAULT_ELEVATION_DEG2 = 15;
|
|
181863
|
-
DEFAULT_AZIMUTH_DEG2 = 20;
|
|
181864
|
-
RADIUS_FACTOR = Math.sqrt(0.8 ** 2 + 0.7 ** 2 + 0.8 ** 2);
|
|
181865
|
-
}
|
|
181866
|
-
});
|
|
181867
|
-
function createHostedChart3DStage(ctx, placement, limits, ambientIntensity = 0.6) {
|
|
181868
|
-
const three = ctx.three;
|
|
181869
|
-
const width = Math.max(1, ctx.size.width);
|
|
181870
|
-
const height = Math.max(1, ctx.size.height);
|
|
181871
|
-
const scene = new three.Scene();
|
|
181872
|
-
scene.add(new three.AmbientLight(16777215, ambientIntensity));
|
|
181873
|
-
const key2 = new three.DirectionalLight(16777215, 0.8);
|
|
181874
|
-
key2.position.set(5, 8, 5);
|
|
181875
|
-
scene.add(key2);
|
|
181876
|
-
const fill = new three.DirectionalLight(16777215, 0.3);
|
|
181877
|
-
fill.position.set(-3, 4, -2);
|
|
181878
|
-
scene.add(fill);
|
|
181879
|
-
const camera = new three.PerspectiveCamera(placement.fov, width / height, 0.1, 1e3);
|
|
181880
|
-
camera.position.set(...placement.position);
|
|
181881
|
-
const target = new three.Vector3(...placement.target);
|
|
181882
|
-
camera.lookAt(target);
|
|
181883
|
-
let orbit = null;
|
|
181884
|
-
if (ctx.OrbitControls) {
|
|
181885
|
-
orbit = new ctx.OrbitControls(camera, ctx.eventTarget);
|
|
181886
|
-
const limited = orbit;
|
|
181887
|
-
limited.enablePan = true;
|
|
181888
|
-
limited.enableZoom = true;
|
|
181889
|
-
limited.enableRotate = true;
|
|
181890
|
-
limited.minDistance = limits.minDistance;
|
|
181891
|
-
limited.maxDistance = limits.maxDistance;
|
|
181892
|
-
limited.maxPolarAngle = Math.PI / 2 + 0.3;
|
|
181893
|
-
limited.target.copy(target);
|
|
181894
|
-
limited.enabled = ctx.interactive;
|
|
181895
|
-
limited.update();
|
|
181896
|
-
}
|
|
181897
|
-
return {
|
|
181898
|
-
three,
|
|
181899
|
-
canvas: ctx.eventTarget,
|
|
181900
|
-
scene,
|
|
181901
|
-
camera,
|
|
181902
|
-
controls: orbit ?? { enabled: false },
|
|
181903
|
-
orbit,
|
|
181904
|
-
width,
|
|
181905
|
-
height
|
|
181906
|
-
};
|
|
181907
|
-
}
|
|
181908
|
-
function hostedChart3DInteraction(ctx) {
|
|
181909
|
-
let interactive = ctx.interactive;
|
|
181910
|
-
return {
|
|
181911
|
-
onSelect: (part) => {
|
|
181912
|
-
if (interactive) {
|
|
181913
|
-
ctx.emit({ type: "select", part });
|
|
181914
|
-
}
|
|
181915
|
-
},
|
|
181916
|
-
onValueDragPreview: (part, value) => {
|
|
181917
|
-
if (interactive) {
|
|
181918
|
-
ctx.emit({ type: "drag", detail: { part, value, phase: "move" } });
|
|
181919
|
-
}
|
|
181920
|
-
},
|
|
181921
|
-
onValueDragCommit: (part, value) => {
|
|
181922
|
-
if (interactive) {
|
|
181923
|
-
ctx.emit({ type: "drag", detail: { part, value, phase: "commit" } });
|
|
181924
|
-
}
|
|
181925
|
-
},
|
|
181926
|
-
set: (on) => {
|
|
181927
|
-
interactive = on;
|
|
181928
|
-
}
|
|
181929
|
-
};
|
|
181930
|
-
}
|
|
181931
|
-
function finishHostedChart3DScene(ctx, stage, parts, interactive) {
|
|
181932
|
-
let width = stage.width;
|
|
181933
|
-
let height = stage.height;
|
|
181934
|
-
const requestRender = () => ctx.requestRender();
|
|
181935
|
-
stage.orbit?.addEventListener("change", requestRender);
|
|
181936
|
-
for (const type of REDRAW_EVENTS) {
|
|
181937
|
-
ctx.eventTarget.addEventListener(type, requestRender);
|
|
181938
|
-
}
|
|
181939
|
-
let disposed = false;
|
|
181940
|
-
return {
|
|
181941
|
-
render(renderer) {
|
|
181942
|
-
stage.orbit?.update();
|
|
181943
|
-
renderer.render(stage.scene, stage.camera);
|
|
181944
|
-
parts.afterRender?.(stage.camera, width, height);
|
|
181945
|
-
},
|
|
181946
|
-
resize(size) {
|
|
181947
|
-
width = Math.max(1, size.width);
|
|
181948
|
-
height = Math.max(1, size.height);
|
|
181949
|
-
stage.camera.aspect = width / height;
|
|
181950
|
-
stage.camera.updateProjectionMatrix();
|
|
181951
|
-
parts.resize?.(width, height);
|
|
181952
|
-
},
|
|
181953
|
-
isAnimating: () => false,
|
|
181954
|
-
setInteractive(on) {
|
|
181955
|
-
interactive.set(on);
|
|
181956
|
-
if (stage.orbit) {
|
|
181957
|
-
stage.orbit.enabled = on;
|
|
181958
|
-
}
|
|
181959
|
-
},
|
|
181960
|
-
setSelectedPart(part) {
|
|
181961
|
-
parts.setSelectedPart?.(part);
|
|
181962
|
-
},
|
|
181963
|
-
setTextStyle(style) {
|
|
181964
|
-
parts.setTextStyle?.(style);
|
|
181965
|
-
},
|
|
181966
|
-
dispose() {
|
|
181967
|
-
if (disposed) {
|
|
181968
|
-
return;
|
|
181969
|
-
}
|
|
181970
|
-
disposed = true;
|
|
181971
|
-
stage.orbit?.removeEventListener("change", requestRender);
|
|
181972
|
-
for (const type of REDRAW_EVENTS) {
|
|
181973
|
-
ctx.eventTarget.removeEventListener(type, requestRender);
|
|
181974
|
-
}
|
|
181975
|
-
stage.orbit?.dispose();
|
|
181976
|
-
parts.dispose();
|
|
181977
|
-
stage.scene.clear();
|
|
181978
|
-
}
|
|
181979
|
-
};
|
|
181980
|
-
}
|
|
181981
|
-
var REDRAW_EVENTS;
|
|
181982
|
-
var init_chart_3d_hosted_stage = __esm2({
|
|
181983
|
-
"src/render/chart-3d-hosted-stage.ts"() {
|
|
181984
|
-
REDRAW_EVENTS = ["pointermove", "pointerdown", "pointerup", "pointerleave", "wheel"];
|
|
181985
|
-
}
|
|
181986
|
-
});
|
|
181987
|
-
function attachChart3DHoverTooltip(options) {
|
|
181988
|
-
const raycaster = new options.three.Raycaster();
|
|
181989
|
-
const ndc = new options.three.Vector2();
|
|
181990
|
-
let hoveredTooltip;
|
|
181991
|
-
const updateHoverTooltip = (clientX, clientY) => {
|
|
181992
|
-
const rect22 = options.canvas.getBoundingClientRect();
|
|
181993
|
-
if (rect22.width <= 0 || rect22.height <= 0) {
|
|
181994
|
-
return;
|
|
181995
|
-
}
|
|
181996
|
-
ndc.x = (clientX - rect22.left) / rect22.width * 2 - 1;
|
|
181997
|
-
ndc.y = -((clientY - rect22.top) / rect22.height) * 2 + 1;
|
|
181998
|
-
raycaster.setFromCamera(ndc, options.camera);
|
|
181999
|
-
const hit = raycaster.intersectObjects(options.meshes, false)[0];
|
|
182000
|
-
const tooltip = options.buildTooltip(hit);
|
|
182001
|
-
if (tooltip !== hoveredTooltip) {
|
|
182002
|
-
hoveredTooltip = tooltip;
|
|
182003
|
-
options.canvas.title = tooltip ?? "";
|
|
182004
|
-
}
|
|
182005
|
-
};
|
|
182006
|
-
const onPointerMove = (event) => {
|
|
182007
|
-
updateHoverTooltip(event.clientX, event.clientY);
|
|
182008
|
-
};
|
|
182009
|
-
const onPointerLeave = () => {
|
|
182010
|
-
if (hoveredTooltip !== void 0) {
|
|
182011
|
-
hoveredTooltip = void 0;
|
|
182012
|
-
options.canvas.title = "";
|
|
182013
|
-
}
|
|
182014
|
-
};
|
|
182015
|
-
options.canvas.addEventListener("pointermove", onPointerMove);
|
|
182016
|
-
options.canvas.addEventListener("pointerleave", onPointerLeave);
|
|
182017
|
-
return {
|
|
182018
|
-
dispose() {
|
|
182019
|
-
options.canvas.removeEventListener("pointermove", onPointerMove);
|
|
182020
|
-
options.canvas.removeEventListener("pointerleave", onPointerLeave);
|
|
182021
|
-
}
|
|
182022
|
-
};
|
|
182023
|
-
}
|
|
182024
|
-
var init_chart_3d_hover_tooltip = __esm2({
|
|
182025
|
-
"src/render/chart-3d-hover-tooltip.ts"() {
|
|
182026
|
-
}
|
|
182027
|
-
});
|
|
182028
|
-
function createLabelOverlay(doc, labels) {
|
|
182029
|
-
const layer = doc.createElement("div");
|
|
182030
|
-
Object.assign(layer.style, {
|
|
182031
|
-
position: "absolute",
|
|
182032
|
-
inset: "0",
|
|
182033
|
-
pointerEvents: "none",
|
|
182034
|
-
overflow: "hidden"
|
|
182035
|
-
});
|
|
182036
|
-
const entries2 = labels.map((label) => {
|
|
182037
|
-
const node = doc.createElement("div");
|
|
182038
|
-
node.textContent = label.text;
|
|
182039
|
-
const baseColor = label.axis === "value" ? "#999" : "#666";
|
|
182040
|
-
Object.assign(node.style, {
|
|
182041
|
-
position: "absolute",
|
|
182042
|
-
fontSize: `${BASE_FONT_SIZE_PX}px`,
|
|
182043
|
-
color: baseColor,
|
|
182044
|
-
whiteSpace: "nowrap",
|
|
182045
|
-
userSelect: "none",
|
|
182046
|
-
transform: "translate(-50%, -50%)",
|
|
182047
|
-
willChange: "left, top"
|
|
182048
|
-
});
|
|
182049
|
-
if (label.axis === "value") {
|
|
182050
|
-
node.style.writingMode = "vertical-rl";
|
|
182051
|
-
}
|
|
182052
|
-
layer.appendChild(node);
|
|
182053
|
-
return { node, baseColor };
|
|
182054
|
-
});
|
|
182055
|
-
function applyTextStyle(style) {
|
|
182056
|
-
for (const { node, baseColor } of entries2) {
|
|
182057
|
-
node.style.fontWeight = style?.bold === void 0 ? "" : style.bold ? "bold" : "normal";
|
|
182058
|
-
node.style.fontStyle = style?.italic === void 0 ? "" : style.italic ? "italic" : "normal";
|
|
182059
|
-
node.style.textDecorationLine = style?.underline === void 0 ? "" : style.underline ? "underline" : "none";
|
|
182060
|
-
const scale2 = typeof style?.fontScale === "number" && Number.isFinite(style.fontScale) && style.fontScale > 0 ? style.fontScale : 1;
|
|
182061
|
-
node.style.fontSize = `${BASE_FONT_SIZE_PX * scale2}px`;
|
|
182062
|
-
node.style.color = style?.color ?? baseColor;
|
|
182063
|
-
}
|
|
182064
|
-
}
|
|
182065
|
-
return { layer, nodes: entries2.map((e) => e.node), applyTextStyle };
|
|
182066
|
-
}
|
|
182067
|
-
var BASE_FONT_SIZE_PX;
|
|
182068
|
-
var init_surface_chart_3d_label_overlay = __esm2({
|
|
182069
|
-
"src/render/surface-chart-3d-label-overlay.ts"() {
|
|
182070
|
-
BASE_FONT_SIZE_PX = 9;
|
|
182071
|
-
}
|
|
182072
|
-
});
|
|
182073
|
-
function createChart3DLabelProjector(three, doc, labels) {
|
|
182074
|
-
const overlay = createLabelOverlay(doc, labels);
|
|
182075
|
-
const anchors = labels.map((l) => new three.Vector3(...l.anchor));
|
|
182076
|
-
const projected = new three.Vector3();
|
|
182077
|
-
return {
|
|
182078
|
-
layer: overlay.layer,
|
|
182079
|
-
applyTextStyle: overlay.applyTextStyle,
|
|
182080
|
-
update(camera, width, height) {
|
|
182081
|
-
for (let i2 = 0; i2 < overlay.nodes.length; i2++) {
|
|
182082
|
-
projected.copy(anchors[i2]).project(camera);
|
|
182083
|
-
const node = overlay.nodes[i2];
|
|
182084
|
-
if (projected.z > 1) {
|
|
182085
|
-
node.style.display = "none";
|
|
182086
|
-
continue;
|
|
182087
|
-
}
|
|
182088
|
-
node.style.display = "";
|
|
182089
|
-
node.style.left = `${(projected.x + 1) / 2 * width}px`;
|
|
182090
|
-
node.style.top = `${(-projected.y + 1) / 2 * height}px`;
|
|
182091
|
-
}
|
|
182092
|
-
}
|
|
182093
|
-
};
|
|
182094
|
-
}
|
|
182095
|
-
var init_chart_3d_label_projection = __esm2({
|
|
182096
|
-
"src/render/chart-3d-label-projection.ts"() {
|
|
182097
|
-
init_surface_chart_3d_label_overlay();
|
|
182098
|
-
}
|
|
182099
|
-
});
|
|
182100
|
-
function surfaceFaceIndexToCell(faceIndex, cols, rows) {
|
|
182101
|
-
const quadsPerRow = cols - 1;
|
|
182102
|
-
const quadsPerCol = rows - 1;
|
|
182103
|
-
if (!Number.isFinite(faceIndex) || faceIndex < 0 || quadsPerRow <= 0 || quadsPerCol <= 0) {
|
|
182104
|
-
return null;
|
|
182105
|
-
}
|
|
182106
|
-
const quadIndex = Math.floor(faceIndex / 2);
|
|
182107
|
-
const row = Math.floor(quadIndex / quadsPerRow);
|
|
182108
|
-
const col = quadIndex % quadsPerRow;
|
|
182109
|
-
if (row < 0 || row >= quadsPerCol || col < 0 || col >= quadsPerRow) {
|
|
182110
|
-
return null;
|
|
182111
|
-
}
|
|
182112
|
-
return { row, col };
|
|
182113
|
-
}
|
|
182114
|
-
function buildSurfaceHoverTooltip(faceIndex, data) {
|
|
182115
|
-
if (faceIndex === void 0 || faceIndex === null || !data.values) {
|
|
182116
|
-
return void 0;
|
|
182117
|
-
}
|
|
182118
|
-
const cell = surfaceFaceIndexToCell(faceIndex, data.cols, data.rows);
|
|
182119
|
-
if (!cell) {
|
|
182120
|
-
return void 0;
|
|
182121
|
-
}
|
|
182122
|
-
const idx = cell.row * data.cols + cell.col;
|
|
182123
|
-
const value = data.values[idx];
|
|
182124
|
-
if (value === void 0) {
|
|
182125
|
-
return void 0;
|
|
182126
|
-
}
|
|
182127
|
-
return buildMarkTooltip(
|
|
182128
|
-
data.seriesNames[cell.row],
|
|
182129
|
-
data.categoryLabels[cell.col],
|
|
182130
|
-
value,
|
|
182131
|
-
data.numberFormats?.[cell.row]
|
|
182132
|
-
);
|
|
182133
|
-
}
|
|
182134
|
-
var init_surface_chart_3d_hit_test = __esm2({
|
|
182135
|
-
"src/render/surface-chart-3d-hit-test.ts"() {
|
|
182136
|
-
init_chart_view_model();
|
|
182137
|
-
}
|
|
182138
|
-
});
|
|
182139
|
-
function chart3DHitToPartRef(hit) {
|
|
182140
|
-
if (!hit) {
|
|
182141
|
-
return null;
|
|
182142
|
-
}
|
|
182143
|
-
return { role: "dataPoint", seriesIndex: hit.seriesIndex, pointIndex: hit.pointIndex };
|
|
182144
|
-
}
|
|
182145
|
-
function chart3DMarkMatchesPart(mark, part) {
|
|
182146
|
-
return part !== null && part !== void 0 && part.role === "dataPoint" && part.seriesIndex === mark.seriesIndex && part.pointIndex === mark.pointIndex;
|
|
182147
|
-
}
|
|
182148
|
-
function calibrateChart3DValueAxis(screenAtValue0, value0, screenAtValue1, value1) {
|
|
182149
|
-
const valueSpan = value1 - value0;
|
|
182150
|
-
const dx = screenAtValue1.x - screenAtValue0.x;
|
|
182151
|
-
const dy = screenAtValue1.y - screenAtValue0.y;
|
|
182152
|
-
const pixelSpan = Math.hypot(dx, dy);
|
|
182153
|
-
if (valueSpan === 0 || pixelSpan < 1e-6 || !Number.isFinite(valueSpan)) {
|
|
182154
|
-
return null;
|
|
182155
|
-
}
|
|
182156
|
-
return {
|
|
182157
|
-
directionScreen: { x: dx / pixelSpan, y: dy / pixelSpan },
|
|
182158
|
-
pixelsPerUnit: pixelSpan / valueSpan
|
|
182159
|
-
};
|
|
182160
|
-
}
|
|
182161
|
-
function chart3DPointerDeltaToValueDelta(calibration, pointerDeltaScreen) {
|
|
182162
|
-
const dot2 = pointerDeltaScreen.x * calibration.directionScreen.x + pointerDeltaScreen.y * calibration.directionScreen.y;
|
|
182163
|
-
return dot2 / calibration.pixelsPerUnit;
|
|
182164
|
-
}
|
|
182165
|
-
var CHART_3D_DRAG_THRESHOLD_PX;
|
|
182166
|
-
var CHART_3D_SELECTED_EMISSIVE;
|
|
182167
|
-
var CHART_3D_SELECTED_EMISSIVE_INTENSITY;
|
|
182168
|
-
var init_chart_3d_interaction = __esm2({
|
|
182169
|
-
"src/render/chart-3d-interaction.ts"() {
|
|
182170
|
-
CHART_3D_DRAG_THRESHOLD_PX = 3;
|
|
182171
|
-
CHART_3D_SELECTED_EMISSIVE = "#3b82f6";
|
|
182172
|
-
CHART_3D_SELECTED_EMISSIVE_INTENSITY = 0.55;
|
|
182173
|
-
}
|
|
182174
|
-
});
|
|
182175
|
-
function projectToScreen(three, camera, point, width, height) {
|
|
182176
|
-
const v = new three.Vector3(point[0], point[1], point[2]);
|
|
182177
|
-
v.project(camera);
|
|
182178
|
-
return { x: (v.x + 1) / 2 * width, y: (-v.y + 1) / 2 * height };
|
|
182179
|
-
}
|
|
182180
|
-
function attachChart3DPointerInteraction(options) {
|
|
182181
|
-
let width = options.width;
|
|
182182
|
-
let height = options.height;
|
|
182183
|
-
const raycaster = new options.three.Raycaster();
|
|
182184
|
-
const ndc = new options.three.Vector2();
|
|
182185
|
-
let dragState = null;
|
|
182186
|
-
function raycastAt(clientX, clientY) {
|
|
182187
|
-
const rect22 = options.canvas.getBoundingClientRect();
|
|
182188
|
-
if (rect22.width <= 0 || rect22.height <= 0) {
|
|
182189
|
-
return void 0;
|
|
182190
|
-
}
|
|
182191
|
-
ndc.x = (clientX - rect22.left) / rect22.width * 2 - 1;
|
|
182192
|
-
ndc.y = -((clientY - rect22.top) / rect22.height) * 2 + 1;
|
|
182193
|
-
raycaster.setFromCamera(ndc, options.camera);
|
|
182194
|
-
return raycaster.intersectObjects(options.meshes, false)[0];
|
|
182195
|
-
}
|
|
182196
|
-
function setSelectedPart(part) {
|
|
182197
|
-
options.applyHighlight?.(part);
|
|
182198
|
-
}
|
|
182199
|
-
function currentDelta(clientX, clientY, state) {
|
|
182200
|
-
return { x: clientX - state.startClientX, y: clientY - state.startClientY };
|
|
182201
|
-
}
|
|
182202
|
-
const onPointerDown = (event) => {
|
|
182203
|
-
options.canvas.setPointerCapture?.(
|
|
182204
|
-
event.pointerId
|
|
182205
|
-
);
|
|
182206
|
-
const hit = raycastAt(event.clientX, event.clientY);
|
|
182207
|
-
const part = hit ? options.resolveHit(hit) : null;
|
|
182208
|
-
const armed = part !== null && isChartInteractionArmed(options.canvas);
|
|
182209
|
-
if (armed) {
|
|
182210
|
-
event.stopPropagation();
|
|
182211
|
-
}
|
|
182212
|
-
let calibration = null;
|
|
182213
|
-
let startValue = 0;
|
|
182214
|
-
if (hit && part && armed && options.calibrateDrag) {
|
|
182215
|
-
const input = options.calibrateDrag(hit, part);
|
|
182216
|
-
if (input) {
|
|
182217
|
-
const s0 = projectToScreen(
|
|
182218
|
-
options.three,
|
|
182219
|
-
options.camera,
|
|
182220
|
-
input.worldAtValue0,
|
|
182221
|
-
width,
|
|
182222
|
-
height
|
|
182223
|
-
);
|
|
182224
|
-
const s1 = projectToScreen(
|
|
182225
|
-
options.three,
|
|
182226
|
-
options.camera,
|
|
182227
|
-
input.worldAtValue1,
|
|
182228
|
-
width,
|
|
182229
|
-
height
|
|
182230
|
-
);
|
|
182231
|
-
calibration = calibrateChart3DValueAxis(s0, input.value0, s1, input.value1);
|
|
182232
|
-
startValue = input.value1;
|
|
182233
|
-
}
|
|
182234
|
-
}
|
|
182235
|
-
dragState = {
|
|
182236
|
-
part,
|
|
182237
|
-
calibration,
|
|
182238
|
-
startValue,
|
|
182239
|
-
startClientX: event.clientX,
|
|
182240
|
-
startClientY: event.clientY,
|
|
182241
|
-
moved: false
|
|
182242
|
-
};
|
|
182243
|
-
if (calibration) {
|
|
182244
|
-
event.preventDefault();
|
|
182245
|
-
options.setControlsEnabled?.(false);
|
|
182246
|
-
}
|
|
182247
|
-
};
|
|
182248
|
-
const onPointerMove = (event) => {
|
|
182249
|
-
if (!dragState || !dragState.part || !dragState.calibration) {
|
|
182250
|
-
return;
|
|
182251
|
-
}
|
|
182252
|
-
const delta = currentDelta(event.clientX, event.clientY, dragState);
|
|
182253
|
-
if (!dragState.moved && Math.hypot(delta.x, delta.y) < CHART_3D_DRAG_THRESHOLD_PX) {
|
|
182254
|
-
return;
|
|
182255
|
-
}
|
|
182256
|
-
dragState.moved = true;
|
|
182257
|
-
const value = dragState.startValue + chart3DPointerDeltaToValueDelta(dragState.calibration, delta);
|
|
182258
|
-
options.onValueDragPreview?.(dragState.part, value);
|
|
182259
|
-
};
|
|
182260
|
-
const onPointerUp = (event) => {
|
|
182261
|
-
if (!dragState) {
|
|
182262
|
-
return;
|
|
182263
|
-
}
|
|
182264
|
-
const state = dragState;
|
|
182265
|
-
dragState = null;
|
|
182266
|
-
options.canvas.releasePointerCapture?.(event.pointerId);
|
|
182267
|
-
if (state.calibration) {
|
|
182268
|
-
options.setControlsEnabled?.(true);
|
|
182269
|
-
}
|
|
182270
|
-
if (state.moved && state.part && state.calibration) {
|
|
182271
|
-
const delta = currentDelta(event.clientX, event.clientY, state);
|
|
182272
|
-
const value = state.startValue + chart3DPointerDeltaToValueDelta(state.calibration, delta);
|
|
182273
|
-
options.onValueDragCommit?.(state.part, value);
|
|
182274
|
-
return;
|
|
182275
|
-
}
|
|
182276
|
-
setSelectedPart(state.part);
|
|
182277
|
-
options.onSelect?.(state.part);
|
|
182278
|
-
};
|
|
182279
|
-
options.canvas.addEventListener("pointerdown", onPointerDown);
|
|
182280
|
-
options.canvas.addEventListener("pointermove", onPointerMove);
|
|
182281
|
-
options.canvas.addEventListener("pointerup", onPointerUp);
|
|
182282
|
-
options.canvas.addEventListener("pointercancel", onPointerUp);
|
|
182283
|
-
return {
|
|
182284
|
-
setSelectedPart,
|
|
182285
|
-
updateSize(w, h2) {
|
|
182286
|
-
width = w;
|
|
182287
|
-
height = h2;
|
|
182288
|
-
},
|
|
182289
|
-
dispose() {
|
|
182290
|
-
options.canvas.removeEventListener("pointerdown", onPointerDown);
|
|
182291
|
-
options.canvas.removeEventListener("pointermove", onPointerMove);
|
|
182292
|
-
options.canvas.removeEventListener("pointerup", onPointerUp);
|
|
182293
|
-
options.canvas.removeEventListener("pointercancel", onPointerUp);
|
|
182294
|
-
}
|
|
182295
|
-
};
|
|
182296
|
-
}
|
|
182297
|
-
var init_chart_3d_pointer_interaction = __esm2({
|
|
182298
|
-
"src/render/chart-3d-pointer-interaction.ts"() {
|
|
182299
|
-
init_chart_3d_interaction();
|
|
182300
|
-
init_chart_canvas_drag();
|
|
182301
|
-
}
|
|
182302
|
-
});
|
|
182303
|
-
function calibrateSurfaceChart3DDrag(position2, value, values) {
|
|
182304
|
-
let min = Infinity;
|
|
182305
|
-
let max = -Infinity;
|
|
182306
|
-
for (const v of values) {
|
|
182307
|
-
if (v < min) {
|
|
182308
|
-
min = v;
|
|
182309
|
-
}
|
|
182310
|
-
if (v > max) {
|
|
182311
|
-
max = v;
|
|
182312
|
-
}
|
|
182313
|
-
}
|
|
182314
|
-
if (!(max > min)) {
|
|
182315
|
-
return null;
|
|
182316
|
-
}
|
|
182317
|
-
const [x, , z] = position2;
|
|
182318
|
-
const atMin = value === min;
|
|
182319
|
-
return {
|
|
182320
|
-
worldAtValue0: [x, atMin ? MAX_HEIGHT : 0, z],
|
|
182321
|
-
value0: atMin ? max : min,
|
|
182322
|
-
worldAtValue1: position2,
|
|
182323
|
-
value1: value
|
|
182324
|
-
};
|
|
182325
|
-
}
|
|
182326
|
-
var init_surface_chart_3d_drag = __esm2({
|
|
182327
|
-
"src/render/surface-chart-3d-drag.ts"() {
|
|
182328
|
-
init_surface_chart_3d_geom();
|
|
182329
|
-
}
|
|
182330
|
-
});
|
|
182331
|
-
function createSurfaceHighlightMarker(three, cols, rows, heightMap) {
|
|
182332
|
-
const geometry = new three.SphereGeometry(MARKER_RADIUS, 12, 8);
|
|
182333
|
-
const material = new three.MeshPhongMaterial({
|
|
182334
|
-
color: CHART_3D_SELECTED_EMISSIVE,
|
|
182335
|
-
emissive: CHART_3D_SELECTED_EMISSIVE,
|
|
182336
|
-
emissiveIntensity: CHART_3D_SELECTED_EMISSIVE_INTENSITY,
|
|
182337
|
-
shininess: 30
|
|
182338
|
-
});
|
|
182339
|
-
const mesh = new three.Mesh(geometry, material);
|
|
182340
|
-
mesh.visible = false;
|
|
182341
|
-
return {
|
|
182342
|
-
mesh,
|
|
182343
|
-
setSelected(cell) {
|
|
182344
|
-
if (!cell) {
|
|
182345
|
-
mesh.visible = false;
|
|
182346
|
-
return;
|
|
182347
|
-
}
|
|
182348
|
-
const [x, y, z] = surfaceVertexWorldPosition(cols, rows, cell.row, cell.col, heightMap);
|
|
182349
|
-
mesh.position.set(x, y + MARKER_Y_OFFSET, z);
|
|
182350
|
-
mesh.visible = true;
|
|
182351
|
-
},
|
|
182352
|
-
dispose() {
|
|
182353
|
-
geometry.dispose();
|
|
182354
|
-
material.dispose();
|
|
182355
|
-
}
|
|
182356
|
-
};
|
|
182357
|
-
}
|
|
182358
|
-
function cellFromIntersection(intersection, cols, rows) {
|
|
182359
|
-
return intersection.faceIndex === void 0 || intersection.faceIndex === null ? null : surfaceFaceIndexToCell(intersection.faceIndex, cols, rows);
|
|
182360
|
-
}
|
|
182361
|
-
function attachSurfaceChart3DInteraction(params) {
|
|
182362
|
-
return attachChart3DPointerInteraction({
|
|
182363
|
-
three: params.three,
|
|
182364
|
-
canvas: params.canvas,
|
|
182365
|
-
camera: params.camera,
|
|
182366
|
-
width: params.width,
|
|
182367
|
-
height: params.height,
|
|
182368
|
-
meshes: [params.surfaceMesh],
|
|
182369
|
-
resolveHit: (intersection) => {
|
|
182370
|
-
const cell = cellFromIntersection(intersection, params.cols, params.rows);
|
|
182371
|
-
return chart3DHitToPartRef(cell ? { seriesIndex: cell.row, pointIndex: cell.col } : null);
|
|
182372
|
-
},
|
|
182373
|
-
calibrateDrag: (intersection) => {
|
|
182374
|
-
const cell = cellFromIntersection(intersection, params.cols, params.rows);
|
|
182375
|
-
if (!cell || !params.values) {
|
|
182376
|
-
return null;
|
|
182377
|
-
}
|
|
182378
|
-
const idx = cell.row * params.cols + cell.col;
|
|
182379
|
-
const value = params.values[idx];
|
|
182380
|
-
if (value === void 0) {
|
|
182381
|
-
return null;
|
|
182382
|
-
}
|
|
182383
|
-
const position2 = surfaceVertexWorldPosition(
|
|
182384
|
-
params.cols,
|
|
182385
|
-
params.rows,
|
|
182386
|
-
cell.row,
|
|
182387
|
-
cell.col,
|
|
182388
|
-
params.heightMap
|
|
182389
|
-
);
|
|
182390
|
-
return calibrateSurfaceChart3DDrag(position2, value, params.values);
|
|
182391
|
-
},
|
|
182392
|
-
applyHighlight: (part) => {
|
|
182393
|
-
const cell = part && part.role === "dataPoint" && part.pointIndex !== void 0 ? { row: part.seriesIndex, col: part.pointIndex } : null;
|
|
182394
|
-
params.highlightMarker.setSelected(cell);
|
|
182395
|
-
},
|
|
182396
|
-
setControlsEnabled: (enabled) => {
|
|
182397
|
-
params.controls.enabled = enabled;
|
|
182398
|
-
},
|
|
182399
|
-
onSelect: params.interaction?.onSelect,
|
|
182400
|
-
onValueDragPreview: params.interaction?.onValueDragPreview,
|
|
182401
|
-
onValueDragCommit: params.interaction?.onValueDragCommit
|
|
182402
|
-
});
|
|
182403
|
-
}
|
|
182404
|
-
var MARKER_RADIUS;
|
|
182405
|
-
var MARKER_Y_OFFSET;
|
|
182406
|
-
var init_surface_chart_3d_interaction_wiring = __esm2({
|
|
182407
|
-
"src/render/surface-chart-3d-interaction-wiring.ts"() {
|
|
182408
|
-
init_chart_3d_interaction();
|
|
182409
|
-
init_chart_3d_pointer_interaction();
|
|
182410
|
-
init_surface_chart_3d_drag();
|
|
182411
|
-
init_surface_chart_3d_geom();
|
|
182412
|
-
init_surface_chart_3d_hit_test();
|
|
182413
|
-
MARKER_RADIUS = 0.07;
|
|
182414
|
-
MARKER_Y_OFFSET = 0.03;
|
|
182415
|
-
}
|
|
182416
|
-
});
|
|
182417
|
-
function buildSurfaceWallMeshes(three, cols, rows, wallHeight, colors, extent) {
|
|
182418
|
-
const { gridWidth, gridDepth } = extent ?? computeGridExtent(cols, rows);
|
|
182419
|
-
const meshes = [];
|
|
182420
|
-
const disposables = [];
|
|
182421
|
-
const addPlane = (width, height, color2, position2, rotation) => {
|
|
182422
|
-
const geometry = new three.PlaneGeometry(width, height);
|
|
182423
|
-
const material = new three.MeshBasicMaterial({
|
|
182424
|
-
color: color2,
|
|
182425
|
-
transparent: true,
|
|
182426
|
-
opacity: PANEL_OPACITY,
|
|
182427
|
-
side: three.DoubleSide,
|
|
182428
|
-
depthWrite: false
|
|
182429
|
-
});
|
|
182430
|
-
const mesh = new three.Mesh(geometry, material);
|
|
182431
|
-
mesh.position.set(...position2);
|
|
182432
|
-
mesh.rotation.set(...rotation);
|
|
182433
|
-
meshes.push(mesh);
|
|
182434
|
-
disposables.push(geometry, material);
|
|
182435
|
-
};
|
|
182436
|
-
if (colors.floor) {
|
|
182437
|
-
addPlane(gridWidth, gridDepth, colors.floor, [0, -0.01, 0], [-Math.PI / 2, 0, 0]);
|
|
182438
|
-
}
|
|
182439
|
-
if (colors.backWall) {
|
|
182440
|
-
addPlane(
|
|
182441
|
-
gridWidth,
|
|
182442
|
-
wallHeight,
|
|
182443
|
-
colors.backWall,
|
|
182444
|
-
[0, wallHeight / 2, -gridDepth / 2],
|
|
182445
|
-
[0, 0, 0]
|
|
182446
|
-
);
|
|
182447
|
-
}
|
|
182448
|
-
if (colors.sideWall) {
|
|
182449
|
-
addPlane(
|
|
182450
|
-
gridDepth,
|
|
182451
|
-
wallHeight,
|
|
182452
|
-
colors.sideWall,
|
|
182453
|
-
[gridWidth / 2, wallHeight / 2, 0],
|
|
182454
|
-
[0, Math.PI / 2, 0]
|
|
182455
|
-
);
|
|
182456
|
-
}
|
|
182457
|
-
return {
|
|
182458
|
-
meshes,
|
|
182459
|
-
dispose: () => {
|
|
182460
|
-
for (const d of disposables) {
|
|
182461
|
-
d.dispose();
|
|
182462
|
-
}
|
|
182463
|
-
}
|
|
182464
|
-
};
|
|
182465
|
-
}
|
|
182466
|
-
var PANEL_OPACITY;
|
|
182467
|
-
var init_surface_chart_3d_walls = __esm2({
|
|
182468
|
-
"src/render/surface-chart-3d-walls.ts"() {
|
|
182469
|
-
init_surface_chart_3d_geom();
|
|
182470
|
-
PANEL_OPACITY = 0.35;
|
|
182471
|
-
}
|
|
182472
|
-
});
|
|
182473
|
-
function createSurfaceChart3DScene(ctx, options) {
|
|
182474
|
-
const { cols, rows } = options;
|
|
182475
|
-
const placement = computeCameraPlacement(cols, rows, options.view3D);
|
|
182476
|
-
const stage = createHostedChart3DStage(
|
|
182477
|
-
ctx,
|
|
182478
|
-
{ fov: FOV2, ...placement },
|
|
182479
|
-
{ minDistance: 1, maxDistance: 20 },
|
|
182480
|
-
0.6
|
|
182481
|
-
);
|
|
182482
|
-
const { three, scene, camera, canvas, controls, width, height } = stage;
|
|
182483
|
-
const interaction = hostedChart3DInteraction(ctx);
|
|
182484
|
-
const { gridWidth, gridDepth } = computeGridExtent(cols, rows);
|
|
182485
|
-
const floorSize = Math.max(gridWidth, gridDepth) * 1.2;
|
|
182486
|
-
const gridFloor = new three.GridHelper(floorSize, Math.max(cols, rows), 13421772, 15263976);
|
|
182487
|
-
gridFloor.position.y = -0.02;
|
|
182488
|
-
scene.add(gridFloor);
|
|
182489
|
-
const walls = options.surfaceColors ? buildSurfaceWallMeshes(three, cols, rows, MAX_HEIGHT, options.surfaceColors) : null;
|
|
182490
|
-
for (const mesh of walls?.meshes ?? []) {
|
|
182491
|
-
scene.add(mesh);
|
|
182492
|
-
}
|
|
182493
|
-
const { heightMap, colorMap } = options;
|
|
182494
|
-
const { geometry, wireGeometry } = buildSurfaceGeometry(three, cols, rows, heightMap, colorMap);
|
|
182495
|
-
const surfaceMaterial = new three.MeshPhongMaterial({
|
|
182496
|
-
vertexColors: true,
|
|
182497
|
-
side: three.DoubleSide,
|
|
182498
|
-
shininess: 30,
|
|
182499
|
-
transparent: true,
|
|
182500
|
-
opacity: 0.92
|
|
182501
|
-
});
|
|
182502
|
-
const surfaceMesh = new three.Mesh(geometry, surfaceMaterial);
|
|
182503
|
-
scene.add(surfaceMesh);
|
|
182504
|
-
const highlightMarker = createSurfaceHighlightMarker(three, cols, rows, heightMap);
|
|
182505
|
-
scene.add(highlightMarker.mesh);
|
|
182506
|
-
let wireMaterial = null;
|
|
182507
|
-
if (options.wireframe) {
|
|
182508
|
-
wireMaterial = new three.LineBasicMaterial({
|
|
182509
|
-
color: 3355443,
|
|
182510
|
-
transparent: true,
|
|
182511
|
-
opacity: 0.25
|
|
182512
|
-
});
|
|
182513
|
-
scene.add(new three.LineSegments(wireGeometry, wireMaterial));
|
|
182514
|
-
}
|
|
182515
|
-
const hoverTooltip = attachChart3DHoverTooltip({
|
|
182516
|
-
three,
|
|
182517
|
-
canvas,
|
|
182518
|
-
camera,
|
|
182519
|
-
meshes: [surfaceMesh],
|
|
182520
|
-
buildTooltip: (intersection) => buildSurfaceHoverTooltip(intersection?.faceIndex, {
|
|
182521
|
-
cols,
|
|
182522
|
-
rows,
|
|
182523
|
-
categoryLabels: options.categoryLabels,
|
|
182524
|
-
seriesNames: options.seriesNames,
|
|
182525
|
-
values: options.values,
|
|
182526
|
-
numberFormats: options.numberFormats
|
|
182527
|
-
})
|
|
182528
|
-
});
|
|
182529
|
-
const pointerInteraction = attachSurfaceChart3DInteraction({
|
|
182530
|
-
three,
|
|
182531
|
-
canvas,
|
|
182532
|
-
camera,
|
|
182533
|
-
controls,
|
|
182534
|
-
width,
|
|
182535
|
-
height,
|
|
182536
|
-
surfaceMesh,
|
|
182537
|
-
cols,
|
|
182538
|
-
rows,
|
|
182539
|
-
heightMap,
|
|
182540
|
-
values: options.values,
|
|
182541
|
-
highlightMarker,
|
|
182542
|
-
interaction
|
|
182543
|
-
});
|
|
182544
|
-
const labels = buildSurfaceLabels(cols, rows, options.categoryLabels, options.seriesNames);
|
|
182545
|
-
const labelProjector = createChart3DLabelProjector(three, ctx.document, labels);
|
|
182546
|
-
labelProjector.applyTextStyle(options.textStyle);
|
|
182547
|
-
ctx.overlay.appendChild(labelProjector.layer);
|
|
182548
|
-
return finishHostedChart3DScene(
|
|
182549
|
-
ctx,
|
|
182550
|
-
stage,
|
|
182551
|
-
{
|
|
182552
|
-
afterRender: (cam, w, h2) => labelProjector.update(cam, w, h2),
|
|
182553
|
-
resize: (w, h2) => pointerInteraction.updateSize(w, h2),
|
|
182554
|
-
setSelectedPart: (part) => pointerInteraction.setSelectedPart(part),
|
|
182555
|
-
setTextStyle: (style) => labelProjector.applyTextStyle(style),
|
|
182556
|
-
dispose() {
|
|
182557
|
-
hoverTooltip.dispose();
|
|
182558
|
-
pointerInteraction.dispose();
|
|
182559
|
-
geometry.dispose();
|
|
182560
|
-
wireGeometry.dispose();
|
|
182561
|
-
surfaceMaterial.dispose();
|
|
182562
|
-
wireMaterial?.dispose();
|
|
182563
|
-
highlightMarker.dispose();
|
|
182564
|
-
gridFloor.dispose();
|
|
182565
|
-
walls?.dispose();
|
|
182566
|
-
labelProjector.layer.remove();
|
|
182567
|
-
}
|
|
182568
|
-
},
|
|
182569
|
-
interaction
|
|
182570
|
-
);
|
|
182571
|
-
}
|
|
182572
|
-
var FOV2;
|
|
182573
|
-
var init_surface_chart_3d_scene = __esm2({
|
|
182574
|
-
"src/render/surface-chart-3d-scene.ts"() {
|
|
182575
|
-
init_chart_3d_hosted_stage();
|
|
182576
|
-
init_chart_3d_hover_tooltip();
|
|
182577
|
-
init_chart_3d_label_projection();
|
|
182578
|
-
init_surface_chart_3d_geom();
|
|
182579
|
-
init_surface_chart_3d_hit_test();
|
|
182580
|
-
init_surface_chart_3d_interaction_wiring();
|
|
182581
|
-
init_surface_chart_3d_walls();
|
|
182582
|
-
FOV2 = 45;
|
|
182583
|
-
}
|
|
182584
|
-
});
|
|
182585
|
-
function colorFace(color2) {
|
|
182586
|
-
return { kind: "color", color: color2 };
|
|
182587
|
-
}
|
|
182588
|
-
function worldHeightPerValueUnit(box) {
|
|
182589
|
-
return box.value !== 0 ? box.size[1] / box.value : void 0;
|
|
182590
|
-
}
|
|
182591
|
-
function faceRepeat(format2, pictureStackUnit, faceWorldSize, box) {
|
|
182592
|
-
if (format2 === "stretch" || pictureStackUnit === void 0 || pictureStackUnit <= 0) {
|
|
182593
|
-
return 1;
|
|
182594
|
-
}
|
|
182595
|
-
const perValueUnit = worldHeightPerValueUnit(box);
|
|
182596
|
-
if (!perValueUnit) {
|
|
182597
|
-
return 1;
|
|
182598
|
-
}
|
|
182599
|
-
const tileWorldSize = pictureStackUnit * perValueUnit;
|
|
182600
|
-
return tileWorldSize > 0 ? Math.max(1, faceWorldSize / tileWorldSize) : 1;
|
|
182601
|
-
}
|
|
182602
|
-
function resolveTargetedFace(series, box, face, faceWorldSize, untargetedFallback) {
|
|
182603
|
-
const resolved = resolveDataPointPictureFill(series, box.categoryIndex, box.seriesIndex, face);
|
|
182604
|
-
if (!resolved) {
|
|
182605
|
-
return colorFace(untargetedFallback);
|
|
182606
|
-
}
|
|
182607
|
-
const pictureStackUnit = resolveActiveDataPointPicture(
|
|
182608
|
-
series,
|
|
182609
|
-
box.categoryIndex
|
|
182610
|
-
)?.pictureStackUnit;
|
|
182611
|
-
return {
|
|
182612
|
-
kind: "picture",
|
|
182613
|
-
imageUrl: resolved.imageUrl,
|
|
182614
|
-
repeatX: 1,
|
|
182615
|
-
repeatY: faceRepeat(resolved.format, pictureStackUnit, faceWorldSize, box)
|
|
182616
|
-
};
|
|
182617
|
-
}
|
|
182618
|
-
function allSameColor(fills) {
|
|
182619
|
-
const first = fills[0];
|
|
182620
|
-
if (!first || first.kind !== "color") {
|
|
182621
|
-
return void 0;
|
|
182622
|
-
}
|
|
182623
|
-
return fills.every((fill) => fill.kind === "color" && fill.color === first.color) ? first.color : void 0;
|
|
182624
|
-
}
|
|
182625
|
-
function resolveBarBoxFaceFills(box, series) {
|
|
182626
|
-
const plain = {
|
|
182627
|
-
posX: colorFace(box.color),
|
|
182628
|
-
negX: colorFace(box.color),
|
|
182629
|
-
posY: colorFace(box.color),
|
|
182630
|
-
negY: colorFace(box.color),
|
|
182631
|
-
posZ: colorFace(box.color),
|
|
182632
|
-
negZ: colorFace(box.color)
|
|
182633
|
-
};
|
|
182634
|
-
if (box.shape !== void 0 && box.shape !== "box") {
|
|
182635
|
-
return plain;
|
|
182636
|
-
}
|
|
182637
|
-
const seriesData = series[box.seriesIndex];
|
|
182638
|
-
if (!seriesData) {
|
|
182639
|
-
return plain;
|
|
182640
|
-
}
|
|
182641
|
-
const active2 = resolveActiveDataPointPicture(seriesData, box.categoryIndex);
|
|
182642
|
-
if (!active2?.imageUrl) {
|
|
182643
|
-
return plain;
|
|
182644
|
-
}
|
|
182645
|
-
const [, height, depth] = box.size;
|
|
182646
|
-
const frontFill = resolveTargetedFace(seriesData, box, "front", height, box.color);
|
|
182647
|
-
const sideFill = resolveTargetedFace(
|
|
182648
|
-
seriesData,
|
|
182649
|
-
box,
|
|
182650
|
-
"side",
|
|
182651
|
-
height,
|
|
182652
|
-
resolveUntargetedBarFaceFill("side", box.color)
|
|
182653
|
-
);
|
|
182654
|
-
const endFill = resolveTargetedFace(
|
|
182655
|
-
seriesData,
|
|
182656
|
-
box,
|
|
182657
|
-
"end",
|
|
182658
|
-
depth,
|
|
182659
|
-
resolveUntargetedBarFaceFill("end", box.color)
|
|
182660
|
-
);
|
|
182661
|
-
return {
|
|
182662
|
-
posX: sideFill,
|
|
182663
|
-
negX: sideFill,
|
|
182664
|
-
posY: endFill,
|
|
182665
|
-
negY: colorFace(box.color),
|
|
182666
|
-
posZ: frontFill,
|
|
182667
|
-
negZ: colorFace(box.color)
|
|
182668
|
-
};
|
|
182669
|
-
}
|
|
182670
|
-
function resolveBarRoundFaceFills(box, series) {
|
|
182671
|
-
const plain = {
|
|
182672
|
-
side: colorFace(box.color),
|
|
182673
|
-
end: colorFace(box.color),
|
|
182674
|
-
bottom: colorFace(box.color)
|
|
182675
|
-
};
|
|
182676
|
-
const seriesData = series[box.seriesIndex];
|
|
182677
|
-
if (!seriesData) {
|
|
182678
|
-
return plain;
|
|
182679
|
-
}
|
|
182680
|
-
const active2 = resolveActiveDataPointPicture(seriesData, box.categoryIndex);
|
|
182681
|
-
if (!active2?.imageUrl) {
|
|
182682
|
-
return plain;
|
|
182683
|
-
}
|
|
182684
|
-
const [, height, depth] = box.size;
|
|
182685
|
-
const sideFill = resolveTargetedFace(
|
|
182686
|
-
seriesData,
|
|
182687
|
-
box,
|
|
182688
|
-
"side",
|
|
182689
|
-
height,
|
|
182690
|
-
resolveUntargetedBarFaceFill("side", box.color)
|
|
182691
|
-
);
|
|
182692
|
-
const endFill = resolveTargetedFace(
|
|
182693
|
-
seriesData,
|
|
182694
|
-
box,
|
|
182695
|
-
"end",
|
|
182696
|
-
depth,
|
|
182697
|
-
resolveUntargetedBarFaceFill("end", box.color)
|
|
182698
|
-
);
|
|
182699
|
-
return { side: sideFill, end: endFill, bottom: colorFace(box.color) };
|
|
182700
|
-
}
|
|
182701
|
-
function uniformBoxColor(fills) {
|
|
182702
|
-
return allSameColor([fills.posX, fills.negX, fills.posY, fills.negY, fills.posZ, fills.negZ]);
|
|
182703
|
-
}
|
|
182704
|
-
function uniformRoundColor(fills) {
|
|
182705
|
-
return allSameColor([fills.side, fills.end, fills.bottom]);
|
|
182706
|
-
}
|
|
182707
|
-
var init_bar_chart_3d_face_fill = __esm2({
|
|
182708
|
-
"src/render/bar-chart-3d-face-fill.ts"() {
|
|
182709
|
-
init_chart_bar3d_face_picture();
|
|
182710
|
-
init_chart_datapoint_picture_resolve();
|
|
182711
|
-
}
|
|
182712
|
-
});
|
|
182713
|
-
function createBarChart3DTextureManager(three) {
|
|
182714
|
-
const loader = new three.TextureLoader();
|
|
182715
|
-
const cache2 = /* @__PURE__ */ new Map();
|
|
182716
|
-
const loaded = [];
|
|
182717
|
-
return {
|
|
182718
|
-
load(url) {
|
|
182719
|
-
const cached = cache2.get(url);
|
|
182720
|
-
if (cached) {
|
|
182721
|
-
return cached;
|
|
182722
|
-
}
|
|
182723
|
-
const pending = new Promise((resolve3, reject) => {
|
|
182724
|
-
loader.load(
|
|
182725
|
-
url,
|
|
182726
|
-
(texture) => {
|
|
182727
|
-
loaded.push(texture);
|
|
182728
|
-
resolve3(texture);
|
|
182729
|
-
},
|
|
182730
|
-
void 0,
|
|
182731
|
-
reject
|
|
182732
|
-
);
|
|
182733
|
-
});
|
|
182734
|
-
cache2.set(url, pending);
|
|
182735
|
-
return pending;
|
|
182736
|
-
},
|
|
182737
|
-
disposeAll() {
|
|
182738
|
-
for (const texture of loaded) {
|
|
182739
|
-
texture.dispose();
|
|
182740
|
-
}
|
|
182741
|
-
loaded.length = 0;
|
|
182742
|
-
cache2.clear();
|
|
182743
|
-
}
|
|
182744
|
-
};
|
|
182745
|
-
}
|
|
182746
|
-
function buildColorMaterial(three, color2) {
|
|
182747
|
-
return new three.MeshPhongMaterial({ color: color2, shininess: 30 });
|
|
182748
|
-
}
|
|
182749
|
-
function buildFaceMaterial(three, fill, textures, ownedTextures, isDisposed) {
|
|
182750
|
-
if (fill.kind === "color") {
|
|
182751
|
-
return buildColorMaterial(three, fill.color);
|
|
182752
|
-
}
|
|
182753
|
-
const material = buildColorMaterial(three, "#ffffff");
|
|
182754
|
-
textures.load(fill.imageUrl).then((base) => {
|
|
182755
|
-
const texture = base.clone();
|
|
182756
|
-
texture.wrapS = three.RepeatWrapping;
|
|
182757
|
-
texture.wrapT = three.RepeatWrapping;
|
|
182758
|
-
texture.repeat.set(fill.repeatX, fill.repeatY);
|
|
182759
|
-
texture.needsUpdate = true;
|
|
182760
|
-
if (isDisposed()) {
|
|
182761
|
-
texture.dispose();
|
|
182762
|
-
return void 0;
|
|
182763
|
-
}
|
|
182764
|
-
ownedTextures.push(texture);
|
|
182765
|
-
material.map = texture;
|
|
182766
|
-
material.needsUpdate = true;
|
|
182767
|
-
return void 0;
|
|
182768
|
-
}).catch(() => {
|
|
182769
|
-
});
|
|
182770
|
-
return material;
|
|
182771
|
-
}
|
|
182772
|
-
function buildMaterialArrayResult(three, fills, textures) {
|
|
182773
|
-
let disposed = false;
|
|
182774
|
-
const ownedTextures = [];
|
|
182775
|
-
const materials = fills.map(
|
|
182776
|
-
(fill) => buildFaceMaterial(three, fill, textures, ownedTextures, () => disposed)
|
|
182777
|
-
);
|
|
182778
|
-
return {
|
|
182779
|
-
material: materials,
|
|
182780
|
-
dispose: () => {
|
|
182781
|
-
disposed = true;
|
|
182782
|
-
for (const material of materials) {
|
|
182783
|
-
material.dispose();
|
|
182784
|
-
}
|
|
182785
|
-
for (const texture of ownedTextures) {
|
|
182786
|
-
texture.dispose();
|
|
182787
|
-
}
|
|
182788
|
-
}
|
|
182789
|
-
};
|
|
182790
|
-
}
|
|
182791
|
-
function buildBarBoxMaterial(three, box, assets) {
|
|
182792
|
-
if (!assets) {
|
|
182793
|
-
const material = buildColorMaterial(three, box.color);
|
|
182794
|
-
return { material, dispose: () => material.dispose() };
|
|
182795
|
-
}
|
|
182796
|
-
const isRound = box.shape !== void 0 && box.shape !== "box";
|
|
182797
|
-
if (isRound) {
|
|
182798
|
-
const roundFills = resolveBarRoundFaceFills(box, assets.context.series);
|
|
182799
|
-
const solid2 = uniformRoundColor(roundFills);
|
|
182800
|
-
if (solid2 !== void 0) {
|
|
182801
|
-
const material = buildColorMaterial(three, solid2);
|
|
182802
|
-
return { material, dispose: () => material.dispose() };
|
|
182803
|
-
}
|
|
182804
|
-
return buildMaterialArrayResult(
|
|
182805
|
-
three,
|
|
182806
|
-
[roundFills.side, roundFills.end, roundFills.bottom],
|
|
182807
|
-
assets.textures
|
|
182808
|
-
);
|
|
182809
|
-
}
|
|
182810
|
-
const fills = resolveBarBoxFaceFills(box, assets.context.series);
|
|
182811
|
-
const solid = uniformBoxColor(fills);
|
|
182812
|
-
if (solid !== void 0) {
|
|
182813
|
-
const material = buildColorMaterial(three, solid);
|
|
182814
|
-
return { material, dispose: () => material.dispose() };
|
|
182815
|
-
}
|
|
182816
|
-
return buildMaterialArrayResult(
|
|
182817
|
-
three,
|
|
182818
|
-
FACE_ORDER.map((face) => fills[face]),
|
|
182819
|
-
assets.textures
|
|
182820
|
-
);
|
|
182821
|
-
}
|
|
182822
|
-
var FACE_ORDER;
|
|
182823
|
-
var init_bar_chart_3d_materials = __esm2({
|
|
182824
|
-
"src/render/bar-chart-3d-materials.ts"() {
|
|
182825
|
-
init_bar_chart_3d_face_fill();
|
|
182826
|
-
FACE_ORDER = [
|
|
182827
|
-
"posX",
|
|
182828
|
-
"negX",
|
|
182829
|
-
"posY",
|
|
182830
|
-
"negY",
|
|
182831
|
-
"posZ",
|
|
182832
|
-
"negZ"
|
|
182833
|
-
];
|
|
182834
|
-
}
|
|
182835
|
-
});
|
|
182836
|
-
function buildBar3DGeometry(three, shape, coneToMaxTopRadiusFactor2) {
|
|
182837
|
-
switch (shape) {
|
|
182838
|
-
case "cylinder":
|
|
182839
|
-
return new three.CylinderGeometry(0.5, 0.5, 1, ROUND_SEGMENTS);
|
|
182840
|
-
case "cone":
|
|
182841
|
-
return new three.ConeGeometry(0.5, 1, ROUND_SEGMENTS);
|
|
182842
|
-
case "pyramid":
|
|
182843
|
-
return new three.ConeGeometry(0.5, 1, PYRAMID_SEGMENTS);
|
|
182844
|
-
case "coneToMax":
|
|
182845
|
-
return new three.CylinderGeometry(
|
|
182846
|
-
0.5 * (coneToMaxTopRadiusFactor2 ?? 0),
|
|
182847
|
-
0.5,
|
|
182848
|
-
1,
|
|
182849
|
-
ROUND_SEGMENTS
|
|
182850
|
-
);
|
|
182851
|
-
case "pyramidToMax":
|
|
182852
|
-
return new three.CylinderGeometry(
|
|
182853
|
-
0.5 * (coneToMaxTopRadiusFactor2 ?? 0),
|
|
182854
|
-
0.5,
|
|
182855
|
-
1,
|
|
182856
|
-
PYRAMID_SEGMENTS
|
|
182857
|
-
);
|
|
182858
|
-
case "box":
|
|
182859
|
-
default:
|
|
182860
|
-
return new three.BoxGeometry(1, 1, 1);
|
|
182861
|
-
}
|
|
182862
|
-
}
|
|
182863
|
-
function buildBar3DMeshGroup(three, scene, boxes, horizontal = false, picture) {
|
|
182864
|
-
const meshes = [];
|
|
182865
|
-
const materials = [];
|
|
182866
|
-
const materialDisposers = [];
|
|
182867
|
-
const geometries = [];
|
|
182868
|
-
for (const box of boxes) {
|
|
182869
|
-
const geometry = buildBar3DGeometry(three, box.shape, box.coneToMaxTopRadiusFactor);
|
|
182870
|
-
const { material, dispose } = buildBarBoxMaterial(three, box, picture);
|
|
182871
|
-
const mesh = new three.Mesh(geometry, material);
|
|
182872
|
-
mesh.position.set(...box.center);
|
|
182873
|
-
mesh.scale.set(...box.size);
|
|
182874
|
-
if (horizontal) {
|
|
182875
|
-
mesh.rotation.z = -Math.PI / 2;
|
|
182876
|
-
}
|
|
182877
|
-
mesh.userData = {
|
|
182878
|
-
seriesIndex: box.seriesIndex,
|
|
182879
|
-
categoryIndex: box.categoryIndex,
|
|
182880
|
-
value: box.value
|
|
182881
|
-
};
|
|
182882
|
-
scene.add(mesh);
|
|
182883
|
-
meshes.push(mesh);
|
|
182884
|
-
materials.push(material);
|
|
182885
|
-
materialDisposers.push(dispose);
|
|
182886
|
-
geometries.push(geometry);
|
|
182887
|
-
}
|
|
182888
|
-
return { meshes, materials, geometries, materialDisposers };
|
|
182889
|
-
}
|
|
182890
|
-
var ROUND_SEGMENTS;
|
|
182891
|
-
var PYRAMID_SEGMENTS;
|
|
182892
|
-
var init_bar_chart_3d_geometry = __esm2({
|
|
182893
|
-
"src/render/bar-chart-3d-geometry.ts"() {
|
|
182894
|
-
init_bar_chart_3d_materials();
|
|
182895
|
-
ROUND_SEGMENTS = 32;
|
|
182896
|
-
PYRAMID_SEGMENTS = 4;
|
|
182897
|
-
}
|
|
182898
|
-
});
|
|
182899
181557
|
function buildBarChart3DHoverTooltip(hit, data) {
|
|
182900
181558
|
if (!hit) {
|
|
182901
181559
|
return void 0;
|
|
@@ -182912,984 +181570,6 @@ var init_bar_chart_3d_hit_test = __esm2({
|
|
|
182912
181570
|
init_chart_view_model();
|
|
182913
181571
|
}
|
|
182914
181572
|
});
|
|
182915
|
-
function valueAxisIndex(horizontal) {
|
|
182916
|
-
return horizontal ? 0 : 1;
|
|
182917
|
-
}
|
|
182918
|
-
function calibrateBarChart3DDrag(boxes, hit, grouping, horizontal) {
|
|
182919
|
-
if (grouping !== "clustered") {
|
|
182920
|
-
return null;
|
|
182921
|
-
}
|
|
182922
|
-
const box = boxes.find(
|
|
182923
|
-
(b) => b.seriesIndex === hit.seriesIndex && b.categoryIndex === hit.categoryIndex
|
|
182924
|
-
);
|
|
182925
|
-
if (!box) {
|
|
182926
|
-
return null;
|
|
182927
|
-
}
|
|
182928
|
-
const axis = valueAxisIndex(horizontal);
|
|
182929
|
-
const half = box.size[axis] / 2;
|
|
182930
|
-
const center = box.center[axis];
|
|
182931
|
-
const lo = center - half;
|
|
182932
|
-
const hi = center + half;
|
|
182933
|
-
const zeroIsLo = Math.abs(lo) <= Math.abs(hi);
|
|
182934
|
-
const zeroCoord = zeroIsLo ? lo : hi;
|
|
182935
|
-
const valueCoord = zeroIsLo ? hi : lo;
|
|
182936
|
-
if (Math.abs(valueCoord - zeroCoord) < 1e-9) {
|
|
182937
|
-
return null;
|
|
182938
|
-
}
|
|
182939
|
-
const at = (coord) => axis === 0 ? [coord, box.center[1], box.center[2]] : [box.center[0], coord, box.center[2]];
|
|
182940
|
-
return {
|
|
182941
|
-
worldAtValue0: at(zeroCoord),
|
|
182942
|
-
value0: 0,
|
|
182943
|
-
worldAtValue1: at(valueCoord),
|
|
182944
|
-
value1: hit.value
|
|
182945
|
-
};
|
|
182946
|
-
}
|
|
182947
|
-
var init_bar_chart_3d_drag = __esm2({
|
|
182948
|
-
"src/render/bar-chart-3d-drag.ts"() {
|
|
182949
|
-
}
|
|
182950
|
-
});
|
|
182951
|
-
function applyChart3DMeshHighlight(entries2, part) {
|
|
182952
|
-
for (const { mark, material } of entries2) {
|
|
182953
|
-
const selected = chart3DMarkMatchesPart(mark, part);
|
|
182954
|
-
const materials = Array.isArray(material) ? material : [material];
|
|
182955
|
-
for (const one of materials) {
|
|
182956
|
-
one.emissive.set(selected ? CHART_3D_SELECTED_EMISSIVE : CLEAR_EMISSIVE);
|
|
182957
|
-
one.emissiveIntensity = selected ? CHART_3D_SELECTED_EMISSIVE_INTENSITY : 0;
|
|
182958
|
-
}
|
|
182959
|
-
}
|
|
182960
|
-
}
|
|
182961
|
-
var CLEAR_EMISSIVE;
|
|
182962
|
-
var init_chart_3d_mesh_highlight = __esm2({
|
|
182963
|
-
"src/render/chart-3d-mesh-highlight.ts"() {
|
|
182964
|
-
init_chart_3d_interaction();
|
|
182965
|
-
CLEAR_EMISSIVE = "#000000";
|
|
182966
|
-
}
|
|
182967
|
-
});
|
|
182968
|
-
function attachBarChart3DInteraction(params) {
|
|
182969
|
-
const highlightEntries = params.boxMeshes.map((mesh, i2) => {
|
|
182970
|
-
const hit = mesh.userData;
|
|
182971
|
-
return {
|
|
182972
|
-
mark: { seriesIndex: hit.seriesIndex, pointIndex: hit.categoryIndex },
|
|
182973
|
-
material: params.boxMaterials[i2]
|
|
182974
|
-
};
|
|
182975
|
-
});
|
|
182976
|
-
return attachChart3DPointerInteraction({
|
|
182977
|
-
three: params.three,
|
|
182978
|
-
canvas: params.canvas,
|
|
182979
|
-
camera: params.camera,
|
|
182980
|
-
width: params.width,
|
|
182981
|
-
height: params.height,
|
|
182982
|
-
meshes: params.boxMeshes,
|
|
182983
|
-
resolveHit: (intersection) => {
|
|
182984
|
-
const hit = intersection.object.userData;
|
|
182985
|
-
return chart3DHitToPartRef(
|
|
182986
|
-
hit ? { seriesIndex: hit.seriesIndex, pointIndex: hit.categoryIndex } : null
|
|
182987
|
-
);
|
|
182988
|
-
},
|
|
182989
|
-
calibrateDrag: (intersection) => {
|
|
182990
|
-
const hit = intersection.object.userData;
|
|
182991
|
-
return calibrateBarChart3DDrag(params.boxes, hit, params.grouping, params.horizontal);
|
|
182992
|
-
},
|
|
182993
|
-
applyHighlight: (part) => applyChart3DMeshHighlight(highlightEntries, part),
|
|
182994
|
-
setControlsEnabled: (enabled) => {
|
|
182995
|
-
params.controls.enabled = enabled;
|
|
182996
|
-
},
|
|
182997
|
-
onSelect: params.interaction?.onSelect,
|
|
182998
|
-
onValueDragPreview: params.interaction?.onValueDragPreview,
|
|
182999
|
-
onValueDragCommit: params.interaction?.onValueDragCommit
|
|
183000
|
-
});
|
|
183001
|
-
}
|
|
183002
|
-
var init_bar_chart_3d_interaction_wiring = __esm2({
|
|
183003
|
-
"src/render/bar-chart-3d-interaction-wiring.ts"() {
|
|
183004
|
-
init_bar_chart_3d_drag();
|
|
183005
|
-
init_chart_3d_interaction();
|
|
183006
|
-
init_chart_3d_mesh_highlight();
|
|
183007
|
-
init_chart_3d_pointer_interaction();
|
|
183008
|
-
}
|
|
183009
|
-
});
|
|
183010
|
-
function createBarChart3DScene(ctx, options) {
|
|
183011
|
-
const placement = computeCartesianCameraPlacement(
|
|
183012
|
-
options.cols,
|
|
183013
|
-
options.rows,
|
|
183014
|
-
options.view3D,
|
|
183015
|
-
options.horizontal
|
|
183016
|
-
);
|
|
183017
|
-
const stage = createHostedChart3DStage(ctx, placement, { minDistance: 0.5, maxDistance: 30 });
|
|
183018
|
-
const { three, scene, camera, canvas } = stage;
|
|
183019
|
-
const extent = computeCartesianGridExtent(
|
|
183020
|
-
options.cols,
|
|
183021
|
-
options.rows,
|
|
183022
|
-
options.view3D?.depthPercent
|
|
183023
|
-
);
|
|
183024
|
-
const floorSize = Math.max(extent.gridWidth, extent.gridDepth, MAX_VALUE_HEIGHT * 2) * 1.2;
|
|
183025
|
-
const gridFloor = new three.GridHelper(
|
|
183026
|
-
floorSize,
|
|
183027
|
-
Math.max(options.cols, options.rows),
|
|
183028
|
-
13421772,
|
|
183029
|
-
15263976
|
|
183030
|
-
);
|
|
183031
|
-
gridFloor.position.y = -0.02;
|
|
183032
|
-
scene.add(gridFloor);
|
|
183033
|
-
const walls = options.wallColors ? buildSurfaceWallMeshes(
|
|
183034
|
-
three,
|
|
183035
|
-
options.cols,
|
|
183036
|
-
options.rows,
|
|
183037
|
-
MAX_VALUE_HEIGHT,
|
|
183038
|
-
options.wallColors,
|
|
183039
|
-
extent
|
|
183040
|
-
) : null;
|
|
183041
|
-
for (const mesh of walls?.meshes ?? []) {
|
|
183042
|
-
scene.add(mesh);
|
|
183043
|
-
}
|
|
183044
|
-
const baseTextures = createBarChart3DTextureManager(three);
|
|
183045
|
-
const textures = {
|
|
183046
|
-
load: (url) => baseTextures.load(url).then((texture) => {
|
|
183047
|
-
setTimeout(ctx.requestRender, 0);
|
|
183048
|
-
return texture;
|
|
183049
|
-
}),
|
|
183050
|
-
disposeAll: () => baseTextures.disposeAll()
|
|
183051
|
-
};
|
|
183052
|
-
const {
|
|
183053
|
-
meshes: boxMeshes,
|
|
183054
|
-
materials: boxMaterials,
|
|
183055
|
-
geometries: boxGeometries,
|
|
183056
|
-
materialDisposers: boxMaterialDisposers
|
|
183057
|
-
} = buildBar3DMeshGroup(
|
|
183058
|
-
three,
|
|
183059
|
-
scene,
|
|
183060
|
-
options.boxes,
|
|
183061
|
-
options.horizontal,
|
|
183062
|
-
options.picture ? { context: options.picture, textures } : void 0
|
|
183063
|
-
);
|
|
183064
|
-
const hoverTooltip = attachChart3DHoverTooltip({
|
|
183065
|
-
three,
|
|
183066
|
-
canvas,
|
|
183067
|
-
camera,
|
|
183068
|
-
meshes: boxMeshes,
|
|
183069
|
-
buildTooltip: (intersection) => buildBarChart3DHoverTooltip(intersection?.object.userData, {
|
|
183070
|
-
categoryLabels: options.categoryLabels,
|
|
183071
|
-
seriesNames: options.seriesNames,
|
|
183072
|
-
numberFormats: options.numberFormats
|
|
183073
|
-
})
|
|
183074
|
-
});
|
|
183075
|
-
const interaction = hostedChart3DInteraction(ctx);
|
|
183076
|
-
const pointerInteraction = attachBarChart3DInteraction({
|
|
183077
|
-
three,
|
|
183078
|
-
canvas,
|
|
183079
|
-
camera,
|
|
183080
|
-
controls: stage.controls,
|
|
183081
|
-
width: stage.width,
|
|
183082
|
-
height: stage.height,
|
|
183083
|
-
boxMeshes,
|
|
183084
|
-
boxMaterials,
|
|
183085
|
-
boxes: options.boxes,
|
|
183086
|
-
grouping: options.grouping,
|
|
183087
|
-
horizontal: Boolean(options.horizontal),
|
|
183088
|
-
interaction
|
|
183089
|
-
});
|
|
183090
|
-
const labels = buildCartesianChart3DLabels(
|
|
183091
|
-
options.cols,
|
|
183092
|
-
options.rows,
|
|
183093
|
-
options.categoryLabels,
|
|
183094
|
-
options.seriesNames,
|
|
183095
|
-
options.view3D?.depthPercent,
|
|
183096
|
-
void 0,
|
|
183097
|
-
void 0,
|
|
183098
|
-
options.horizontal
|
|
183099
|
-
);
|
|
183100
|
-
const labelProjector = createChart3DLabelProjector(three, ctx.document, labels);
|
|
183101
|
-
labelProjector.applyTextStyle(options.textStyle);
|
|
183102
|
-
ctx.overlay.appendChild(labelProjector.layer);
|
|
183103
|
-
return finishHostedChart3DScene(
|
|
183104
|
-
ctx,
|
|
183105
|
-
stage,
|
|
183106
|
-
{
|
|
183107
|
-
afterRender: (cam, width, height) => labelProjector.update(cam, width, height),
|
|
183108
|
-
resize: (width, height) => pointerInteraction.updateSize(width, height),
|
|
183109
|
-
setSelectedPart: (part) => pointerInteraction.setSelectedPart(part),
|
|
183110
|
-
setTextStyle: (style) => labelProjector.applyTextStyle(style),
|
|
183111
|
-
dispose() {
|
|
183112
|
-
hoverTooltip.dispose();
|
|
183113
|
-
pointerInteraction.dispose();
|
|
183114
|
-
for (const g2 of boxGeometries) {
|
|
183115
|
-
g2.dispose();
|
|
183116
|
-
}
|
|
183117
|
-
for (const disposeMaterial of boxMaterialDisposers) {
|
|
183118
|
-
disposeMaterial();
|
|
183119
|
-
}
|
|
183120
|
-
textures.disposeAll();
|
|
183121
|
-
gridFloor.dispose();
|
|
183122
|
-
walls?.dispose();
|
|
183123
|
-
labelProjector.layer.remove();
|
|
183124
|
-
}
|
|
183125
|
-
},
|
|
183126
|
-
interaction
|
|
183127
|
-
);
|
|
183128
|
-
}
|
|
183129
|
-
var init_bar_chart_3d_scene = __esm2({
|
|
183130
|
-
"src/render/bar-chart-3d-scene.ts"() {
|
|
183131
|
-
init_bar_chart_3d_geometry();
|
|
183132
|
-
init_bar_chart_3d_hit_test();
|
|
183133
|
-
init_bar_chart_3d_interaction_wiring();
|
|
183134
|
-
init_bar_chart_3d_materials();
|
|
183135
|
-
init_cartesian_chart_3d_geom();
|
|
183136
|
-
init_chart_3d_hosted_stage();
|
|
183137
|
-
init_chart_3d_hover_tooltip();
|
|
183138
|
-
init_chart_3d_label_projection();
|
|
183139
|
-
init_surface_chart_3d_walls();
|
|
183140
|
-
}
|
|
183141
|
-
});
|
|
183142
|
-
function buildCartesianChart3DHoverTooltip(hit, data) {
|
|
183143
|
-
if (!hit) {
|
|
183144
|
-
return void 0;
|
|
183145
|
-
}
|
|
183146
|
-
return buildMarkTooltip(
|
|
183147
|
-
data.seriesNames[hit.seriesIndex],
|
|
183148
|
-
data.categoryLabels[hit.categoryIndex],
|
|
183149
|
-
hit.value,
|
|
183150
|
-
data.numberFormats?.[hit.seriesIndex]
|
|
183151
|
-
);
|
|
183152
|
-
}
|
|
183153
|
-
var init_cartesian_chart_3d_hit_test = __esm2({
|
|
183154
|
-
"src/render/cartesian-chart-3d-hit-test.ts"() {
|
|
183155
|
-
init_chart_view_model();
|
|
183156
|
-
}
|
|
183157
|
-
});
|
|
183158
|
-
function calibrateCartesianChart3DDrag(markerPosition, value) {
|
|
183159
|
-
if (Math.abs(value) < 1e-9) {
|
|
183160
|
-
return null;
|
|
183161
|
-
}
|
|
183162
|
-
return {
|
|
183163
|
-
worldAtValue0: [markerPosition[0], 0, markerPosition[2]],
|
|
183164
|
-
value0: 0,
|
|
183165
|
-
worldAtValue1: markerPosition,
|
|
183166
|
-
value1: value
|
|
183167
|
-
};
|
|
183168
|
-
}
|
|
183169
|
-
var init_cartesian_chart_3d_drag = __esm2({
|
|
183170
|
-
"src/render/cartesian-chart-3d-drag.ts"() {
|
|
183171
|
-
}
|
|
183172
|
-
});
|
|
183173
|
-
function attachCartesianChart3DInteraction(params) {
|
|
183174
|
-
const highlightEntries = params.markerMeshes.map((mesh, i2) => {
|
|
183175
|
-
const hit = mesh.userData;
|
|
183176
|
-
return {
|
|
183177
|
-
mark: { seriesIndex: hit.seriesIndex, pointIndex: hit.categoryIndex },
|
|
183178
|
-
material: params.markerMaterials[i2]
|
|
183179
|
-
};
|
|
183180
|
-
});
|
|
183181
|
-
return attachChart3DPointerInteraction({
|
|
183182
|
-
three: params.three,
|
|
183183
|
-
canvas: params.canvas,
|
|
183184
|
-
camera: params.camera,
|
|
183185
|
-
width: params.width,
|
|
183186
|
-
height: params.height,
|
|
183187
|
-
meshes: params.markerMeshes,
|
|
183188
|
-
resolveHit: (intersection) => {
|
|
183189
|
-
const hit = intersection.object.userData;
|
|
183190
|
-
return chart3DHitToPartRef(
|
|
183191
|
-
hit ? { seriesIndex: hit.seriesIndex, pointIndex: hit.categoryIndex } : null
|
|
183192
|
-
);
|
|
183193
|
-
},
|
|
183194
|
-
calibrateDrag: (intersection) => {
|
|
183195
|
-
const hit = intersection.object.userData;
|
|
183196
|
-
const vertex = params.series[hit.seriesIndex]?.vertices.find(
|
|
183197
|
-
(v) => v.categoryIndex === hit.categoryIndex
|
|
183198
|
-
);
|
|
183199
|
-
return vertex ? calibrateCartesianChart3DDrag(vertex.position, hit.value) : null;
|
|
183200
|
-
},
|
|
183201
|
-
applyHighlight: (part) => applyChart3DMeshHighlight(highlightEntries, part),
|
|
183202
|
-
setControlsEnabled: (enabled) => {
|
|
183203
|
-
params.controls.enabled = enabled;
|
|
183204
|
-
},
|
|
183205
|
-
onSelect: params.interaction?.onSelect,
|
|
183206
|
-
onValueDragPreview: params.interaction?.onValueDragPreview,
|
|
183207
|
-
onValueDragCommit: params.interaction?.onValueDragCommit
|
|
183208
|
-
});
|
|
183209
|
-
}
|
|
183210
|
-
var init_cartesian_chart_3d_interaction_wiring = __esm2({
|
|
183211
|
-
"src/render/cartesian-chart-3d-interaction-wiring.ts"() {
|
|
183212
|
-
init_cartesian_chart_3d_drag();
|
|
183213
|
-
init_chart_3d_interaction();
|
|
183214
|
-
init_chart_3d_mesh_highlight();
|
|
183215
|
-
init_chart_3d_pointer_interaction();
|
|
183216
|
-
}
|
|
183217
|
-
});
|
|
183218
|
-
function createLineChart3DScene(ctx, options) {
|
|
183219
|
-
const placement = computeCartesianCameraPlacement(options.cols, options.rows, options.view3D);
|
|
183220
|
-
const stage = createHostedChart3DStage(
|
|
183221
|
-
ctx,
|
|
183222
|
-
placement,
|
|
183223
|
-
{ minDistance: 0.5, maxDistance: 30 },
|
|
183224
|
-
0.6
|
|
183225
|
-
);
|
|
183226
|
-
const { three, scene, camera, canvas, controls, width, height } = stage;
|
|
183227
|
-
const interaction = hostedChart3DInteraction(ctx);
|
|
183228
|
-
const extent = computeCartesianGridExtent(
|
|
183229
|
-
options.cols,
|
|
183230
|
-
options.rows,
|
|
183231
|
-
options.view3D?.depthPercent
|
|
183232
|
-
);
|
|
183233
|
-
const floorSize = Math.max(extent.gridWidth, extent.gridDepth) * 1.2;
|
|
183234
|
-
const gridFloor = new three.GridHelper(
|
|
183235
|
-
floorSize,
|
|
183236
|
-
Math.max(options.cols, options.rows),
|
|
183237
|
-
13421772,
|
|
183238
|
-
15263976
|
|
183239
|
-
);
|
|
183240
|
-
gridFloor.position.y = -0.02;
|
|
183241
|
-
scene.add(gridFloor);
|
|
183242
|
-
const walls = options.wallColors ? buildSurfaceWallMeshes(
|
|
183243
|
-
three,
|
|
183244
|
-
options.cols,
|
|
183245
|
-
options.rows,
|
|
183246
|
-
MAX_VALUE_HEIGHT,
|
|
183247
|
-
options.wallColors,
|
|
183248
|
-
extent
|
|
183249
|
-
) : null;
|
|
183250
|
-
for (const mesh of walls?.meshes ?? []) {
|
|
183251
|
-
scene.add(mesh);
|
|
183252
|
-
}
|
|
183253
|
-
const markerGeometry = new three.SphereGeometry(MARKER_RADIUS2, 8, 6);
|
|
183254
|
-
const tubeGeometries = [];
|
|
183255
|
-
const tubeMaterials = [];
|
|
183256
|
-
const markerMeshes = [];
|
|
183257
|
-
const markerMaterials = [];
|
|
183258
|
-
for (const path of options.series) {
|
|
183259
|
-
if (path.vertices.length >= 2) {
|
|
183260
|
-
const curve = new three.CatmullRomCurve3(
|
|
183261
|
-
path.vertices.map((v) => new three.Vector3(...v.position))
|
|
183262
|
-
);
|
|
183263
|
-
const tubeGeometry = new three.TubeGeometry(
|
|
183264
|
-
curve,
|
|
183265
|
-
Math.max(path.vertices.length * 8, 16),
|
|
183266
|
-
TUBE_RADIUS,
|
|
183267
|
-
8,
|
|
183268
|
-
false
|
|
183269
|
-
);
|
|
183270
|
-
const tubeMaterial = new three.MeshPhongMaterial({ color: path.color, shininess: 30 });
|
|
183271
|
-
const tube = new three.Mesh(tubeGeometry, tubeMaterial);
|
|
183272
|
-
scene.add(tube);
|
|
183273
|
-
tubeGeometries.push(tubeGeometry);
|
|
183274
|
-
tubeMaterials.push(tubeMaterial);
|
|
183275
|
-
}
|
|
183276
|
-
for (const v of path.vertices) {
|
|
183277
|
-
const markerMaterial = new three.MeshPhongMaterial({ color: path.color, shininess: 30 });
|
|
183278
|
-
const marker = new three.Mesh(markerGeometry, markerMaterial);
|
|
183279
|
-
marker.position.set(...v.position);
|
|
183280
|
-
marker.userData = {
|
|
183281
|
-
seriesIndex: v.seriesIndex,
|
|
183282
|
-
categoryIndex: v.categoryIndex,
|
|
183283
|
-
value: v.value
|
|
183284
|
-
};
|
|
183285
|
-
scene.add(marker);
|
|
183286
|
-
markerMeshes.push(marker);
|
|
183287
|
-
markerMaterials.push(markerMaterial);
|
|
183288
|
-
}
|
|
183289
|
-
}
|
|
183290
|
-
const tooltipData = {
|
|
183291
|
-
categoryLabels: options.categoryLabels,
|
|
183292
|
-
seriesNames: options.seriesNames,
|
|
183293
|
-
numberFormats: options.numberFormats
|
|
183294
|
-
};
|
|
183295
|
-
const hoverTooltip = attachChart3DHoverTooltip({
|
|
183296
|
-
three,
|
|
183297
|
-
canvas,
|
|
183298
|
-
camera,
|
|
183299
|
-
meshes: markerMeshes,
|
|
183300
|
-
buildTooltip: (intersection) => buildCartesianChart3DHoverTooltip(
|
|
183301
|
-
intersection?.object.userData,
|
|
183302
|
-
tooltipData
|
|
183303
|
-
)
|
|
183304
|
-
});
|
|
183305
|
-
const pointerInteraction = attachCartesianChart3DInteraction({
|
|
183306
|
-
three,
|
|
183307
|
-
canvas,
|
|
183308
|
-
camera,
|
|
183309
|
-
controls,
|
|
183310
|
-
width,
|
|
183311
|
-
height,
|
|
183312
|
-
markerMeshes,
|
|
183313
|
-
markerMaterials,
|
|
183314
|
-
series: options.series,
|
|
183315
|
-
interaction
|
|
183316
|
-
});
|
|
183317
|
-
const labels = buildCartesianChart3DLabels(
|
|
183318
|
-
options.cols,
|
|
183319
|
-
options.rows,
|
|
183320
|
-
options.categoryLabels,
|
|
183321
|
-
options.seriesNames,
|
|
183322
|
-
options.view3D?.depthPercent
|
|
183323
|
-
);
|
|
183324
|
-
const labelProjector = createChart3DLabelProjector(three, ctx.document, labels);
|
|
183325
|
-
labelProjector.applyTextStyle(options.textStyle);
|
|
183326
|
-
ctx.overlay.appendChild(labelProjector.layer);
|
|
183327
|
-
return finishHostedChart3DScene(
|
|
183328
|
-
ctx,
|
|
183329
|
-
stage,
|
|
183330
|
-
{
|
|
183331
|
-
afterRender: (cam, w, h2) => labelProjector.update(cam, w, h2),
|
|
183332
|
-
resize: (w, h2) => pointerInteraction.updateSize(w, h2),
|
|
183333
|
-
setSelectedPart: (part) => pointerInteraction.setSelectedPart(part),
|
|
183334
|
-
setTextStyle: (style) => labelProjector.applyTextStyle(style),
|
|
183335
|
-
dispose() {
|
|
183336
|
-
hoverTooltip.dispose();
|
|
183337
|
-
pointerInteraction.dispose();
|
|
183338
|
-
markerGeometry.dispose();
|
|
183339
|
-
for (const g2 of tubeGeometries) {
|
|
183340
|
-
g2.dispose();
|
|
183341
|
-
}
|
|
183342
|
-
for (const m of [...tubeMaterials, ...markerMaterials]) {
|
|
183343
|
-
m.dispose();
|
|
183344
|
-
}
|
|
183345
|
-
gridFloor.dispose();
|
|
183346
|
-
walls?.dispose();
|
|
183347
|
-
labelProjector.layer.remove();
|
|
183348
|
-
}
|
|
183349
|
-
},
|
|
183350
|
-
interaction
|
|
183351
|
-
);
|
|
183352
|
-
}
|
|
183353
|
-
var TUBE_RADIUS;
|
|
183354
|
-
var MARKER_RADIUS2;
|
|
183355
|
-
var init_line_chart_3d_scene = __esm2({
|
|
183356
|
-
"src/render/line-chart-3d-scene.ts"() {
|
|
183357
|
-
init_cartesian_chart_3d_geom();
|
|
183358
|
-
init_cartesian_chart_3d_hit_test();
|
|
183359
|
-
init_cartesian_chart_3d_interaction_wiring();
|
|
183360
|
-
init_chart_3d_hosted_stage();
|
|
183361
|
-
init_chart_3d_hover_tooltip();
|
|
183362
|
-
init_chart_3d_label_projection();
|
|
183363
|
-
init_surface_chart_3d_walls();
|
|
183364
|
-
TUBE_RADIUS = 0.025;
|
|
183365
|
-
MARKER_RADIUS2 = 0.045;
|
|
183366
|
-
}
|
|
183367
|
-
});
|
|
183368
|
-
function buildAreaRibbonGeometry(three, path) {
|
|
183369
|
-
const triangles = buildAreaRibbonTriangles(path);
|
|
183370
|
-
if (triangles.length === 0) {
|
|
183371
|
-
return null;
|
|
183372
|
-
}
|
|
183373
|
-
const geometry = new three.BufferGeometry();
|
|
183374
|
-
geometry.setAttribute("position", new three.Float32BufferAttribute(triangles, 3));
|
|
183375
|
-
geometry.computeVertexNormals();
|
|
183376
|
-
return geometry;
|
|
183377
|
-
}
|
|
183378
|
-
var init_area_chart_3d_ribbon_geometry = __esm2({
|
|
183379
|
-
"src/render/area-chart-3d-ribbon-geometry.ts"() {
|
|
183380
|
-
init_cartesian_line_chart_3d_layout();
|
|
183381
|
-
}
|
|
183382
|
-
});
|
|
183383
|
-
function createAreaChart3DScene(ctx, options) {
|
|
183384
|
-
const placement = computeCartesianCameraPlacement(options.cols, options.rows, options.view3D);
|
|
183385
|
-
const stage = createHostedChart3DStage(
|
|
183386
|
-
ctx,
|
|
183387
|
-
placement,
|
|
183388
|
-
{ minDistance: 0.5, maxDistance: 30 },
|
|
183389
|
-
0.6
|
|
183390
|
-
);
|
|
183391
|
-
const { three, scene, camera, canvas, controls, width, height } = stage;
|
|
183392
|
-
const interaction = hostedChart3DInteraction(ctx);
|
|
183393
|
-
const extent = computeCartesianGridExtent(
|
|
183394
|
-
options.cols,
|
|
183395
|
-
options.rows,
|
|
183396
|
-
options.view3D?.depthPercent
|
|
183397
|
-
);
|
|
183398
|
-
const floorSize = Math.max(extent.gridWidth, extent.gridDepth) * 1.2;
|
|
183399
|
-
const gridSegs = Math.max(options.cols, options.rows);
|
|
183400
|
-
const gridFloor = new three.GridHelper(floorSize, gridSegs, 13421772, 15263976);
|
|
183401
|
-
gridFloor.position.y = -0.02;
|
|
183402
|
-
scene.add(gridFloor);
|
|
183403
|
-
const walls = options.wallColors ? buildSurfaceWallMeshes(
|
|
183404
|
-
three,
|
|
183405
|
-
options.cols,
|
|
183406
|
-
options.rows,
|
|
183407
|
-
MAX_VALUE_HEIGHT,
|
|
183408
|
-
options.wallColors,
|
|
183409
|
-
extent
|
|
183410
|
-
) : null;
|
|
183411
|
-
for (const mesh of walls?.meshes ?? []) {
|
|
183412
|
-
scene.add(mesh);
|
|
183413
|
-
}
|
|
183414
|
-
const markerGeometry = new three.SphereGeometry(MARKER_RADIUS3, 8, 6);
|
|
183415
|
-
const tubeGeometries = [];
|
|
183416
|
-
const ribbonGeometries = [];
|
|
183417
|
-
const otherMaterials = [];
|
|
183418
|
-
const markerMeshes = [];
|
|
183419
|
-
const markerMaterials = [];
|
|
183420
|
-
for (const path of options.series) {
|
|
183421
|
-
const ribbonGeometry = buildAreaRibbonGeometry(three, path);
|
|
183422
|
-
if (ribbonGeometry) {
|
|
183423
|
-
const ribbonMaterial = new three.MeshPhongMaterial({
|
|
183424
|
-
color: path.color,
|
|
183425
|
-
side: three.DoubleSide,
|
|
183426
|
-
transparent: true,
|
|
183427
|
-
opacity: RIBBON_OPACITY,
|
|
183428
|
-
shininess: 10
|
|
183429
|
-
});
|
|
183430
|
-
scene.add(new three.Mesh(ribbonGeometry, ribbonMaterial));
|
|
183431
|
-
ribbonGeometries.push(ribbonGeometry);
|
|
183432
|
-
otherMaterials.push(ribbonMaterial);
|
|
183433
|
-
}
|
|
183434
|
-
if (path.vertices.length >= 2) {
|
|
183435
|
-
const curve = new three.CatmullRomCurve3(
|
|
183436
|
-
path.vertices.map((v) => new three.Vector3(...v.position))
|
|
183437
|
-
);
|
|
183438
|
-
const tubeGeometry = new three.TubeGeometry(
|
|
183439
|
-
curve,
|
|
183440
|
-
Math.max(path.vertices.length * 8, 16),
|
|
183441
|
-
TUBE_RADIUS2,
|
|
183442
|
-
8,
|
|
183443
|
-
false
|
|
183444
|
-
);
|
|
183445
|
-
const tubeMaterial = new three.MeshPhongMaterial({ color: path.color, shininess: 30 });
|
|
183446
|
-
scene.add(new three.Mesh(tubeGeometry, tubeMaterial));
|
|
183447
|
-
tubeGeometries.push(tubeGeometry);
|
|
183448
|
-
otherMaterials.push(tubeMaterial);
|
|
183449
|
-
}
|
|
183450
|
-
for (const v of path.vertices) {
|
|
183451
|
-
const markerMaterial = new three.MeshPhongMaterial({ color: path.color, shininess: 30 });
|
|
183452
|
-
const marker = new three.Mesh(markerGeometry, markerMaterial);
|
|
183453
|
-
marker.position.set(...v.position);
|
|
183454
|
-
marker.userData = {
|
|
183455
|
-
seriesIndex: v.seriesIndex,
|
|
183456
|
-
categoryIndex: v.categoryIndex,
|
|
183457
|
-
value: v.value
|
|
183458
|
-
};
|
|
183459
|
-
scene.add(marker);
|
|
183460
|
-
markerMeshes.push(marker);
|
|
183461
|
-
markerMaterials.push(markerMaterial);
|
|
183462
|
-
otherMaterials.push(markerMaterial);
|
|
183463
|
-
}
|
|
183464
|
-
}
|
|
183465
|
-
const tooltipData = {
|
|
183466
|
-
categoryLabels: options.categoryLabels,
|
|
183467
|
-
seriesNames: options.seriesNames,
|
|
183468
|
-
numberFormats: options.numberFormats
|
|
183469
|
-
};
|
|
183470
|
-
const hoverTooltip = attachChart3DHoverTooltip({
|
|
183471
|
-
three,
|
|
183472
|
-
canvas,
|
|
183473
|
-
camera,
|
|
183474
|
-
meshes: markerMeshes,
|
|
183475
|
-
buildTooltip: (intersection) => buildCartesianChart3DHoverTooltip(
|
|
183476
|
-
intersection?.object.userData,
|
|
183477
|
-
tooltipData
|
|
183478
|
-
)
|
|
183479
|
-
});
|
|
183480
|
-
const pointerInteraction = attachCartesianChart3DInteraction({
|
|
183481
|
-
three,
|
|
183482
|
-
canvas,
|
|
183483
|
-
camera,
|
|
183484
|
-
controls,
|
|
183485
|
-
width,
|
|
183486
|
-
height,
|
|
183487
|
-
markerMeshes,
|
|
183488
|
-
markerMaterials,
|
|
183489
|
-
series: options.series,
|
|
183490
|
-
interaction
|
|
183491
|
-
});
|
|
183492
|
-
const labels = buildCartesianChart3DLabels(
|
|
183493
|
-
options.cols,
|
|
183494
|
-
options.rows,
|
|
183495
|
-
options.categoryLabels,
|
|
183496
|
-
options.seriesNames,
|
|
183497
|
-
options.view3D?.depthPercent
|
|
183498
|
-
);
|
|
183499
|
-
const labelProjector = createChart3DLabelProjector(three, ctx.document, labels);
|
|
183500
|
-
labelProjector.applyTextStyle(options.textStyle);
|
|
183501
|
-
ctx.overlay.appendChild(labelProjector.layer);
|
|
183502
|
-
return finishHostedChart3DScene(
|
|
183503
|
-
ctx,
|
|
183504
|
-
stage,
|
|
183505
|
-
{
|
|
183506
|
-
afterRender: (cam, w, h2) => labelProjector.update(cam, w, h2),
|
|
183507
|
-
resize: (w, h2) => pointerInteraction.updateSize(w, h2),
|
|
183508
|
-
setSelectedPart: (part) => pointerInteraction.setSelectedPart(part),
|
|
183509
|
-
setTextStyle: (style) => labelProjector.applyTextStyle(style),
|
|
183510
|
-
dispose() {
|
|
183511
|
-
hoverTooltip.dispose();
|
|
183512
|
-
pointerInteraction.dispose();
|
|
183513
|
-
markerGeometry.dispose();
|
|
183514
|
-
for (const g2 of [...tubeGeometries, ...ribbonGeometries]) {
|
|
183515
|
-
g2.dispose();
|
|
183516
|
-
}
|
|
183517
|
-
for (const m of otherMaterials) {
|
|
183518
|
-
m.dispose();
|
|
183519
|
-
}
|
|
183520
|
-
gridFloor.dispose();
|
|
183521
|
-
walls?.dispose();
|
|
183522
|
-
labelProjector.layer.remove();
|
|
183523
|
-
}
|
|
183524
|
-
},
|
|
183525
|
-
interaction
|
|
183526
|
-
);
|
|
183527
|
-
}
|
|
183528
|
-
var TUBE_RADIUS2;
|
|
183529
|
-
var MARKER_RADIUS3;
|
|
183530
|
-
var RIBBON_OPACITY;
|
|
183531
|
-
var init_area_chart_3d_scene = __esm2({
|
|
183532
|
-
"src/render/area-chart-3d-scene.ts"() {
|
|
183533
|
-
init_area_chart_3d_ribbon_geometry();
|
|
183534
|
-
init_cartesian_chart_3d_geom();
|
|
183535
|
-
init_cartesian_chart_3d_hit_test();
|
|
183536
|
-
init_cartesian_chart_3d_interaction_wiring();
|
|
183537
|
-
init_chart_3d_hosted_stage();
|
|
183538
|
-
init_chart_3d_hover_tooltip();
|
|
183539
|
-
init_chart_3d_label_projection();
|
|
183540
|
-
init_surface_chart_3d_walls();
|
|
183541
|
-
TUBE_RADIUS2 = 0.02;
|
|
183542
|
-
MARKER_RADIUS3 = 0.045;
|
|
183543
|
-
RIBBON_OPACITY = 0.75;
|
|
183544
|
-
}
|
|
183545
|
-
});
|
|
183546
|
-
function buildPieChart3DHoverTooltip(hit, data) {
|
|
183547
|
-
if (!hit) {
|
|
183548
|
-
return void 0;
|
|
183549
|
-
}
|
|
183550
|
-
return buildMarkTooltip(
|
|
183551
|
-
data.seriesName,
|
|
183552
|
-
data.categoryLabels[hit.pointIndex],
|
|
183553
|
-
hit.value,
|
|
183554
|
-
data.numberFormat
|
|
183555
|
-
);
|
|
183556
|
-
}
|
|
183557
|
-
var init_pie_chart_3d_hit_test = __esm2({
|
|
183558
|
-
"src/render/pie-chart-3d-hit-test.ts"() {
|
|
183559
|
-
init_chart_view_model();
|
|
183560
|
-
}
|
|
183561
|
-
});
|
|
183562
|
-
function pieChart3DPointerAngle(x, z) {
|
|
183563
|
-
return Math.atan2(x, z);
|
|
183564
|
-
}
|
|
183565
|
-
function resolvePieChart3DDragValue(geometry, pointerAngle) {
|
|
183566
|
-
return resolvePieSliceShareValue(
|
|
183567
|
-
pointerAngle,
|
|
183568
|
-
geometry.leadingAngle,
|
|
183569
|
-
geometry.values,
|
|
183570
|
-
geometry.pointIndex
|
|
183571
|
-
);
|
|
183572
|
-
}
|
|
183573
|
-
var init_pie_chart_3d_drag = __esm2({
|
|
183574
|
-
"src/render/pie-chart-3d-drag.ts"() {
|
|
183575
|
-
init_chart_interaction_pie();
|
|
183576
|
-
}
|
|
183577
|
-
});
|
|
183578
|
-
function attachPieChart3DInteraction(params) {
|
|
183579
|
-
const raycaster = new params.three.Raycaster();
|
|
183580
|
-
const ndc = new params.three.Vector2();
|
|
183581
|
-
const plane = new params.three.Plane(new params.three.Vector3(0, 1, 0), 0);
|
|
183582
|
-
const planeHit = new params.three.Vector3();
|
|
183583
|
-
let dragState = null;
|
|
183584
|
-
const highlightEntries = params.wedgeMeshes.map((mesh, i2) => {
|
|
183585
|
-
const hit = mesh.userData;
|
|
183586
|
-
return {
|
|
183587
|
-
mark: { seriesIndex: 0, pointIndex: hit.pointIndex },
|
|
183588
|
-
material: params.wedgeMaterials[i2]
|
|
183589
|
-
};
|
|
183590
|
-
});
|
|
183591
|
-
function setNdc(clientX, clientY) {
|
|
183592
|
-
const rect22 = params.canvas.getBoundingClientRect();
|
|
183593
|
-
if (rect22.width <= 0 || rect22.height <= 0) {
|
|
183594
|
-
return false;
|
|
183595
|
-
}
|
|
183596
|
-
ndc.x = (clientX - rect22.left) / rect22.width * 2 - 1;
|
|
183597
|
-
ndc.y = -((clientY - rect22.top) / rect22.height) * 2 + 1;
|
|
183598
|
-
return true;
|
|
183599
|
-
}
|
|
183600
|
-
function raycastWedge(clientX, clientY) {
|
|
183601
|
-
if (!setNdc(clientX, clientY)) {
|
|
183602
|
-
return void 0;
|
|
183603
|
-
}
|
|
183604
|
-
raycaster.setFromCamera(ndc, params.camera);
|
|
183605
|
-
return raycaster.intersectObjects(params.wedgeMeshes, false)[0];
|
|
183606
|
-
}
|
|
183607
|
-
function planeAngleAt(clientX, clientY) {
|
|
183608
|
-
if (!setNdc(clientX, clientY)) {
|
|
183609
|
-
return null;
|
|
183610
|
-
}
|
|
183611
|
-
raycaster.setFromCamera(ndc, params.camera);
|
|
183612
|
-
const hit = raycaster.ray.intersectPlane(plane, planeHit);
|
|
183613
|
-
return hit ? pieChart3DPointerAngle(hit.x, hit.z) : null;
|
|
183614
|
-
}
|
|
183615
|
-
function setSelectedPart(part) {
|
|
183616
|
-
applyChart3DMeshHighlight(highlightEntries, part);
|
|
183617
|
-
}
|
|
183618
|
-
function travelBelowThreshold(clientX, clientY, state) {
|
|
183619
|
-
const dx = clientX - state.startClientX;
|
|
183620
|
-
const dy = clientY - state.startClientY;
|
|
183621
|
-
return Math.hypot(dx, dy) < CHART_3D_DRAG_THRESHOLD_PX;
|
|
183622
|
-
}
|
|
183623
|
-
const onPointerDown = (event) => {
|
|
183624
|
-
params.canvas.setPointerCapture?.(
|
|
183625
|
-
event.pointerId
|
|
183626
|
-
);
|
|
183627
|
-
const hit = raycastWedge(event.clientX, event.clientY);
|
|
183628
|
-
const hitData = hit?.object.userData;
|
|
183629
|
-
const part = chart3DHitToPartRef(
|
|
183630
|
-
hitData ? { seriesIndex: 0, pointIndex: hitData.pointIndex } : null
|
|
183631
|
-
);
|
|
183632
|
-
const armed = part !== null && isChartInteractionArmed(params.canvas);
|
|
183633
|
-
if (armed) {
|
|
183634
|
-
event.stopPropagation();
|
|
183635
|
-
}
|
|
183636
|
-
let geometry = null;
|
|
183637
|
-
if (part && hitData && armed) {
|
|
183638
|
-
const wedges = params.getWedges();
|
|
183639
|
-
const wedge = wedges.find((w) => w.pointIndex === hitData.pointIndex);
|
|
183640
|
-
if (wedge) {
|
|
183641
|
-
geometry = {
|
|
183642
|
-
values: wedges.map((w) => w.value),
|
|
183643
|
-
pointIndex: hitData.pointIndex,
|
|
183644
|
-
leadingAngle: wedge.startAngle
|
|
183645
|
-
};
|
|
183646
|
-
}
|
|
183647
|
-
}
|
|
183648
|
-
dragState = {
|
|
183649
|
-
part,
|
|
183650
|
-
geometry,
|
|
183651
|
-
moved: false,
|
|
183652
|
-
startClientX: event.clientX,
|
|
183653
|
-
startClientY: event.clientY,
|
|
183654
|
-
lastAngle: null
|
|
183655
|
-
};
|
|
183656
|
-
if (geometry) {
|
|
183657
|
-
event.preventDefault();
|
|
183658
|
-
params.controls.enabled = false;
|
|
183659
|
-
}
|
|
183660
|
-
};
|
|
183661
|
-
const onPointerMove = (event) => {
|
|
183662
|
-
const state = dragState;
|
|
183663
|
-
if (!state || !state.part || !state.geometry) {
|
|
183664
|
-
return;
|
|
183665
|
-
}
|
|
183666
|
-
if (!state.moved && travelBelowThreshold(event.clientX, event.clientY, state)) {
|
|
183667
|
-
return;
|
|
183668
|
-
}
|
|
183669
|
-
state.moved = true;
|
|
183670
|
-
const angle = planeAngleAt(event.clientX, event.clientY);
|
|
183671
|
-
if (angle === null) {
|
|
183672
|
-
return;
|
|
183673
|
-
}
|
|
183674
|
-
state.lastAngle = angle;
|
|
183675
|
-
const value = resolvePieChart3DDragValue(state.geometry, angle);
|
|
183676
|
-
params.interaction?.onValueDragPreview?.(state.part, value);
|
|
183677
|
-
};
|
|
183678
|
-
const onPointerUp = (event) => {
|
|
183679
|
-
if (!dragState) {
|
|
183680
|
-
return;
|
|
183681
|
-
}
|
|
183682
|
-
const state = dragState;
|
|
183683
|
-
dragState = null;
|
|
183684
|
-
params.canvas.releasePointerCapture?.(event.pointerId);
|
|
183685
|
-
if (state.geometry) {
|
|
183686
|
-
params.controls.enabled = true;
|
|
183687
|
-
}
|
|
183688
|
-
if (state.moved && state.part && state.geometry) {
|
|
183689
|
-
const angle = planeAngleAt(event.clientX, event.clientY) ?? state.lastAngle;
|
|
183690
|
-
if (angle !== null) {
|
|
183691
|
-
const value = resolvePieChart3DDragValue(state.geometry, angle);
|
|
183692
|
-
params.interaction?.onValueDragCommit?.(state.part, value);
|
|
183693
|
-
}
|
|
183694
|
-
return;
|
|
183695
|
-
}
|
|
183696
|
-
setSelectedPart(state.part);
|
|
183697
|
-
params.interaction?.onSelect?.(state.part);
|
|
183698
|
-
};
|
|
183699
|
-
params.canvas.addEventListener("pointerdown", onPointerDown);
|
|
183700
|
-
params.canvas.addEventListener("pointermove", onPointerMove);
|
|
183701
|
-
params.canvas.addEventListener("pointerup", onPointerUp);
|
|
183702
|
-
params.canvas.addEventListener("pointercancel", onPointerUp);
|
|
183703
|
-
return {
|
|
183704
|
-
setSelectedPart,
|
|
183705
|
-
dispose() {
|
|
183706
|
-
params.canvas.removeEventListener("pointerdown", onPointerDown);
|
|
183707
|
-
params.canvas.removeEventListener("pointermove", onPointerMove);
|
|
183708
|
-
params.canvas.removeEventListener("pointerup", onPointerUp);
|
|
183709
|
-
params.canvas.removeEventListener("pointercancel", onPointerUp);
|
|
183710
|
-
}
|
|
183711
|
-
};
|
|
183712
|
-
}
|
|
183713
|
-
var init_pie_chart_3d_interaction_wiring = __esm2({
|
|
183714
|
-
"src/render/pie-chart-3d-interaction-wiring.ts"() {
|
|
183715
|
-
init_chart_3d_interaction();
|
|
183716
|
-
init_chart_3d_mesh_highlight();
|
|
183717
|
-
init_chart_canvas_drag();
|
|
183718
|
-
init_pie_chart_3d_drag();
|
|
183719
|
-
}
|
|
183720
|
-
});
|
|
183721
|
-
function wedgeSegments(thetaLength) {
|
|
183722
|
-
return Math.max(
|
|
183723
|
-
MIN_RADIAL_SEGMENTS,
|
|
183724
|
-
Math.round(thetaLength / (Math.PI * 2) * FULL_CIRCLE_SEGMENTS)
|
|
183725
|
-
);
|
|
183726
|
-
}
|
|
183727
|
-
function buildPieChart3DWedgeMeshes(three, scene, wedges, outerRadius, thickness) {
|
|
183728
|
-
const meshes = [];
|
|
183729
|
-
const geometries = [];
|
|
183730
|
-
const materials = [];
|
|
183731
|
-
for (const wedge of wedges) {
|
|
183732
|
-
const geometry = new three.CylinderGeometry(
|
|
183733
|
-
outerRadius,
|
|
183734
|
-
outerRadius,
|
|
183735
|
-
thickness,
|
|
183736
|
-
wedgeSegments(wedge.thetaLength),
|
|
183737
|
-
1,
|
|
183738
|
-
false,
|
|
183739
|
-
wedge.startAngle,
|
|
183740
|
-
wedge.thetaLength
|
|
183741
|
-
);
|
|
183742
|
-
const material = new three.MeshPhongMaterial({ color: wedge.color, shininess: 30 });
|
|
183743
|
-
const mesh = new three.Mesh(geometry, material);
|
|
183744
|
-
mesh.position.set(wedge.explodeOffset[0], 0, wedge.explodeOffset[1]);
|
|
183745
|
-
mesh.userData = { pointIndex: wedge.pointIndex, value: wedge.value };
|
|
183746
|
-
scene.add(mesh);
|
|
183747
|
-
meshes.push(mesh);
|
|
183748
|
-
geometries.push(geometry);
|
|
183749
|
-
materials.push(material);
|
|
183750
|
-
}
|
|
183751
|
-
return { meshes, geometries, materials };
|
|
183752
|
-
}
|
|
183753
|
-
function applyPieChart3DWedgeAngles(three, meshes, geometries, outerRadius, thickness, angles) {
|
|
183754
|
-
for (const angle of angles) {
|
|
183755
|
-
const mesh = meshes[angle.pointIndex];
|
|
183756
|
-
const oldGeometry = geometries[angle.pointIndex];
|
|
183757
|
-
if (!mesh || !oldGeometry) {
|
|
183758
|
-
continue;
|
|
183759
|
-
}
|
|
183760
|
-
const geometry = new three.CylinderGeometry(
|
|
183761
|
-
outerRadius,
|
|
183762
|
-
outerRadius,
|
|
183763
|
-
thickness,
|
|
183764
|
-
wedgeSegments(angle.thetaLength),
|
|
183765
|
-
1,
|
|
183766
|
-
false,
|
|
183767
|
-
angle.startAngle,
|
|
183768
|
-
angle.thetaLength
|
|
183769
|
-
);
|
|
183770
|
-
mesh.geometry = geometry;
|
|
183771
|
-
oldGeometry.dispose();
|
|
183772
|
-
geometries[angle.pointIndex] = geometry;
|
|
183773
|
-
mesh.position.set(angle.explodeOffset[0], 0, angle.explodeOffset[1]);
|
|
183774
|
-
mesh.userData = { pointIndex: angle.pointIndex, value: angle.value };
|
|
183775
|
-
}
|
|
183776
|
-
}
|
|
183777
|
-
var MIN_RADIAL_SEGMENTS;
|
|
183778
|
-
var FULL_CIRCLE_SEGMENTS;
|
|
183779
|
-
var init_pie_chart_3d_mesh = __esm2({
|
|
183780
|
-
"src/render/pie-chart-3d-mesh.ts"() {
|
|
183781
|
-
MIN_RADIAL_SEGMENTS = 3;
|
|
183782
|
-
FULL_CIRCLE_SEGMENTS = 64;
|
|
183783
|
-
}
|
|
183784
|
-
});
|
|
183785
|
-
function createPieChart3DScene(ctx, options) {
|
|
183786
|
-
const placement = computePieChart3DCameraPlacement(options.view3D);
|
|
183787
|
-
const stage = createHostedChart3DStage(
|
|
183788
|
-
ctx,
|
|
183789
|
-
placement,
|
|
183790
|
-
{ minDistance: 0.5, maxDistance: 30 },
|
|
183791
|
-
0.65
|
|
183792
|
-
);
|
|
183793
|
-
const { three, scene, camera, canvas, controls } = stage;
|
|
183794
|
-
const interaction = hostedChart3DInteraction(ctx);
|
|
183795
|
-
const {
|
|
183796
|
-
meshes: wedgeMeshes,
|
|
183797
|
-
geometries: wedgeGeometries,
|
|
183798
|
-
materials: wedgeMaterials
|
|
183799
|
-
} = buildPieChart3DWedgeMeshes(
|
|
183800
|
-
three,
|
|
183801
|
-
scene,
|
|
183802
|
-
options.wedges,
|
|
183803
|
-
options.outerRadius,
|
|
183804
|
-
options.thickness
|
|
183805
|
-
);
|
|
183806
|
-
const hoverTooltip = attachChart3DHoverTooltip({
|
|
183807
|
-
three,
|
|
183808
|
-
canvas,
|
|
183809
|
-
camera,
|
|
183810
|
-
meshes: wedgeMeshes,
|
|
183811
|
-
buildTooltip: (intersection) => buildPieChart3DHoverTooltip(intersection?.object.userData, {
|
|
183812
|
-
categoryLabels: options.categoryLabels,
|
|
183813
|
-
seriesName: options.seriesName,
|
|
183814
|
-
numberFormat: options.numberFormat
|
|
183815
|
-
})
|
|
183816
|
-
});
|
|
183817
|
-
let currentAngles = options.wedges;
|
|
183818
|
-
let liveValues = options.values.slice();
|
|
183819
|
-
function recomputeLiveAngles() {
|
|
183820
|
-
const angles = computePieChart3DSliceAngles(
|
|
183821
|
-
liveValues,
|
|
183822
|
-
options.explosions,
|
|
183823
|
-
options.firstSliceAngleDeg,
|
|
183824
|
-
options.outerRadius
|
|
183825
|
-
);
|
|
183826
|
-
currentAngles = angles;
|
|
183827
|
-
applyPieChart3DWedgeAngles(
|
|
183828
|
-
three,
|
|
183829
|
-
wedgeMeshes,
|
|
183830
|
-
wedgeGeometries,
|
|
183831
|
-
options.outerRadius,
|
|
183832
|
-
options.thickness,
|
|
183833
|
-
angles
|
|
183834
|
-
);
|
|
183835
|
-
}
|
|
183836
|
-
const pointerInteraction = attachPieChart3DInteraction({
|
|
183837
|
-
three,
|
|
183838
|
-
canvas,
|
|
183839
|
-
camera,
|
|
183840
|
-
controls,
|
|
183841
|
-
wedgeMeshes,
|
|
183842
|
-
wedgeMaterials,
|
|
183843
|
-
getWedges: () => currentAngles,
|
|
183844
|
-
interaction: {
|
|
183845
|
-
onSelect: interaction?.onSelect,
|
|
183846
|
-
onValueDragPreview: (part, value) => {
|
|
183847
|
-
if (part.pointIndex !== void 0) {
|
|
183848
|
-
liveValues = liveValues.map((v, i2) => i2 === part.pointIndex ? value : v);
|
|
183849
|
-
recomputeLiveAngles();
|
|
183850
|
-
}
|
|
183851
|
-
interaction?.onValueDragPreview?.(part, value);
|
|
183852
|
-
},
|
|
183853
|
-
onValueDragCommit: (part, value) => {
|
|
183854
|
-
if (part.pointIndex !== void 0) {
|
|
183855
|
-
liveValues = liveValues.map((v, i2) => i2 === part.pointIndex ? value : v);
|
|
183856
|
-
recomputeLiveAngles();
|
|
183857
|
-
}
|
|
183858
|
-
interaction?.onValueDragCommit?.(part, value);
|
|
183859
|
-
}
|
|
183860
|
-
}
|
|
183861
|
-
});
|
|
183862
|
-
return finishHostedChart3DScene(
|
|
183863
|
-
ctx,
|
|
183864
|
-
stage,
|
|
183865
|
-
{
|
|
183866
|
-
// No `resize`: this scene's own wiring re-derives the pointer's NDC
|
|
183867
|
-
// position from `canvas.getBoundingClientRect()` on every raycast.
|
|
183868
|
-
setSelectedPart: (part) => pointerInteraction.setSelectedPart(part),
|
|
183869
|
-
dispose() {
|
|
183870
|
-
hoverTooltip.dispose();
|
|
183871
|
-
pointerInteraction.dispose();
|
|
183872
|
-
for (const g2 of wedgeGeometries) {
|
|
183873
|
-
g2.dispose();
|
|
183874
|
-
}
|
|
183875
|
-
for (const m of wedgeMaterials) {
|
|
183876
|
-
m.dispose();
|
|
183877
|
-
}
|
|
183878
|
-
}
|
|
183879
|
-
},
|
|
183880
|
-
interaction
|
|
183881
|
-
);
|
|
183882
|
-
}
|
|
183883
|
-
var init_pie_chart_3d_scene = __esm2({
|
|
183884
|
-
"src/render/pie-chart-3d-scene.ts"() {
|
|
183885
|
-
init_chart_3d_hosted_stage();
|
|
183886
|
-
init_chart_3d_hover_tooltip();
|
|
183887
|
-
init_pie_chart_3d_geom();
|
|
183888
|
-
init_pie_chart_3d_hit_test();
|
|
183889
|
-
init_pie_chart_3d_interaction_wiring();
|
|
183890
|
-
init_pie_chart_3d_mesh();
|
|
183891
|
-
}
|
|
183892
|
-
});
|
|
183893
181573
|
function createRenderer(three, state) {
|
|
183894
181574
|
try {
|
|
183895
181575
|
const renderer = new three.WebGLRenderer({
|
|
@@ -184137,7 +181817,7 @@ function buildObliqueShapeGeometry(three, bar, horizontal) {
|
|
|
184137
181817
|
0.5 * bar.taper.top,
|
|
184138
181818
|
0.5 * bar.taper.bottom,
|
|
184139
181819
|
1,
|
|
184140
|
-
|
|
181820
|
+
ROUND_SEGMENTS
|
|
184141
181821
|
);
|
|
184142
181822
|
}
|
|
184143
181823
|
if (horizontal) {
|
|
@@ -184178,11 +181858,11 @@ function shadeObliqueShapeGeometry(three, geometry, bar, scale2, viewYaw) {
|
|
|
184178
181858
|
}
|
|
184179
181859
|
colors.needsUpdate = true;
|
|
184180
181860
|
}
|
|
184181
|
-
var
|
|
181861
|
+
var ROUND_SEGMENTS;
|
|
184182
181862
|
var init_chart_3d_oblique_shape_mesh = __esm2({
|
|
184183
181863
|
"src/render/chart-3d-oblique-shape-mesh.ts"() {
|
|
184184
181864
|
init_chart_3d_shading();
|
|
184185
|
-
|
|
181865
|
+
ROUND_SEGMENTS = 48;
|
|
184186
181866
|
}
|
|
184187
181867
|
});
|
|
184188
181868
|
function obliqueToScene(layout, svgWidth, svgHeight, p) {
|
|
@@ -184388,6 +182068,12 @@ var init_chart_3d_chrome_overlay = __esm2({
|
|
|
184388
182068
|
OBLIQUE_LEGEND_BASELINE = 14 * PT6;
|
|
184389
182069
|
}
|
|
184390
182070
|
});
|
|
182071
|
+
var CHART_3D_DRAG_THRESHOLD_PX;
|
|
182072
|
+
var init_chart_3d_interaction = __esm2({
|
|
182073
|
+
"src/render/chart-3d-interaction.ts"() {
|
|
182074
|
+
CHART_3D_DRAG_THRESHOLD_PX = 3;
|
|
182075
|
+
}
|
|
182076
|
+
});
|
|
184391
182077
|
function partOf(point) {
|
|
184392
182078
|
return point ? { role: "dataPoint", seriesIndex: point.seriesIndex, pointIndex: point.pointIndex } : null;
|
|
184393
182079
|
}
|
|
@@ -184543,9 +182229,9 @@ function obliqueDragValue(layout, startValue, dx, dy) {
|
|
|
184543
182229
|
function obliqueDraggedExtent(layout, value) {
|
|
184544
182230
|
const { min, max } = layout.range;
|
|
184545
182231
|
const base = Math.min(Math.max(0, min), max);
|
|
184546
|
-
const
|
|
184547
|
-
const lo = (
|
|
184548
|
-
const hi = (
|
|
182232
|
+
const clamp12 = (v) => Math.min(Math.max(v, min), max);
|
|
182233
|
+
const lo = (clamp12(Math.min(base, value)) - min) * layout.valueScale;
|
|
182234
|
+
const hi = (clamp12(Math.max(base, value)) - min) * layout.valueScale;
|
|
184549
182235
|
return { from: lo, length: hi - lo };
|
|
184550
182236
|
}
|
|
184551
182237
|
function obliqueBarAtValue(layout, bar, value) {
|
|
@@ -184685,6 +182371,7 @@ function buildPerspBarPrisms(chartData, layout, override) {
|
|
|
184685
182371
|
neg = to;
|
|
184686
182372
|
}
|
|
184687
182373
|
}
|
|
182374
|
+
const shape = chartData.series[s]?.shape ?? chartData.barShape ?? "box";
|
|
184688
182375
|
const slotIndex = layout.grouping === "clustered" ? s : 0;
|
|
184689
182376
|
const row = layout.grouping === "standard" ? s : 0;
|
|
184690
182377
|
const c0 = c * slot + gapWidth * barW / 2 + slotIndex * barW;
|
|
@@ -184703,7 +182390,16 @@ function buildPerspBarPrisms(chartData, layout, override) {
|
|
|
184703
182390
|
[x0, y1]
|
|
184704
182391
|
],
|
|
184705
182392
|
z0,
|
|
184706
|
-
z1: z0 + depth
|
|
182393
|
+
z1: z0 + depth,
|
|
182394
|
+
shape,
|
|
182395
|
+
taper: obliqueBarTaper(
|
|
182396
|
+
shape,
|
|
182397
|
+
v0,
|
|
182398
|
+
v1,
|
|
182399
|
+
(layout.range.max - layout.range.min) * layout.valueScale,
|
|
182400
|
+
raw
|
|
182401
|
+
),
|
|
182402
|
+
horizontal: layout.horizontal
|
|
184707
182403
|
});
|
|
184708
182404
|
}
|
|
184709
182405
|
}
|
|
@@ -184712,6 +182408,7 @@ function buildPerspBarPrisms(chartData, layout, override) {
|
|
|
184712
182408
|
var DEFAULT_GAP_WIDTH2;
|
|
184713
182409
|
var init_chart_3d_persp_bars = __esm2({
|
|
184714
182410
|
"src/render/chart-3d-persp-bars.ts"() {
|
|
182411
|
+
init_chart_3d_oblique_bars();
|
|
184715
182412
|
DEFAULT_GAP_WIDTH2 = 150;
|
|
184716
182413
|
}
|
|
184717
182414
|
});
|
|
@@ -184803,6 +182500,55 @@ var init_chart_3d_persp_marks = __esm2({
|
|
|
184803
182500
|
RIBBON_THICKNESS = 0.012;
|
|
184804
182501
|
}
|
|
184805
182502
|
});
|
|
182503
|
+
function isShapedPerspPrism(prism) {
|
|
182504
|
+
return prism.shape !== void 0 && prism.shape !== "box";
|
|
182505
|
+
}
|
|
182506
|
+
function outlineBounds2(prism) {
|
|
182507
|
+
const xs = prism.outline.map(([x]) => x);
|
|
182508
|
+
const ys = prism.outline.map(([, y]) => y);
|
|
182509
|
+
return [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];
|
|
182510
|
+
}
|
|
182511
|
+
function buildShapedPrismGeometry(three, prism) {
|
|
182512
|
+
const shape = prism.shape ?? "box";
|
|
182513
|
+
const unit2 = buildObliqueShapeGeometry(
|
|
182514
|
+
three,
|
|
182515
|
+
{ shape, taper: prism.taper ?? { bottom: 1, top: 1 } },
|
|
182516
|
+
Boolean(prism.horizontal)
|
|
182517
|
+
);
|
|
182518
|
+
const geometry = unit2.index ? unit2.toNonIndexed() : unit2;
|
|
182519
|
+
if (geometry !== unit2) {
|
|
182520
|
+
unit2.dispose();
|
|
182521
|
+
}
|
|
182522
|
+
const [x0, x1, y0, y1] = outlineBounds2(prism);
|
|
182523
|
+
const sx = Math.max(x1 - x0, 1e-6);
|
|
182524
|
+
const sy = Math.max(y1 - y0, 1e-6);
|
|
182525
|
+
const sz = Math.max(prism.z1 - prism.z0, 1e-6);
|
|
182526
|
+
geometry.scale(sx, sy, sz);
|
|
182527
|
+
geometry.translate((x0 + x1) / 2, (y0 + y1) / 2, (prism.z0 + prism.z1) / 2);
|
|
182528
|
+
geometry.computeVertexNormals();
|
|
182529
|
+
const normals = geometry.getAttribute("normal");
|
|
182530
|
+
const colors = new Float32Array(normals.count * 3);
|
|
182531
|
+
const base = new three.Color(prism.color).getRGB(new three.Color(), three.SRGBColorSpace);
|
|
182532
|
+
const out = new three.Color();
|
|
182533
|
+
for (let i2 = 0; i2 < normals.count; i2++) {
|
|
182534
|
+
const f6 = chart3DNormalShade(shape, normals.getX(i2), normals.getY(i2), -normals.getZ(i2));
|
|
182535
|
+
out.setRGB(
|
|
182536
|
+
Math.min(1, base.r * f6),
|
|
182537
|
+
Math.min(1, base.g * f6),
|
|
182538
|
+
Math.min(1, base.b * f6),
|
|
182539
|
+
three.SRGBColorSpace
|
|
182540
|
+
);
|
|
182541
|
+
colors.set([out.r, out.g, out.b], i2 * 3);
|
|
182542
|
+
}
|
|
182543
|
+
geometry.setAttribute("color", new three.Float32BufferAttribute(colors, 3));
|
|
182544
|
+
return geometry;
|
|
182545
|
+
}
|
|
182546
|
+
var init_chart_3d_persp_shape_mesh = __esm2({
|
|
182547
|
+
"src/render/chart-3d-persp-shape-mesh.ts"() {
|
|
182548
|
+
init_chart_3d_oblique_shape_mesh();
|
|
182549
|
+
init_chart_3d_shading();
|
|
182550
|
+
}
|
|
182551
|
+
});
|
|
184806
182552
|
function shadePerspGeometry(three, geometry, color2) {
|
|
184807
182553
|
const normals = geometry.getAttribute("normal");
|
|
184808
182554
|
const colors = new Float32Array(normals.count * 3);
|
|
@@ -184823,6 +182569,9 @@ function shadePerspGeometry(three, geometry, color2) {
|
|
|
184823
182569
|
geometry.setAttribute("color", new three.Float32BufferAttribute(colors, 3));
|
|
184824
182570
|
}
|
|
184825
182571
|
function buildPrismGeometry(three, prism) {
|
|
182572
|
+
if (isShapedPerspPrism(prism)) {
|
|
182573
|
+
return buildShapedPrismGeometry(three, prism);
|
|
182574
|
+
}
|
|
184826
182575
|
const shape = new three.Shape(prism.outline.map(([x, y]) => new three.Vector2(x, y)));
|
|
184827
182576
|
const extruded = new three.ExtrudeGeometry(shape, {
|
|
184828
182577
|
depth: Math.max(prism.z1 - prism.z0, 1e-6),
|
|
@@ -184885,6 +182634,7 @@ function buildPerspMeshes(three, layout, prisms) {
|
|
|
184885
182634
|
var GRIDLINE_COLOR5;
|
|
184886
182635
|
var init_chart_3d_persp_mesh = __esm2({
|
|
184887
182636
|
"src/render/chart-3d-persp-mesh.ts"() {
|
|
182637
|
+
init_chart_3d_persp_shape_mesh();
|
|
184888
182638
|
init_chart_3d_persp_view();
|
|
184889
182639
|
init_chart_3d_shading();
|
|
184890
182640
|
GRIDLINE_COLOR5 = 14277081;
|
|
@@ -185662,24 +183412,6 @@ function buildObliqueCamera(three, svgWidth, svgHeight, shearX, shearY) {
|
|
|
185662
183412
|
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
|
|
185663
183413
|
return camera;
|
|
185664
183414
|
}
|
|
185665
|
-
function mountPerspectiveScene(perspective2, ctx) {
|
|
185666
|
-
switch (perspective2.kind) {
|
|
185667
|
-
case "bar":
|
|
185668
|
-
return createBarChart3DScene(ctx, perspective2.options);
|
|
185669
|
-
case "line":
|
|
185670
|
-
return createLineChart3DScene(ctx, perspective2.options);
|
|
185671
|
-
case "area":
|
|
185672
|
-
return createAreaChart3DScene(ctx, perspective2.options);
|
|
185673
|
-
case "pie":
|
|
185674
|
-
return createPieChart3DScene(ctx, perspective2.options);
|
|
185675
|
-
case "surface":
|
|
185676
|
-
return createSurfaceChart3DScene(ctx, perspective2.options);
|
|
185677
|
-
default: {
|
|
185678
|
-
const exhaustive2 = perspective2;
|
|
185679
|
-
return exhaustive2;
|
|
185680
|
-
}
|
|
185681
|
-
}
|
|
185682
|
-
}
|
|
185683
183415
|
async function mountChart3DView(spec2, ctx) {
|
|
185684
183416
|
if (spec2.geometry?.kind === "pie") {
|
|
185685
183417
|
const chartData2 = spec2.element.chartData;
|
|
@@ -185708,9 +183440,6 @@ async function mountChart3DView(spec2, ctx) {
|
|
|
185708
183440
|
);
|
|
185709
183441
|
}
|
|
185710
183442
|
if (spec2.projection.mode !== "oblique" || spec2.geometry?.kind !== "oblique") {
|
|
185711
|
-
if (spec2.perspective) {
|
|
185712
|
-
return mountPerspectiveScene(spec2.perspective, ctx);
|
|
185713
|
-
}
|
|
185714
183443
|
throw new Error(`no 3D chart scene for chartType=${spec2.chartType}`);
|
|
185715
183444
|
}
|
|
185716
183445
|
const three = ctx.three;
|
|
@@ -185772,17 +183501,12 @@ async function mountChart3DView(spec2, ctx) {
|
|
|
185772
183501
|
}
|
|
185773
183502
|
var init_chart_3d_view_scene = __esm2({
|
|
185774
183503
|
"src/render/chart-3d-view-scene.ts"() {
|
|
185775
|
-
init_area_chart_3d_scene();
|
|
185776
|
-
init_bar_chart_3d_scene();
|
|
185777
183504
|
init_chart_3d_bar_mesh();
|
|
185778
183505
|
init_chart_3d_chrome_overlay();
|
|
185779
183506
|
init_chart_3d_oblique_interaction();
|
|
185780
183507
|
init_chart_3d_persp_scene();
|
|
185781
183508
|
init_chart_3d_pie_layout();
|
|
185782
183509
|
init_chart_3d_pie_scene();
|
|
185783
|
-
init_line_chart_3d_scene();
|
|
185784
|
-
init_pie_chart_3d_scene();
|
|
185785
|
-
init_surface_chart_3d_scene();
|
|
185786
183510
|
}
|
|
185787
183511
|
});
|
|
185788
183512
|
function isSmartArt3DGlassMaterial(material) {
|
|
@@ -186592,10 +184316,10 @@ function threeViewOverflowChanged(a, b) {
|
|
|
186592
184316
|
return a.top !== b.top || a.right !== b.right || a.bottom !== b.bottom || a.left !== b.left;
|
|
186593
184317
|
}
|
|
186594
184318
|
function overflowPixelSize(size, overflow) {
|
|
186595
|
-
const
|
|
184319
|
+
const clamp12 = (px32) => Math.max(1, Math.min(MAX_VIEW_PIXELS, Math.round(px32)));
|
|
186596
184320
|
return {
|
|
186597
|
-
width:
|
|
186598
|
-
height:
|
|
184321
|
+
width: clamp12(size.pixelWidth * (1 + overflow.left + overflow.right)),
|
|
184322
|
+
height: clamp12(size.pixelHeight * (1 + overflow.top + overflow.bottom))
|
|
186599
184323
|
};
|
|
186600
184324
|
}
|
|
186601
184325
|
function overflowViewOffset(size, overflow) {
|
|
@@ -186726,7 +184450,12 @@ async function mountSmartArt3DView(model, ctx) {
|
|
|
186726
184450
|
const built = lit ? buildLitMeshObject(
|
|
186727
184451
|
three,
|
|
186728
184452
|
mesh,
|
|
186729
|
-
resolveSmartArt3DLightModel(
|
|
184453
|
+
resolveSmartArt3DLightModel(
|
|
184454
|
+
model.lighting,
|
|
184455
|
+
mesh.solid?.material,
|
|
184456
|
+
eye !== void 0,
|
|
184457
|
+
model.camera !== void 0
|
|
184458
|
+
),
|
|
186730
184459
|
eye
|
|
186731
184460
|
) : buildFlatMeshObject(three, mesh);
|
|
186732
184461
|
if (lit && isSmartArt3DTranslucentMesh(mesh)) {
|
|
@@ -187128,10 +184857,20 @@ function renderSelectMenu(menu, choices2, value) {
|
|
|
187128
184857
|
}
|
|
187129
184858
|
function positionSelectMenu(menu, trigger) {
|
|
187130
184859
|
const rect22 = trigger.getBoundingClientRect();
|
|
187131
|
-
|
|
187132
|
-
|
|
187133
|
-
|
|
187134
|
-
|
|
184860
|
+
const margin = 8;
|
|
184861
|
+
const gap = 4;
|
|
184862
|
+
const width = Math.max(0, window.innerWidth - margin * 2);
|
|
184863
|
+
const below = Math.max(0, window.innerHeight - rect22.bottom - gap - margin);
|
|
184864
|
+
const above = Math.max(0, rect22.top - gap - margin);
|
|
184865
|
+
menu.style.minWidth = `${Math.min(rect22.width, width)}px`;
|
|
184866
|
+
menu.style.maxWidth = `${width}px`;
|
|
184867
|
+
menu.style.maxHeight = "240px";
|
|
184868
|
+
const preferredHeight = menu.getBoundingClientRect().height;
|
|
184869
|
+
const flip = below < preferredHeight && above > below;
|
|
184870
|
+
menu.style.maxHeight = `${Math.min(240, flip ? above : below)}px`;
|
|
184871
|
+
const { height, width: menuWidth } = menu.getBoundingClientRect();
|
|
184872
|
+
menu.style.top = `${Math.max(margin, flip ? rect22.top - gap - height : rect22.bottom + gap)}px`;
|
|
184873
|
+
menu.style.left = `${Math.max(margin, Math.min(rect22.left, window.innerWidth - menuWidth - margin))}px`;
|
|
187135
184874
|
}
|
|
187136
184875
|
function markSelectActive(menu, trigger, active2, open) {
|
|
187137
184876
|
for (const item3 of menu.querySelectorAll("[data-index]")) {
|
|
@@ -187409,6 +185148,9 @@ function definePptxSelect(registry) {
|
|
|
187409
185148
|
}
|
|
187410
185149
|
this.text.textContent = this.choices.find((choice) => choice.value === this.value)?.label ?? "";
|
|
187411
185150
|
this.trigger.disabled = this.disabled;
|
|
185151
|
+
if (this.disabled) {
|
|
185152
|
+
this.close();
|
|
185153
|
+
}
|
|
187412
185154
|
this.trigger.setAttribute("aria-label", this.getAttribute("aria-label") ?? "");
|
|
187413
185155
|
this.internals?.setFormValue?.(this.disabled ? null : this.value);
|
|
187414
185156
|
if (this.open || this.menu.childElementCount) {
|
|
@@ -187417,16 +185159,12 @@ function definePptxSelect(registry) {
|
|
|
187417
185159
|
}
|
|
187418
185160
|
renderMenu() {
|
|
187419
185161
|
renderSelectMenu(this.menu, this.choices, this.value);
|
|
187420
|
-
this.
|
|
185162
|
+
markSelectActive(this.menu, this.trigger, this.active, this.open);
|
|
187421
185163
|
}
|
|
187422
185164
|
show() {
|
|
187423
185165
|
if (this.disabled || !this.choices.some((choice) => !choice.disabled && !choice.hidden) || this.open) {
|
|
187424
185166
|
return;
|
|
187425
185167
|
}
|
|
187426
|
-
const availableBelow = window.innerHeight - this.trigger.getBoundingClientRect().bottom;
|
|
187427
|
-
if (availableBelow < Math.min(this.choices.length * 32 + 12, 160)) {
|
|
187428
|
-
this.trigger.scrollIntoView?.({ block: "center" });
|
|
187429
|
-
}
|
|
187430
185168
|
this.open = true;
|
|
187431
185169
|
this.setAttribute("open", "");
|
|
187432
185170
|
const selected = this.choices.findIndex(
|
|
@@ -187441,7 +185179,7 @@ function definePptxSelect(registry) {
|
|
|
187441
185179
|
}
|
|
187442
185180
|
this.trigger.setAttribute("aria-expanded", "true");
|
|
187443
185181
|
this.position();
|
|
187444
|
-
this.
|
|
185182
|
+
markSelectActive(this.menu, this.trigger, this.active, this.open);
|
|
187445
185183
|
document.addEventListener("pointerdown", this.onOutside, true);
|
|
187446
185184
|
window.addEventListener("resize", this.position);
|
|
187447
185185
|
window.addEventListener("scroll", this.position, true);
|
|
@@ -187451,6 +185189,8 @@ function definePptxSelect(registry) {
|
|
|
187451
185189
|
return;
|
|
187452
185190
|
}
|
|
187453
185191
|
this.open = false;
|
|
185192
|
+
window.clearTimeout(this.searchTimer);
|
|
185193
|
+
this.search = "";
|
|
187454
185194
|
this.removeAttribute("open");
|
|
187455
185195
|
if (this.menu.matches(":popover-open")) {
|
|
187456
185196
|
this.menu.hidePopover();
|
|
@@ -187473,9 +185213,6 @@ function definePptxSelect(registry) {
|
|
|
187473
185213
|
}
|
|
187474
185214
|
positionSelectMenu(this.menu, this.trigger);
|
|
187475
185215
|
};
|
|
187476
|
-
markActive() {
|
|
187477
|
-
markSelectActive(this.menu, this.trigger, this.active, this.open);
|
|
187478
|
-
}
|
|
187479
185216
|
move(step) {
|
|
187480
185217
|
if (!this.open) {
|
|
187481
185218
|
this.show();
|
|
@@ -187484,7 +185221,7 @@ function definePptxSelect(registry) {
|
|
|
187484
185221
|
return;
|
|
187485
185222
|
}
|
|
187486
185223
|
this.active = nextSelectActive(this.choices, this.active, step);
|
|
187487
|
-
this.
|
|
185224
|
+
markSelectActive(this.menu, this.trigger, this.active, this.open);
|
|
187488
185225
|
}
|
|
187489
185226
|
commit(index) {
|
|
187490
185227
|
const choice = this.choices[index];
|
|
@@ -187512,8 +185249,8 @@ function definePptxSelect(registry) {
|
|
|
187512
185249
|
event.preventDefault();
|
|
187513
185250
|
event.stopPropagation();
|
|
187514
185251
|
this.show();
|
|
187515
|
-
this.active = event.key === "Home" ? this.choices
|
|
187516
|
-
this.
|
|
185252
|
+
this.active = event.key === "Home" ? nextSelectActive(this.choices, -1, 1) : nextSelectActive(this.choices, 0, -1);
|
|
185253
|
+
markSelectActive(this.menu, this.trigger, this.active, this.open);
|
|
187517
185254
|
} else if (event.key === "Enter" || event.key === " ") {
|
|
187518
185255
|
event.preventDefault();
|
|
187519
185256
|
event.stopPropagation();
|
|
@@ -187527,6 +185264,8 @@ function definePptxSelect(registry) {
|
|
|
187527
185264
|
event.stopPropagation();
|
|
187528
185265
|
this.close();
|
|
187529
185266
|
this.trigger.focus();
|
|
185267
|
+
} else if (event.key === "Tab") {
|
|
185268
|
+
this.close();
|
|
187530
185269
|
} else if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
187531
185270
|
event.stopPropagation();
|
|
187532
185271
|
this.search += event.key.toLocaleLowerCase();
|
|
@@ -187540,7 +185279,7 @@ function definePptxSelect(registry) {
|
|
|
187540
185279
|
);
|
|
187541
185280
|
if (index >= 0) {
|
|
187542
185281
|
this.active = index;
|
|
187543
|
-
this.
|
|
185282
|
+
markSelectActive(this.menu, this.trigger, this.active, this.open);
|
|
187544
185283
|
}
|
|
187545
185284
|
}
|
|
187546
185285
|
}
|
|
@@ -200600,8 +198339,8 @@ function hexToRgb4(hex22) {
|
|
|
200600
198339
|
};
|
|
200601
198340
|
}
|
|
200602
198341
|
function rgbToHex3(r, g2, b) {
|
|
200603
|
-
const
|
|
200604
|
-
return `#${
|
|
198342
|
+
const clamp12 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
198343
|
+
return `#${clamp12(r).toString(16).padStart(2, "0")}${clamp12(g2).toString(16).padStart(2, "0")}${clamp12(b).toString(16).padStart(2, "0")}`;
|
|
200605
198344
|
}
|
|
200606
198345
|
function rgbToHsl2(r, g2, b) {
|
|
200607
198346
|
const rn = r / 255;
|
|
@@ -207975,8 +205714,8 @@ function hexToRgb5(hex22) {
|
|
|
207975
205714
|
};
|
|
207976
205715
|
}
|
|
207977
205716
|
function rgbToHex4(r, g2, b) {
|
|
207978
|
-
const
|
|
207979
|
-
return `#${
|
|
205717
|
+
const clamp12 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
205718
|
+
return `#${clamp12(r).toString(16).padStart(2, "0").toUpperCase()}${clamp12(g2).toString(16).padStart(2, "0").toUpperCase()}${clamp12(b).toString(16).padStart(2, "0").toUpperCase()}`;
|
|
207980
205719
|
}
|
|
207981
205720
|
function tintColor(hex22, tintFactor) {
|
|
207982
205721
|
const { r, g: g2, b } = hexToRgb5(hex22);
|
|
@@ -223151,8 +220890,8 @@ function hexToRgb6(hex22) {
|
|
|
223151
220890
|
};
|
|
223152
220891
|
}
|
|
223153
220892
|
function rgbToHex5(r, g2, b) {
|
|
223154
|
-
const
|
|
223155
|
-
return `#${
|
|
220893
|
+
const clamp12 = (v) => Math.max(0, Math.min(255, Math.round(v)));
|
|
220894
|
+
return `#${clamp12(r).toString(16).padStart(2, "0").toUpperCase()}${clamp12(g2).toString(16).padStart(2, "0").toUpperCase()}${clamp12(b).toString(16).padStart(2, "0").toUpperCase()}`;
|
|
223156
220895
|
}
|
|
223157
220896
|
function tintColor2(hex22, tintFactor) {
|
|
223158
220897
|
const { r, g: g2, b } = hexToRgb6(hex22);
|
|
@@ -232645,242 +230384,6 @@ function buildSmartArt3DSpecForElement(element, options = {}) {
|
|
|
232645
230384
|
});
|
|
232646
230385
|
return model.meshes.length > 0 ? model : null;
|
|
232647
230386
|
}
|
|
232648
|
-
init_cartesian_line_chart_3d_layout();
|
|
232649
|
-
init_chart_3d_surfaces();
|
|
232650
|
-
init_chart_datapoint_style();
|
|
232651
|
-
init_chart_view_model();
|
|
232652
|
-
function buildPoints(chartData, catCount) {
|
|
232653
|
-
const series = chartData.series;
|
|
232654
|
-
const palette = chartData.colorPalette;
|
|
232655
|
-
const points4 = [];
|
|
232656
|
-
for (let si = 0; si < series.length; si++) {
|
|
232657
|
-
const baseColor = seriesColor22(series[si], si, palette);
|
|
232658
|
-
for (let ci = 0; ci < catCount; ci++) {
|
|
232659
|
-
const value = series[si].values[ci] ?? 0;
|
|
232660
|
-
const color2 = resolveDataPointFill(series[si], ci, paletteColor2(si, palette)) ?? baseColor;
|
|
232661
|
-
points4.push({ seriesIndex: si, categoryIndex: ci, value, color: color2 });
|
|
232662
|
-
}
|
|
232663
|
-
}
|
|
232664
|
-
return points4;
|
|
232665
|
-
}
|
|
232666
|
-
function buildCartesianLine3DSceneData(chartData, categoryLabels, options) {
|
|
232667
|
-
const rows = chartData.series.length;
|
|
232668
|
-
const cols = categoryLabels.length;
|
|
232669
|
-
if (rows === 0 || cols === 0) {
|
|
232670
|
-
return null;
|
|
232671
|
-
}
|
|
232672
|
-
const points4 = buildPoints(chartData, cols);
|
|
232673
|
-
const range = computeValueRange2(chartData.series, options.height);
|
|
232674
|
-
const depthPercent = chartData.view3D?.depthPercent;
|
|
232675
|
-
const series = layoutCartesianLine3DSeries(points4, cols, rows, range, depthPercent);
|
|
232676
|
-
return {
|
|
232677
|
-
cols,
|
|
232678
|
-
rows,
|
|
232679
|
-
series,
|
|
232680
|
-
categoryLabels,
|
|
232681
|
-
seriesNames: chartData.series.map((s) => s.name),
|
|
232682
|
-
numberFormats: chartData.series.map((s) => s.numberFormat),
|
|
232683
|
-
width: options.width,
|
|
232684
|
-
height: options.height,
|
|
232685
|
-
view3D: chartData.view3D ? {
|
|
232686
|
-
rotX: chartData.view3D.rotX,
|
|
232687
|
-
rotY: chartData.view3D.rotY,
|
|
232688
|
-
rperspective: chartData.view3D.perspective,
|
|
232689
|
-
depthPercent: chartData.view3D.depthPercent,
|
|
232690
|
-
rAngAx: chartData.view3D.rAngAx
|
|
232691
|
-
} : void 0,
|
|
232692
|
-
wallColors: resolveChart3DWallColors(chartData)
|
|
232693
|
-
};
|
|
232694
|
-
}
|
|
232695
|
-
function buildAreaChart3DDataForElement(element, options) {
|
|
232696
|
-
if (element.type !== "chart") {
|
|
232697
|
-
return null;
|
|
232698
|
-
}
|
|
232699
|
-
const chartEl = element;
|
|
232700
|
-
const chartData = chartEl.chartData;
|
|
232701
|
-
if (!chartData || chartData.series.length === 0) {
|
|
232702
|
-
return null;
|
|
232703
|
-
}
|
|
232704
|
-
if (chartData.chartType !== "area3D") {
|
|
232705
|
-
return null;
|
|
232706
|
-
}
|
|
232707
|
-
const longestLen = chartData.series.reduce((m, s) => Math.max(m, s.values.length), 0);
|
|
232708
|
-
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: longestLen }, (_, i2) => String(i2 + 1));
|
|
232709
|
-
return buildCartesianLine3DSceneData(chartData, categoryLabels, options);
|
|
232710
|
-
}
|
|
232711
|
-
init_cartesian_chart_3d_geom();
|
|
232712
|
-
function coneToMaxTopRadiusFactor(shape, value, max) {
|
|
232713
|
-
if (shape !== "coneToMax" && shape !== "pyramidToMax") {
|
|
232714
|
-
return void 0;
|
|
232715
|
-
}
|
|
232716
|
-
if (!(max > 0)) {
|
|
232717
|
-
return 0;
|
|
232718
|
-
}
|
|
232719
|
-
return Math.max(0, Math.min(1, 1 - Math.abs(value) / max));
|
|
232720
|
-
}
|
|
232721
|
-
var MIN_BOX_HEIGHT = 0.02;
|
|
232722
|
-
var BOX_GAP = 0.15;
|
|
232723
|
-
function normalizeToHeight2(value, range) {
|
|
232724
|
-
if (range.span <= 0) {
|
|
232725
|
-
return 0;
|
|
232726
|
-
}
|
|
232727
|
-
return (value - range.min) / range.span * MAX_VALUE_HEIGHT;
|
|
232728
|
-
}
|
|
232729
|
-
function layoutClustered(points4, cols, rows, range, depthPercent) {
|
|
232730
|
-
const { gridWidth, gridDepth } = computeCartesianGridExtent(cols, rows, depthPercent);
|
|
232731
|
-
const colStep = gridWidth / cols;
|
|
232732
|
-
const rowStep = gridDepth / Math.max(rows, 1);
|
|
232733
|
-
const boxW = colStep * (1 - BOX_GAP);
|
|
232734
|
-
const boxD = rowStep * (1 - BOX_GAP);
|
|
232735
|
-
const zeroH = normalizeToHeight2(0, range);
|
|
232736
|
-
return points4.map((p) => {
|
|
232737
|
-
const valueH = normalizeToHeight2(p.plotValue, range);
|
|
232738
|
-
const top = Math.max(valueH, zeroH);
|
|
232739
|
-
const bottom = Math.min(valueH, zeroH);
|
|
232740
|
-
const h2 = Math.max(top - bottom, MIN_BOX_HEIGHT);
|
|
232741
|
-
const x = -gridWidth / 2 + colStep * (p.categoryIndex + 0.5);
|
|
232742
|
-
const z = -gridDepth / 2 + rowStep * (p.seriesIndex + 0.5);
|
|
232743
|
-
return {
|
|
232744
|
-
seriesIndex: p.seriesIndex,
|
|
232745
|
-
categoryIndex: p.categoryIndex,
|
|
232746
|
-
value: p.value,
|
|
232747
|
-
color: p.color,
|
|
232748
|
-
center: [x, bottom + h2 / 2, z],
|
|
232749
|
-
size: [boxW, h2, boxD],
|
|
232750
|
-
shape: p.shape,
|
|
232751
|
-
coneToMaxTopRadiusFactor: coneToMaxTopRadiusFactor(p.shape, p.value, range.max)
|
|
232752
|
-
};
|
|
232753
|
-
});
|
|
232754
|
-
}
|
|
232755
|
-
function layoutStacked(points4, cols, rows, range, depthPercent) {
|
|
232756
|
-
const { gridWidth, gridDepth } = computeCartesianGridExtent(cols, rows, depthPercent);
|
|
232757
|
-
const colStep = gridWidth / cols;
|
|
232758
|
-
const boxW = colStep * (1 - BOX_GAP);
|
|
232759
|
-
const boxD = gridDepth * (1 - BOX_GAP);
|
|
232760
|
-
const boxes = [];
|
|
232761
|
-
for (let ci = 0; ci < cols; ci++) {
|
|
232762
|
-
const x = -gridWidth / 2 + colStep * (ci + 0.5);
|
|
232763
|
-
let posRunning = 0;
|
|
232764
|
-
let negRunning = 0;
|
|
232765
|
-
const catPoints = points4.filter((p) => p.categoryIndex === ci).sort((a, b) => a.seriesIndex - b.seriesIndex);
|
|
232766
|
-
for (const p of catPoints) {
|
|
232767
|
-
const isNeg = p.plotValue < 0;
|
|
232768
|
-
const base = isNeg ? negRunning : posRunning;
|
|
232769
|
-
const top = base + p.plotValue;
|
|
232770
|
-
if (isNeg) {
|
|
232771
|
-
negRunning = top;
|
|
232772
|
-
} else {
|
|
232773
|
-
posRunning = top;
|
|
232774
|
-
}
|
|
232775
|
-
const baseH = normalizeToHeight2(base, range);
|
|
232776
|
-
const topH = normalizeToHeight2(top, range);
|
|
232777
|
-
const h2 = Math.max(Math.abs(topH - baseH), MIN_BOX_HEIGHT);
|
|
232778
|
-
boxes.push({
|
|
232779
|
-
seriesIndex: p.seriesIndex,
|
|
232780
|
-
categoryIndex: p.categoryIndex,
|
|
232781
|
-
value: p.value,
|
|
232782
|
-
color: p.color,
|
|
232783
|
-
center: [x, Math.min(baseH, topH) + h2 / 2, 0],
|
|
232784
|
-
size: [boxW, h2, boxD],
|
|
232785
|
-
shape: p.shape,
|
|
232786
|
-
coneToMaxTopRadiusFactor: coneToMaxTopRadiusFactor(p.shape, p.value, range.max)
|
|
232787
|
-
});
|
|
232788
|
-
}
|
|
232789
|
-
}
|
|
232790
|
-
return boxes;
|
|
232791
|
-
}
|
|
232792
|
-
function layoutBarChart3D(points4, cols, rows, range, grouping, depthPercent, horizontal = false) {
|
|
232793
|
-
const boxes = grouping === "clustered" ? layoutClustered(points4, cols, rows, range, depthPercent) : layoutStacked(points4, cols, rows, range, depthPercent);
|
|
232794
|
-
if (!horizontal) {
|
|
232795
|
-
return boxes;
|
|
232796
|
-
}
|
|
232797
|
-
return boxes.map((box) => ({ ...box, center: transposeForHorizontalBar3D(box.center) }));
|
|
232798
|
-
}
|
|
232799
|
-
init_chart_3d_surfaces();
|
|
232800
|
-
init_chart_datapoint_style();
|
|
232801
|
-
init_chart_view_model();
|
|
232802
|
-
function categoryTotals3(series, catCount) {
|
|
232803
|
-
return Array.from(
|
|
232804
|
-
{ length: catCount },
|
|
232805
|
-
(_, ci) => series.reduce((sum, s) => sum + Math.abs(s.values[ci] ?? 0), 0)
|
|
232806
|
-
);
|
|
232807
|
-
}
|
|
232808
|
-
function buildPoints2(chartData, catCount, isPercent) {
|
|
232809
|
-
const series = chartData.series;
|
|
232810
|
-
const palette = chartData.colorPalette;
|
|
232811
|
-
const totals = isPercent ? categoryTotals3(series, catCount) : void 0;
|
|
232812
|
-
const points4 = [];
|
|
232813
|
-
for (let si = 0; si < series.length; si++) {
|
|
232814
|
-
const baseColor = seriesColor22(series[si], si, palette);
|
|
232815
|
-
for (let ci = 0; ci < catCount; ci++) {
|
|
232816
|
-
const value = series[si].values[ci] ?? 0;
|
|
232817
|
-
const color2 = resolveDataPointFill(series[si], ci, paletteColor2(si, palette)) ?? baseColor;
|
|
232818
|
-
const catTotal = totals?.[ci];
|
|
232819
|
-
const plotValue = isPercent && catTotal !== void 0 && catTotal > 0 ? value / catTotal * 100 : value;
|
|
232820
|
-
points4.push({
|
|
232821
|
-
seriesIndex: si,
|
|
232822
|
-
categoryIndex: ci,
|
|
232823
|
-
value,
|
|
232824
|
-
plotValue,
|
|
232825
|
-
color: color2,
|
|
232826
|
-
// Per-series `c:ser/c:shape` wins over the chart-level `c:bar3DChart/c:shape`.
|
|
232827
|
-
shape: series[si].shape ?? chartData.barShape
|
|
232828
|
-
});
|
|
232829
|
-
}
|
|
232830
|
-
}
|
|
232831
|
-
return points4;
|
|
232832
|
-
}
|
|
232833
|
-
function buildBarChart3DData(chartData, categoryLabels, options) {
|
|
232834
|
-
const rows = chartData.series.length;
|
|
232835
|
-
const cols = categoryLabels.length;
|
|
232836
|
-
if (rows === 0 || cols === 0) {
|
|
232837
|
-
return null;
|
|
232838
|
-
}
|
|
232839
|
-
const grouping = chartData.grouping === "stacked" || chartData.grouping === "percentStacked" ? chartData.grouping : "clustered";
|
|
232840
|
-
const isPercent = grouping === "percentStacked";
|
|
232841
|
-
const horizontal = chartData.barDirection === "bar";
|
|
232842
|
-
const points4 = buildPoints2(chartData, cols, isPercent);
|
|
232843
|
-
const range = isPercent ? { min: 0, max: 100, span: 100 } : grouping === "stacked" ? computeStackedValueRange(chartData.series, cols, options.height) : computeValueRange2(chartData.series, options.height);
|
|
232844
|
-
const depthPercent = chartData.view3D?.depthPercent;
|
|
232845
|
-
const boxes = layoutBarChart3D(points4, cols, rows, range, grouping, depthPercent, horizontal);
|
|
232846
|
-
return {
|
|
232847
|
-
cols,
|
|
232848
|
-
rows,
|
|
232849
|
-
boxes,
|
|
232850
|
-
categoryLabels,
|
|
232851
|
-
seriesNames: chartData.series.map((s) => s.name),
|
|
232852
|
-
numberFormats: chartData.series.map((s) => s.numberFormat),
|
|
232853
|
-
grouping,
|
|
232854
|
-
width: options.width,
|
|
232855
|
-
height: options.height,
|
|
232856
|
-
view3D: chartData.view3D ? {
|
|
232857
|
-
rotX: chartData.view3D.rotX,
|
|
232858
|
-
rotY: chartData.view3D.rotY,
|
|
232859
|
-
rperspective: chartData.view3D.perspective,
|
|
232860
|
-
depthPercent: chartData.view3D.depthPercent,
|
|
232861
|
-
rAngAx: chartData.view3D.rAngAx
|
|
232862
|
-
} : void 0,
|
|
232863
|
-
wallColors: resolveChart3DWallColors(chartData),
|
|
232864
|
-
picture: { series: chartData.series },
|
|
232865
|
-
...horizontal ? { horizontal: true } : {}
|
|
232866
|
-
};
|
|
232867
|
-
}
|
|
232868
|
-
function buildBarChart3DDataForElement(element, options) {
|
|
232869
|
-
if (element.type !== "chart") {
|
|
232870
|
-
return null;
|
|
232871
|
-
}
|
|
232872
|
-
const chartEl = element;
|
|
232873
|
-
const chartData = chartEl.chartData;
|
|
232874
|
-
if (!chartData || chartData.series.length === 0) {
|
|
232875
|
-
return null;
|
|
232876
|
-
}
|
|
232877
|
-
if (chartData.chartType !== "bar3D") {
|
|
232878
|
-
return null;
|
|
232879
|
-
}
|
|
232880
|
-
const longestLen = chartData.series.reduce((m, s) => Math.max(m, s.values.length), 0);
|
|
232881
|
-
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: longestLen }, (_, i2) => String(i2 + 1));
|
|
232882
|
-
return buildBarChart3DData(chartData, categoryLabels, options);
|
|
232883
|
-
}
|
|
232884
230387
|
init_chart_3d_oblique_bars();
|
|
232885
230388
|
init_chart_view_model_chrome();
|
|
232886
230389
|
var PT = 4 / 3;
|
|
@@ -233369,16 +230872,16 @@ var DEFAULT_ROT_X3 = 15;
|
|
|
233369
230872
|
var DEFAULT_ROT_Y2 = 20;
|
|
233370
230873
|
var DEFAULT_PIE_ROT_X = 30;
|
|
233371
230874
|
var DEFAULT_PIE_ROT_Y = 0;
|
|
233372
|
-
var
|
|
233373
|
-
var
|
|
233374
|
-
var
|
|
233375
|
-
var
|
|
233376
|
-
function
|
|
230875
|
+
var DEFAULT_PERSPECTIVE_DEG = 30;
|
|
230876
|
+
var PERSPECTIVE_MAX_DEG = 120;
|
|
230877
|
+
var FOV_MIN = 15;
|
|
230878
|
+
var FOV_MAX = 75;
|
|
230879
|
+
function clamp7(value, min, max) {
|
|
233377
230880
|
return Math.min(Math.max(value, min), max);
|
|
233378
230881
|
}
|
|
233379
230882
|
function resolvePerspectiveFov(perspectiveDeg) {
|
|
233380
|
-
const perspective2 =
|
|
233381
|
-
return
|
|
230883
|
+
const perspective2 = clamp7(perspectiveDeg ?? DEFAULT_PERSPECTIVE_DEG, 0, PERSPECTIVE_MAX_DEG);
|
|
230884
|
+
return FOV_MIN + perspective2 / PERSPECTIVE_MAX_DEG * (FOV_MAX - FOV_MIN);
|
|
233382
230885
|
}
|
|
233383
230886
|
function resolveChart3DProjection(chartType, view3D) {
|
|
233384
230887
|
const isPie = chartType === "pie3D";
|
|
@@ -233404,149 +230907,6 @@ function resolveChart3DProjection(chartType, view3D) {
|
|
|
233404
230907
|
};
|
|
233405
230908
|
}
|
|
233406
230909
|
init_chart_view_model_build();
|
|
233407
|
-
function buildLineChart3DDataForElement(element, options) {
|
|
233408
|
-
if (element.type !== "chart") {
|
|
233409
|
-
return null;
|
|
233410
|
-
}
|
|
233411
|
-
const chartEl = element;
|
|
233412
|
-
const chartData = chartEl.chartData;
|
|
233413
|
-
if (!chartData || chartData.series.length === 0) {
|
|
233414
|
-
return null;
|
|
233415
|
-
}
|
|
233416
|
-
if (chartData.chartType !== "line3D") {
|
|
233417
|
-
return null;
|
|
233418
|
-
}
|
|
233419
|
-
const longestLen = chartData.series.reduce((m, s) => Math.max(m, s.values.length), 0);
|
|
233420
|
-
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: longestLen }, (_, i2) => String(i2 + 1));
|
|
233421
|
-
return buildCartesianLine3DSceneData(chartData, categoryLabels, options);
|
|
233422
|
-
}
|
|
233423
|
-
init_chart_datapoint_style();
|
|
233424
|
-
init_chart_view_model();
|
|
233425
|
-
init_pie_chart_3d_geom();
|
|
233426
|
-
function buildPieChart3DData(chartData, categoryLabels, options) {
|
|
233427
|
-
const pieSeries = chartData.series[0];
|
|
233428
|
-
if (!pieSeries || pieSeries.values.length === 0) {
|
|
233429
|
-
return null;
|
|
233430
|
-
}
|
|
233431
|
-
const values = pieSeries.values;
|
|
233432
|
-
const explosions = values.map((_v, i2) => resolveDataPointExplosion(pieSeries, i2));
|
|
233433
|
-
const outerRadius = PIE_RADIUS;
|
|
233434
|
-
const angles = computePieChart3DSliceAngles(
|
|
233435
|
-
values,
|
|
233436
|
-
explosions,
|
|
233437
|
-
chartData.firstSliceAngle,
|
|
233438
|
-
outerRadius
|
|
233439
|
-
);
|
|
233440
|
-
const wedges = angles.map((angle) => ({
|
|
233441
|
-
...angle,
|
|
233442
|
-
color: resolveVaryColorFill(
|
|
233443
|
-
pieSeries,
|
|
233444
|
-
angle.pointIndex,
|
|
233445
|
-
paletteColor2(angle.pointIndex, chartData.colorPalette)
|
|
233446
|
-
)
|
|
233447
|
-
}));
|
|
233448
|
-
const view3D = chartData.view3D ? {
|
|
233449
|
-
rotX: chartData.view3D.rotX,
|
|
233450
|
-
rotY: chartData.view3D.rotY,
|
|
233451
|
-
rperspective: chartData.view3D.perspective,
|
|
233452
|
-
rAngAx: chartData.view3D.rAngAx,
|
|
233453
|
-
hPercent: chartData.view3D.hPercent
|
|
233454
|
-
} : void 0;
|
|
233455
|
-
return {
|
|
233456
|
-
wedges,
|
|
233457
|
-
categoryLabels,
|
|
233458
|
-
seriesName: pieSeries.name,
|
|
233459
|
-
numberFormat: pieSeries.numberFormat,
|
|
233460
|
-
outerRadius,
|
|
233461
|
-
thickness: computePieChart3DThickness(view3D),
|
|
233462
|
-
width: options.width,
|
|
233463
|
-
height: options.height,
|
|
233464
|
-
view3D,
|
|
233465
|
-
values,
|
|
233466
|
-
explosions,
|
|
233467
|
-
firstSliceAngleDeg: chartData.firstSliceAngle
|
|
233468
|
-
};
|
|
233469
|
-
}
|
|
233470
|
-
function buildPieChart3DDataForElement(element, options) {
|
|
233471
|
-
if (element.type !== "chart") {
|
|
233472
|
-
return null;
|
|
233473
|
-
}
|
|
233474
|
-
const chartEl = element;
|
|
233475
|
-
const chartData = chartEl.chartData;
|
|
233476
|
-
if (!chartData || chartData.series.length === 0) {
|
|
233477
|
-
return null;
|
|
233478
|
-
}
|
|
233479
|
-
if (chartData.chartType !== "pie3D") {
|
|
233480
|
-
return null;
|
|
233481
|
-
}
|
|
233482
|
-
const pieSeries = chartData.series[0];
|
|
233483
|
-
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: pieSeries.values.length }, (_, i2) => String(i2 + 1));
|
|
233484
|
-
return buildPieChart3DData(chartData, categoryLabels, options);
|
|
233485
|
-
}
|
|
233486
|
-
init_chart_3d_surfaces();
|
|
233487
|
-
init_chart_surface_bands();
|
|
233488
|
-
init_chart_surface_treemap();
|
|
233489
|
-
init_chart_view_model();
|
|
233490
|
-
function resolveSurfaceColors(chartData) {
|
|
233491
|
-
return resolveChart3DWallColors(chartData);
|
|
233492
|
-
}
|
|
233493
|
-
function buildSurfaceChart3DData(chartData, categoryLabels, options) {
|
|
233494
|
-
const seriesCount = chartData.series.length;
|
|
233495
|
-
const catCount = categoryLabels.length;
|
|
233496
|
-
if (seriesCount === 0 || catCount === 0) {
|
|
233497
|
-
return null;
|
|
233498
|
-
}
|
|
233499
|
-
const range = computeValueRange2(chartData.series, options.height);
|
|
233500
|
-
const heightMap = new Float32Array(seriesCount * catCount);
|
|
233501
|
-
const colorMap = new Float32Array(seriesCount * catCount * 3);
|
|
233502
|
-
const values = new Float32Array(seriesCount * catCount);
|
|
233503
|
-
for (let row = 0; row < seriesCount; row++) {
|
|
233504
|
-
for (let col = 0; col < catCount; col++) {
|
|
233505
|
-
const idx = row * catCount + col;
|
|
233506
|
-
const val2 = chartData.series[row]?.values[col] ?? 0;
|
|
233507
|
-
values[idx] = val2;
|
|
233508
|
-
const t = range.span > 0 ? (val2 - range.min) / range.span : 0;
|
|
233509
|
-
heightMap[idx] = t;
|
|
233510
|
-
const bandFill = resolveSurfaceBandFill(t, chartData.bandFmts);
|
|
233511
|
-
const { r, g: g2, b } = bandFill ? hexToRgb4(bandFill) : surfaceColor(t);
|
|
233512
|
-
const ci = idx * 3;
|
|
233513
|
-
colorMap[ci] = r / 255;
|
|
233514
|
-
colorMap[ci + 1] = g2 / 255;
|
|
233515
|
-
colorMap[ci + 2] = b / 255;
|
|
233516
|
-
}
|
|
233517
|
-
}
|
|
233518
|
-
return {
|
|
233519
|
-
cols: catCount,
|
|
233520
|
-
rows: seriesCount,
|
|
233521
|
-
heightMap,
|
|
233522
|
-
colorMap,
|
|
233523
|
-
values,
|
|
233524
|
-
numberFormats: chartData.series.map((s) => s.numberFormat),
|
|
233525
|
-
wireframe: options.wireframe ?? chartData.wireframe ?? true,
|
|
233526
|
-
categoryLabels,
|
|
233527
|
-
seriesNames: chartData.series.map((s) => s.name),
|
|
233528
|
-
width: options.width,
|
|
233529
|
-
height: options.height,
|
|
233530
|
-
view3D: chartData.view3D ? { rotX: chartData.view3D.rotX, rotY: chartData.view3D.rotY } : void 0,
|
|
233531
|
-
surfaceColors: resolveSurfaceColors(chartData)
|
|
233532
|
-
};
|
|
233533
|
-
}
|
|
233534
|
-
function buildSurfaceChart3DDataForElement(element, options) {
|
|
233535
|
-
if (element.type !== "chart") {
|
|
233536
|
-
return null;
|
|
233537
|
-
}
|
|
233538
|
-
const chartEl = element;
|
|
233539
|
-
const chartData = chartEl.chartData;
|
|
233540
|
-
if (!chartData || chartData.series.length === 0) {
|
|
233541
|
-
return null;
|
|
233542
|
-
}
|
|
233543
|
-
if (resolveChartKind(chartData.chartType ?? "bar") !== "surface") {
|
|
233544
|
-
return null;
|
|
233545
|
-
}
|
|
233546
|
-
const longestLen = chartData.series.reduce((m, s) => Math.max(m, s.values.length), 0);
|
|
233547
|
-
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: longestLen }, (_, i2) => String(i2 + 1));
|
|
233548
|
-
return buildSurfaceChart3DData(chartData, categoryLabels, options);
|
|
233549
|
-
}
|
|
233550
230910
|
var CHART_3D_TYPES = /* @__PURE__ */ new Set([
|
|
233551
230911
|
"bar3D",
|
|
233552
230912
|
"line3D",
|
|
@@ -233583,6 +230943,9 @@ function buildChart3DSpecForElement(element) {
|
|
|
233583
230943
|
const vm = buildChartViewModel(element);
|
|
233584
230944
|
const projection = resolveChart3DProjection(chartType, chartData.view3D);
|
|
233585
230945
|
const geometry = chartType === "bar3D" && projection.mode === "oblique" ? buildBarGeometry(element, vm) : PERSP_BOX_TYPES.has(chartType) && (projection.mode === "perspective" || chartType !== "bar3D") ? buildPerspGeometry(element, vm, projection.mode === "oblique") : chartType === "pie3D" ? buildPieGeometry(element, vm) : null;
|
|
230946
|
+
if (!geometry) {
|
|
230947
|
+
return null;
|
|
230948
|
+
}
|
|
233586
230949
|
const longest = chartData.series.reduce((m, series) => Math.max(m, series.values.length), 0);
|
|
233587
230950
|
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: longest }, (_, i2) => String(i2 + 1));
|
|
233588
230951
|
return {
|
|
@@ -233593,37 +230956,9 @@ function buildChart3DSpecForElement(element) {
|
|
|
233593
230956
|
projection,
|
|
233594
230957
|
vm,
|
|
233595
230958
|
geometry,
|
|
233596
|
-
categoryLabels
|
|
233597
|
-
perspective: geometry ? null : buildPerspectiveScene(element)
|
|
230959
|
+
categoryLabels
|
|
233598
230960
|
};
|
|
233599
230961
|
}
|
|
233600
|
-
function buildPerspectiveScene(element) {
|
|
233601
|
-
const size = { width: element.width, height: element.height };
|
|
233602
|
-
switch (element.chartData?.chartType) {
|
|
233603
|
-
case "bar3D": {
|
|
233604
|
-
const options = buildBarChart3DDataForElement(element, size);
|
|
233605
|
-
return options ? { kind: "bar", options } : null;
|
|
233606
|
-
}
|
|
233607
|
-
case "line3D": {
|
|
233608
|
-
const options = buildLineChart3DDataForElement(element, size);
|
|
233609
|
-
return options ? { kind: "line", options } : null;
|
|
233610
|
-
}
|
|
233611
|
-
case "area3D": {
|
|
233612
|
-
const options = buildAreaChart3DDataForElement(element, size);
|
|
233613
|
-
return options ? { kind: "area", options } : null;
|
|
233614
|
-
}
|
|
233615
|
-
case "pie3D": {
|
|
233616
|
-
const options = buildPieChart3DDataForElement(element, size);
|
|
233617
|
-
return options ? { kind: "pie", options } : null;
|
|
233618
|
-
}
|
|
233619
|
-
case "surface": {
|
|
233620
|
-
const options = buildSurfaceChart3DDataForElement(element, size);
|
|
233621
|
-
return options ? { kind: "surface", options } : null;
|
|
233622
|
-
}
|
|
233623
|
-
default:
|
|
233624
|
-
return null;
|
|
233625
|
-
}
|
|
233626
|
-
}
|
|
233627
230962
|
function observeElementHeight(el, onHeight) {
|
|
233628
230963
|
onHeight(el.getBoundingClientRect().height);
|
|
233629
230964
|
if (typeof ResizeObserver === "undefined") {
|
|
@@ -233984,19 +231319,7 @@ async function mountModel3D(container, modelUrl, options) {
|
|
|
233984
231319
|
}
|
|
233985
231320
|
};
|
|
233986
231321
|
}
|
|
233987
|
-
init_surface_chart_3d_geom();
|
|
233988
|
-
init_surface_chart_3d_scene();
|
|
233989
|
-
init_surface_chart_3d_hit_test();
|
|
233990
|
-
init_cartesian_chart_3d_geom();
|
|
233991
|
-
init_bar_chart_3d_scene();
|
|
233992
231322
|
init_bar_chart_3d_hit_test();
|
|
233993
|
-
init_cartesian_line_chart_3d_layout();
|
|
233994
|
-
init_cartesian_chart_3d_hit_test();
|
|
233995
|
-
init_line_chart_3d_scene();
|
|
233996
|
-
init_area_chart_3d_scene();
|
|
233997
|
-
init_pie_chart_3d_geom();
|
|
233998
|
-
init_pie_chart_3d_scene();
|
|
233999
|
-
init_pie_chart_3d_hit_test();
|
|
234000
231323
|
init_text_wrap_estimate();
|
|
234001
231324
|
function collectFontsFromElement(element, fonts) {
|
|
234002
231325
|
if (hasTextProperties(element)) {
|
|
@@ -240438,16 +237761,16 @@ function trimmedMediaDurationMs(trimStartMs, trimEndMs, durationMs) {
|
|
|
240438
237761
|
}
|
|
240439
237762
|
return effectiveEnd - trimStartMs;
|
|
240440
237763
|
}
|
|
240441
|
-
function
|
|
237764
|
+
function clamp11(value, minimum, maximum) {
|
|
240442
237765
|
return Math.min(maximum, Math.max(minimum, value));
|
|
240443
237766
|
}
|
|
240444
237767
|
function mediaTrimEndSeconds(durationSeconds, trimEndMs) {
|
|
240445
237768
|
const duration = Math.max(0, durationSeconds);
|
|
240446
|
-
return trimEndMs > 0 ?
|
|
237769
|
+
return trimEndMs > 0 ? clamp11(duration - trimEndMs / 1e3, 0, duration) : duration;
|
|
240447
237770
|
}
|
|
240448
237771
|
function mediaTrimEndMsFromSeconds(durationSeconds, endSeconds) {
|
|
240449
237772
|
const duration = Math.max(0, durationSeconds);
|
|
240450
|
-
return Math.max(0, duration -
|
|
237773
|
+
return Math.max(0, duration - clamp11(endSeconds, 0, duration)) * 1e3;
|
|
240451
237774
|
}
|
|
240452
237775
|
function buildSummaryZoomView(element, lookup, translate) {
|
|
240453
237776
|
if (element.zoomType !== "summary" || !element.summaryTargets?.length) {
|
|
@@ -243299,9 +240622,9 @@ function resolveAuthoredSlideRange(selection, slideCount) {
|
|
|
243299
240622
|
if (typeof from !== "number" || typeof to !== "number" || !Number.isFinite(from) || !Number.isFinite(to)) {
|
|
243300
240623
|
return void 0;
|
|
243301
240624
|
}
|
|
243302
|
-
const
|
|
243303
|
-
const clampedFrom =
|
|
243304
|
-
const clampedTo =
|
|
240625
|
+
const clamp12 = (value) => Math.min(Math.max(Math.round(value), 1), slideCount);
|
|
240626
|
+
const clampedFrom = clamp12(from);
|
|
240627
|
+
const clampedTo = clamp12(to);
|
|
243305
240628
|
return {
|
|
243306
240629
|
fromIndex: Math.min(clampedFrom, clampedTo) - 1,
|
|
243307
240630
|
toIndex: Math.max(clampedFrom, clampedTo) - 1
|
|
@@ -247718,14 +245041,14 @@ function shadowMatches(style, spec2) {
|
|
|
247718
245041
|
}
|
|
247719
245042
|
function tileEffects(spec2) {
|
|
247720
245043
|
const { x, y } = shadowOffsets(spec2.distEmu, spec2.dir);
|
|
247721
|
-
const
|
|
245044
|
+
const clamp12 = (v) => Math.max(-4, Math.min(4, v * 0.6));
|
|
247722
245045
|
return {
|
|
247723
245046
|
shadow: {
|
|
247724
245047
|
color: "#000000",
|
|
247725
245048
|
opacity: Math.min(0.8, (spec2.alpha ?? 1e5) / 1e5 + 0.25),
|
|
247726
245049
|
blur: Math.min(6, spec2.blurEmu / EMU_PER_PX62 / 1.5),
|
|
247727
|
-
dx:
|
|
247728
|
-
dy:
|
|
245050
|
+
dx: clamp12(x),
|
|
245051
|
+
dy: clamp12(y) + (spec2.sy !== void 0 && spec2.sy < 0 ? 3 : 0),
|
|
247729
245052
|
inner: spec2.kind === "inner"
|
|
247730
245053
|
}
|
|
247731
245054
|
};
|
|
@@ -249138,9 +246461,9 @@ function effectFilter(style, id) {
|
|
|
249138
246461
|
merge.push('<feMergeNode in="glow"/>');
|
|
249139
246462
|
}
|
|
249140
246463
|
if (style.textShadowColor) {
|
|
249141
|
-
const
|
|
246464
|
+
const clamp12 = (v) => Math.max(-2, Math.min(2, (v ?? 0) / 2));
|
|
249142
246465
|
parts.push(
|
|
249143
|
-
`<feDropShadow dx="${num7(
|
|
246466
|
+
`<feDropShadow dx="${num7(clamp12(style.textShadowOffsetX))}" dy="${num7(clamp12(style.textShadowOffsetY))}" stdDeviation="${num7(Math.min(1.5, (style.textShadowBlur ?? 2) / 4))}" flood-color="${safeColor(style.textShadowColor, "#000000")}" flood-opacity="${num7(style.textShadowOpacity ?? 1)}" result="shadow"/>`
|
|
249144
246467
|
);
|
|
249145
246468
|
merge.push('<feMergeNode in="shadow"/>');
|
|
249146
246469
|
} else {
|
|
@@ -250817,9 +248140,6 @@ function getActiveXControlOverlayView(control, slideSize, index = 0, resolveFall
|
|
|
250817
248140
|
className: imageUrl ? "image" : "placeholder"
|
|
250818
248141
|
};
|
|
250819
248142
|
}
|
|
250820
|
-
init_bar_chart_3d_geometry();
|
|
250821
|
-
init_bar_chart_3d_face_fill();
|
|
250822
|
-
init_bar_chart_3d_materials();
|
|
250823
248143
|
init_chart_bar3d_face_picture_sample();
|
|
250824
248144
|
var BAR3D_SHAPE_OPTIONS = [
|
|
250825
248145
|
{ value: "box", labelKey: "pptx.chart.bar3DShapeBox" },
|
|
@@ -251485,10 +248805,6 @@ var ThreeViewController = class {
|
|
|
251485
248805
|
spec2.spec,
|
|
251486
248806
|
{
|
|
251487
248807
|
three,
|
|
251488
|
-
// No camera orbit: PowerPoint never rotates a chart or SmartArt
|
|
251489
|
-
// under the pointer, and an orbit would turn the scene while the
|
|
251490
|
-
// user drags the element to move it on the slide.
|
|
251491
|
-
OrbitControls: null,
|
|
251492
248808
|
size: this.size,
|
|
251493
248809
|
eventTarget: this.opts.eventTarget,
|
|
251494
248810
|
overlay,
|
|
@@ -251617,12 +248933,12 @@ function computeThreeViewSize(layoutWidth, layoutHeight, screenWidth, screenHeig
|
|
|
251617
248933
|
const dpr = Math.min(MAX_DEVICE_PIXEL_RATIO, Math.max(1, devicePixelRatio || 1));
|
|
251618
248934
|
const onScreenW = screenWidth > 0 ? screenWidth : width;
|
|
251619
248935
|
const onScreenH = screenHeight > 0 ? screenHeight : height;
|
|
251620
|
-
const
|
|
248936
|
+
const clamp12 = (px32) => Math.max(1, Math.min(MAX_VIEW_PIXELS, Math.round(px32)));
|
|
251621
248937
|
return {
|
|
251622
248938
|
width,
|
|
251623
248939
|
height,
|
|
251624
|
-
pixelWidth:
|
|
251625
|
-
pixelHeight:
|
|
248940
|
+
pixelWidth: clamp12(onScreenW * dpr),
|
|
248941
|
+
pixelHeight: clamp12(onScreenH * dpr)
|
|
251626
248942
|
};
|
|
251627
248943
|
}
|
|
251628
248944
|
function measureThreeViewSize(element) {
|
|
@@ -251664,6 +248980,7 @@ function createElementClass() {
|
|
|
251664
248980
|
#resize = null;
|
|
251665
248981
|
#intersect = null;
|
|
251666
248982
|
#poll = null;
|
|
248983
|
+
#teardownPending = false;
|
|
251667
248984
|
get spec() {
|
|
251668
248985
|
return this.#spec;
|
|
251669
248986
|
}
|
|
@@ -251672,9 +248989,7 @@ function createElementClass() {
|
|
|
251672
248989
|
return;
|
|
251673
248990
|
}
|
|
251674
248991
|
this.#spec = value;
|
|
251675
|
-
|
|
251676
|
-
void this.#controller?.setSpec(value);
|
|
251677
|
-
}
|
|
248992
|
+
void this.#controller?.setSpec(value);
|
|
251678
248993
|
}
|
|
251679
248994
|
get interactive() {
|
|
251680
248995
|
return this.hasAttribute("interactive");
|
|
@@ -251715,6 +249030,10 @@ function createElementClass() {
|
|
|
251715
249030
|
}
|
|
251716
249031
|
connectedCallback() {
|
|
251717
249032
|
this.setAttribute(THREE_VIEW_MARKER_ATTR, "");
|
|
249033
|
+
if (this.#controller) {
|
|
249034
|
+
this.#teardownPending = false;
|
|
249035
|
+
return;
|
|
249036
|
+
}
|
|
251718
249037
|
const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
|
|
251719
249038
|
if (!this.#canvas) {
|
|
251720
249039
|
root.innerHTML = `<style>${SHADOW_CSS}</style><div class="fallback" part="fallback"><slot></slot></div><div class="stage" part="stage"><canvas></canvas><div class="hit" part="hit"></div><div class="overlay" part="overlay"></div></div>`;
|
|
@@ -251742,6 +249061,15 @@ function createElementClass() {
|
|
|
251742
249061
|
void this.#controller.setSpec(this.#spec);
|
|
251743
249062
|
}
|
|
251744
249063
|
disconnectedCallback() {
|
|
249064
|
+
this.#teardownPending = true;
|
|
249065
|
+
queueMicrotask(() => {
|
|
249066
|
+
if (this.#teardownPending && !this.isConnected) {
|
|
249067
|
+
this.#teardown();
|
|
249068
|
+
}
|
|
249069
|
+
});
|
|
249070
|
+
}
|
|
249071
|
+
#teardown() {
|
|
249072
|
+
this.#teardownPending = false;
|
|
251745
249073
|
this.#resize?.disconnect();
|
|
251746
249074
|
this.#intersect?.disconnect();
|
|
251747
249075
|
if (this.#poll !== null) {
|
|
@@ -254438,24 +251766,42 @@ function isChart3DViewEnabled(flags, chartType) {
|
|
|
254438
251766
|
}
|
|
254439
251767
|
var chartSpecs = /* @__PURE__ */ new WeakMap();
|
|
254440
251768
|
var smartArtSpecs = /* @__PURE__ */ new WeakMap();
|
|
254441
|
-
|
|
254442
|
-
|
|
254443
|
-
|
|
251769
|
+
var lastByIdChart = /* @__PURE__ */ new Map();
|
|
251770
|
+
var lastByIdSmartArt = /* @__PURE__ */ new Map();
|
|
251771
|
+
var POSITION_KEYS = /* @__PURE__ */ new Set(["x", "y"]);
|
|
251772
|
+
function differsOnlyInPosition(a, b) {
|
|
251773
|
+
const ra = a;
|
|
251774
|
+
const rb = b;
|
|
251775
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(ra), ...Object.keys(rb)]);
|
|
251776
|
+
for (const key2 of keys) {
|
|
251777
|
+
if (!POSITION_KEYS.has(key2) && ra[key2] !== rb[key2]) {
|
|
251778
|
+
return false;
|
|
251779
|
+
}
|
|
254444
251780
|
}
|
|
254445
|
-
|
|
254446
|
-
const view = spec2 ? { kind: "chart", spec: spec2 } : null;
|
|
254447
|
-
chartSpecs.set(element, view);
|
|
254448
|
-
return view;
|
|
251781
|
+
return true;
|
|
254449
251782
|
}
|
|
254450
|
-
function
|
|
254451
|
-
if (
|
|
254452
|
-
return
|
|
251783
|
+
function memoised(element, byObject, byId, build7) {
|
|
251784
|
+
if (byObject.has(element)) {
|
|
251785
|
+
return byObject.get(element) ?? null;
|
|
254453
251786
|
}
|
|
254454
|
-
const
|
|
254455
|
-
const view =
|
|
254456
|
-
|
|
251787
|
+
const last = byId.get(element.id);
|
|
251788
|
+
const view = last && differsOnlyInPosition(last.element, element) ? last.view : build7();
|
|
251789
|
+
byObject.set(element, view);
|
|
251790
|
+
byId.set(element.id, { element, view });
|
|
254457
251791
|
return view;
|
|
254458
251792
|
}
|
|
251793
|
+
function chartThreeViewSpec(element) {
|
|
251794
|
+
return memoised(element, chartSpecs, lastByIdChart, () => {
|
|
251795
|
+
const spec2 = buildChart3DSpecForElement(element);
|
|
251796
|
+
return spec2 ? { kind: "chart", spec: spec2 } : null;
|
|
251797
|
+
});
|
|
251798
|
+
}
|
|
251799
|
+
function smartArtThreeViewSpec(element) {
|
|
251800
|
+
return memoised(element, smartArtSpecs, lastByIdSmartArt, () => {
|
|
251801
|
+
const spec2 = buildSmartArt3DSpecForElement(element);
|
|
251802
|
+
return spec2 ? { kind: "smartart", spec: spec2 } : null;
|
|
251803
|
+
});
|
|
251804
|
+
}
|
|
254459
251805
|
function resolveChartThreeViewSpec(element, flags) {
|
|
254460
251806
|
if (element.type !== "chart" || !isChart3DViewEnabled(flags, element.chartData?.chartType)) {
|
|
254461
251807
|
return null;
|