stickyflow 0.5.0 → 0.7.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 +43 -0
- package/dist/binding/index.cjs +9 -9
- package/dist/binding/index.d.cts +4 -4
- package/dist/binding/index.d.ts +4 -4
- package/dist/binding/index.js +3 -3
- package/dist/{chunk-ZMLQIMJK.cjs → chunk-A73UJ5AQ.cjs} +1537 -738
- package/dist/chunk-A73UJ5AQ.cjs.map +1 -0
- package/dist/{chunk-VK3T6O5Z.cjs → chunk-BUOWM3LC.cjs} +745 -62
- package/dist/chunk-BUOWM3LC.cjs.map +1 -0
- package/dist/{chunk-L3VJXZFD.cjs → chunk-EKAWJFJQ.cjs} +15 -15
- package/dist/{chunk-L3VJXZFD.cjs.map → chunk-EKAWJFJQ.cjs.map} +1 -1
- package/dist/{chunk-BODZN3ZI.js → chunk-JCRPLPKV.js} +156 -23
- package/dist/chunk-JCRPLPKV.js.map +1 -0
- package/dist/{chunk-IEHE6WVN.js → chunk-JQK4IGXJ.js} +489 -51
- package/dist/chunk-JQK4IGXJ.js.map +1 -0
- package/dist/{chunk-XY2GZUHC.cjs → chunk-KXYSO6GC.cjs} +498 -50
- package/dist/chunk-KXYSO6GC.cjs.map +1 -0
- package/dist/{chunk-G7NRK5AG.js → chunk-MUKIGLR5.js} +717 -34
- package/dist/chunk-MUKIGLR5.js.map +1 -0
- package/dist/{chunk-TWDLOXRM.cjs → chunk-OWNVXKXN.cjs} +170 -37
- package/dist/chunk-OWNVXKXN.cjs.map +1 -0
- package/dist/{chunk-LTGF5OHP.js → chunk-SDMQRSRW.js} +941 -143
- package/dist/chunk-SDMQRSRW.js.map +1 -0
- package/dist/{chunk-7VW2XKVB.js → chunk-ZNHYW47T.js} +3 -3
- package/dist/{chunk-7VW2XKVB.js.map → chunk-ZNHYW47T.js.map} +1 -1
- package/dist/index.cjs +57 -29
- package/dist/index.d.cts +80 -7
- package/dist/index.d.ts +80 -7
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +245 -235
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +3 -2
- package/dist/interaction/index.d.ts +3 -2
- package/dist/interaction/index.js +17 -7
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-CgX_y15a.d.ts → render-BU2uYzjG.d.cts} +40 -16
- package/dist/{render-CgX_y15a.d.cts → render-BU2uYzjG.d.ts} +40 -16
- package/dist/{runtime-reWgr7MP.d.cts → runtime-B7KiTmn8.d.cts} +2 -2
- package/dist/{runtime-DnUxca3Y.d.ts → runtime-BPzyD-Nd.d.ts} +2 -2
- package/dist/{runtimeTypes-D60w6nyF.d.cts → runtimeTypes-BIP70z72.d.cts} +3 -2
- package/dist/{runtimeTypes-CEBGueYM.d.ts → runtimeTypes-DalvhScn.d.ts} +3 -2
- package/dist/stickyflow-diagram.global.js +387 -36
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-DYLC_lsk.d.ts → types-DMWs27Hn.d.ts} +1 -1
- package/dist/{types-DvhMpqrL.d.cts → types-D_2NZ6lL.d.cts} +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +5 -4
- package/dist/viewer/index.d.ts +5 -4
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.d.cts +2 -2
- package/dist/web-component/index.d.ts +2 -2
- package/dist/web-component/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-BODZN3ZI.js.map +0 -1
- package/dist/chunk-G7NRK5AG.js.map +0 -1
- package/dist/chunk-IEHE6WVN.js.map +0 -1
- package/dist/chunk-LTGF5OHP.js.map +0 -1
- package/dist/chunk-TWDLOXRM.cjs.map +0 -1
- package/dist/chunk-VK3T6O5Z.cjs.map +0 -1
- package/dist/chunk-XY2GZUHC.cjs.map +0 -1
- package/dist/chunk-ZMLQIMJK.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKXYSO6GC_cjs = require('./chunk-KXYSO6GC.cjs');
|
|
4
4
|
|
|
5
5
|
// src/renderInput/styleDecoding/colorToken.ts
|
|
6
6
|
var COLOR_TOKEN_PATTERN = String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;
|
|
@@ -633,7 +633,7 @@ function readComponentValue(descriptor, raw) {
|
|
|
633
633
|
return raw;
|
|
634
634
|
}
|
|
635
635
|
function genericComponentObject(canvasObject) {
|
|
636
|
-
const descriptor =
|
|
636
|
+
const descriptor = chunkKXYSO6GC_cjs.getComponentDescriptor(canvasObject.component.type);
|
|
637
637
|
return {
|
|
638
638
|
id: canvasObject.id,
|
|
639
639
|
type: canvasObject.component.type,
|
|
@@ -822,7 +822,7 @@ var BUILT_IN_OBJECTS = {
|
|
|
822
822
|
};
|
|
823
823
|
function componentObject(canvasObject) {
|
|
824
824
|
const type = canvasObject.component.type;
|
|
825
|
-
return
|
|
825
|
+
return chunkKXYSO6GC_cjs.isBuiltInComponentType(type) ? BUILT_IN_OBJECTS[type](canvasObject) : genericComponentObject(canvasObject);
|
|
826
826
|
}
|
|
827
827
|
|
|
828
828
|
// src/renderInput/fromSfl/canvasObjects/connection.ts
|
|
@@ -846,6 +846,26 @@ function connectionObject(c) {
|
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
+
// src/renderInput/fromSfl/canvasObjects/dimension.ts
|
|
850
|
+
function dimensionObject(canvasObject) {
|
|
851
|
+
const presentation = canvasObject.props;
|
|
852
|
+
return {
|
|
853
|
+
id: canvasObject.id,
|
|
854
|
+
start: canvasObject.dimension.start,
|
|
855
|
+
end: canvasObject.dimension.end,
|
|
856
|
+
offset: canvasObject.dimension.offset,
|
|
857
|
+
text: canvasObject.text,
|
|
858
|
+
unit: canvasObject.dimension.unit,
|
|
859
|
+
strokeColor: solidColor(presentation.stroke),
|
|
860
|
+
strokeWidth: numOf(presentation.strokeWidth),
|
|
861
|
+
textColor: solidColor(presentation.textColor),
|
|
862
|
+
fontSize: numOf(presentation.fontSize),
|
|
863
|
+
order: canvasObject.order,
|
|
864
|
+
sourceIndex: canvasObject.sourceIndex,
|
|
865
|
+
parentFrameId: canvasObject.parentFrameId
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
|
|
849
869
|
// src/renderInput/fromSfl/canvasObjects/frame.ts
|
|
850
870
|
function frameObject(e) {
|
|
851
871
|
const p = e.props;
|
|
@@ -884,6 +904,8 @@ function isometricObject(canvasObject) {
|
|
|
884
904
|
width: canvasObject.width,
|
|
885
905
|
height: canvasObject.height,
|
|
886
906
|
depth: canvasObject.isometric.depth,
|
|
907
|
+
footprint: canvasObject.isometric.footprint,
|
|
908
|
+
form: canvasObject.isometric.form,
|
|
887
909
|
rotation: canvasObject.rotation,
|
|
888
910
|
order: canvasObject.order,
|
|
889
911
|
sourceIndex: canvasObject.sourceIndex,
|
|
@@ -892,7 +914,7 @@ function isometricObject(canvasObject) {
|
|
|
892
914
|
fill: solidColor(presentation.fill) ?? "#f8fafc",
|
|
893
915
|
strokeColor: solidColor(presentation.stroke) ?? "#111827",
|
|
894
916
|
strokeWidth: numOf(presentation.strokeWidth) ?? 1,
|
|
895
|
-
cornerRadius: numOf(presentation.cornerRadius) ?? 8,
|
|
917
|
+
cornerRadius: numOf(presentation.cornerRadius) ?? (canvasObject.isometric.footprint ? 0 : 8),
|
|
896
918
|
hasShadow: shadowStyle?.enabled ?? false,
|
|
897
919
|
shadowStyle,
|
|
898
920
|
labelOffsetX: numOf(presentation.labelOffsetX) ?? 0,
|
|
@@ -1041,8 +1063,9 @@ function collectCanvasObjects(state) {
|
|
|
1041
1063
|
shapes: canvasObjects.filter((canvasObject) => canvasObject.objectType === "shape").map((shape) => shapeObject(shape, shaders)),
|
|
1042
1064
|
frames: canvasObjects.filter((canvasObject) => canvasObject.objectType === "frame").map(frameObject),
|
|
1043
1065
|
swimlanes: canvasObjects.filter((canvasObject) => canvasObject.objectType === "swimlane").map(swimlaneObject),
|
|
1044
|
-
isometricObjects: canvasObjects.filter(
|
|
1066
|
+
isometricObjects: canvasObjects.filter(chunkKXYSO6GC_cjs.isIsometricObject).map(isometricObject),
|
|
1045
1067
|
paths: canvasObjects.filter((canvasObject) => canvasObject.objectType === "path").map(pathObject),
|
|
1068
|
+
dimensions: canvasObjects.filter(chunkKXYSO6GC_cjs.isDimensionObject).map(dimensionObject),
|
|
1046
1069
|
charts: canvasObjects.filter((canvasObject) => canvasObject.objectType === "chart").map(chartObject),
|
|
1047
1070
|
components: canvasObjects.filter(
|
|
1048
1071
|
(canvasObject) => canvasObject.objectType === "component" && canvasObject.component !== void 0
|
|
@@ -1069,9 +1092,9 @@ function sidePoint(canvasObject, endpoint) {
|
|
|
1069
1092
|
function namedPortPoint(canvasObject, endpoint) {
|
|
1070
1093
|
const port = canvasObject.symbol?.ports?.find((candidate) => candidate.name === endpoint.port);
|
|
1071
1094
|
if (!port) {
|
|
1072
|
-
return
|
|
1095
|
+
return chunkKXYSO6GC_cjs.elementCenter(canvasObject);
|
|
1073
1096
|
}
|
|
1074
|
-
return
|
|
1097
|
+
return chunkKXYSO6GC_cjs.pointAtNormalizedPort(
|
|
1075
1098
|
{
|
|
1076
1099
|
x: canvasObject.x,
|
|
1077
1100
|
y: canvasObject.y,
|
|
@@ -1117,7 +1140,7 @@ function explicitAnchorPoint(canvasObject, endpoint) {
|
|
|
1117
1140
|
return null;
|
|
1118
1141
|
}
|
|
1119
1142
|
function automaticEndpointPoint(canvasObject, opposite) {
|
|
1120
|
-
return opposite ?
|
|
1143
|
+
return opposite ? chunkKXYSO6GC_cjs.edgePointToward(canvasObject, opposite) : chunkKXYSO6GC_cjs.elementCenter(canvasObject);
|
|
1121
1144
|
}
|
|
1122
1145
|
function findPositionedCanvasObject(canvasObjects, id) {
|
|
1123
1146
|
return canvasObjects.find((candidate) => candidate.id === id);
|
|
@@ -1135,7 +1158,7 @@ function positionedCanvasObjects(canvasObjects) {
|
|
|
1135
1158
|
];
|
|
1136
1159
|
}
|
|
1137
1160
|
function connectionEndpointPoint(object, face) {
|
|
1138
|
-
return object ?
|
|
1161
|
+
return object ? chunkKXYSO6GC_cjs.isometricFaceCenter(object, face) : { x: 0, y: 0 };
|
|
1139
1162
|
}
|
|
1140
1163
|
function isometricStackPosition(isometricObjects, id) {
|
|
1141
1164
|
const index = isometricObjects.findIndex((object2) => object2.id === id);
|
|
@@ -1150,8 +1173,8 @@ function connectionStack(isometricObjects, connection) {
|
|
|
1150
1173
|
return { order: connection.order, sourceIndex: connection.sourceIndex };
|
|
1151
1174
|
}
|
|
1152
1175
|
const behind = [
|
|
1153
|
-
|
|
1154
|
-
|
|
1176
|
+
chunkKXYSO6GC_cjs.VISIBLE_ISOMETRIC_FACES.has(connection.fromFace) ? void 0 : isometricStackPosition(isometricObjects, connection.fromId),
|
|
1177
|
+
chunkKXYSO6GC_cjs.VISIBLE_ISOMETRIC_FACES.has(connection.toFace) ? void 0 : isometricStackPosition(isometricObjects, connection.toId)
|
|
1155
1178
|
].filter((position) => position !== void 0);
|
|
1156
1179
|
if (!behind.length) {
|
|
1157
1180
|
return { sourceIndex: connection.sourceIndex };
|
|
@@ -1193,7 +1216,7 @@ function createRenderInputLinks(canvasObjects) {
|
|
|
1193
1216
|
|
|
1194
1217
|
// src/renderInput/fromSfl/index.ts
|
|
1195
1218
|
function sflToRenderInput(sfl) {
|
|
1196
|
-
const state =
|
|
1219
|
+
const state = chunkKXYSO6GC_cjs.sflToCanvasState(sfl);
|
|
1197
1220
|
const canvasObjects = collectCanvasObjects(state);
|
|
1198
1221
|
return {
|
|
1199
1222
|
shapes: canvasObjects.shapes,
|
|
@@ -1201,6 +1224,7 @@ function sflToRenderInput(sfl) {
|
|
|
1201
1224
|
swimlanes: canvasObjects.swimlanes,
|
|
1202
1225
|
isometricObjects: canvasObjects.isometricObjects,
|
|
1203
1226
|
paths: canvasObjects.paths,
|
|
1227
|
+
dimensions: canvasObjects.dimensions,
|
|
1204
1228
|
charts: canvasObjects.charts,
|
|
1205
1229
|
components: canvasObjects.components,
|
|
1206
1230
|
links: createRenderInputLinks(canvasObjects),
|
|
@@ -1211,13 +1235,13 @@ function sflToRenderInput(sfl) {
|
|
|
1211
1235
|
// src/renderScene/artifacts/component/placeholder.ts
|
|
1212
1236
|
var STROKE = "#94a3b8";
|
|
1213
1237
|
function buildPlaceholder(component, index) {
|
|
1214
|
-
const x =
|
|
1215
|
-
const y =
|
|
1216
|
-
const width = Math.max(0,
|
|
1217
|
-
const height = Math.max(0,
|
|
1218
|
-
const rotation =
|
|
1238
|
+
const x = chunkKXYSO6GC_cjs.finite(component.x, 0);
|
|
1239
|
+
const y = chunkKXYSO6GC_cjs.finite(component.y, 0);
|
|
1240
|
+
const width = Math.max(0, chunkKXYSO6GC_cjs.finite(component.width, 120));
|
|
1241
|
+
const height = Math.max(0, chunkKXYSO6GC_cjs.finite(component.height, 60));
|
|
1242
|
+
const rotation = chunkKXYSO6GC_cjs.finite(component.rotation, 0);
|
|
1219
1243
|
const order = 1e4 + index;
|
|
1220
|
-
const bounds =
|
|
1244
|
+
const bounds = chunkKXYSO6GC_cjs.rotatedBounds({ x, y, width, height }, rotation, 2);
|
|
1221
1245
|
return [
|
|
1222
1246
|
{
|
|
1223
1247
|
id: `widget-${component.id}`,
|
|
@@ -1242,7 +1266,7 @@ function buildPlaceholder(component, index) {
|
|
|
1242
1266
|
width,
|
|
1243
1267
|
height,
|
|
1244
1268
|
lines: [component.type],
|
|
1245
|
-
fontFamily:
|
|
1269
|
+
fontFamily: chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1246
1270
|
fontSize: 12,
|
|
1247
1271
|
fontWeight: "normal",
|
|
1248
1272
|
color: STROKE,
|
|
@@ -1256,44 +1280,44 @@ function buildPlaceholder(component, index) {
|
|
|
1256
1280
|
|
|
1257
1281
|
// src/renderScene/artifacts/component/builtIn.ts
|
|
1258
1282
|
function buildRollingNumber(component, index) {
|
|
1259
|
-
const x =
|
|
1260
|
-
const y =
|
|
1261
|
-
const width = Math.max(0,
|
|
1262
|
-
const height = Math.max(0,
|
|
1263
|
-
const rotation =
|
|
1283
|
+
const x = chunkKXYSO6GC_cjs.finite(component.x, 0);
|
|
1284
|
+
const y = chunkKXYSO6GC_cjs.finite(component.y, 0);
|
|
1285
|
+
const width = Math.max(0, chunkKXYSO6GC_cjs.finite(component.width, 160));
|
|
1286
|
+
const height = Math.max(0, chunkKXYSO6GC_cjs.finite(component.height, 90));
|
|
1287
|
+
const rotation = chunkKXYSO6GC_cjs.finite(component.rotation, 0);
|
|
1264
1288
|
return [
|
|
1265
1289
|
{
|
|
1266
1290
|
id: `widget-${component.id}`,
|
|
1267
1291
|
type: "rolling-number",
|
|
1268
1292
|
order: 1e4 + index,
|
|
1269
|
-
bounds:
|
|
1293
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x, y, width, height }, rotation, 2),
|
|
1270
1294
|
x,
|
|
1271
1295
|
y,
|
|
1272
1296
|
width,
|
|
1273
1297
|
height,
|
|
1274
1298
|
rotation,
|
|
1275
|
-
value:
|
|
1299
|
+
value: chunkKXYSO6GC_cjs.formatRollingNumber(component.value, component.digits),
|
|
1276
1300
|
digits: component.digits,
|
|
1277
|
-
duration: Math.max(0,
|
|
1301
|
+
duration: Math.max(0, chunkKXYSO6GC_cjs.finite(component.duration, 420)),
|
|
1278
1302
|
label: component.label,
|
|
1279
|
-
componentStyle:
|
|
1303
|
+
componentStyle: chunkKXYSO6GC_cjs.resolveRollingNumberStyle(component.style)
|
|
1280
1304
|
}
|
|
1281
1305
|
];
|
|
1282
1306
|
}
|
|
1283
1307
|
function buildTickScale(component, index) {
|
|
1284
|
-
const x =
|
|
1285
|
-
const y =
|
|
1286
|
-
const width = Math.max(0,
|
|
1287
|
-
const height = Math.max(0,
|
|
1288
|
-
const rotation =
|
|
1289
|
-
const max =
|
|
1290
|
-
const progress = Math.min(1, Math.max(0,
|
|
1308
|
+
const x = chunkKXYSO6GC_cjs.finite(component.x, 0);
|
|
1309
|
+
const y = chunkKXYSO6GC_cjs.finite(component.y, 0);
|
|
1310
|
+
const width = Math.max(0, chunkKXYSO6GC_cjs.finite(component.width, 200));
|
|
1311
|
+
const height = Math.max(0, chunkKXYSO6GC_cjs.finite(component.height, 200));
|
|
1312
|
+
const rotation = chunkKXYSO6GC_cjs.finite(component.rotation, 0);
|
|
1313
|
+
const max = chunkKXYSO6GC_cjs.finite(component.max, 100) || 100;
|
|
1314
|
+
const progress = Math.min(1, Math.max(0, chunkKXYSO6GC_cjs.finite(Number(component.value), 0) / max));
|
|
1291
1315
|
const nodes = [
|
|
1292
1316
|
{
|
|
1293
1317
|
id: `widget-${component.id}`,
|
|
1294
1318
|
type: "shader-surface",
|
|
1295
1319
|
order: 1e4 + index,
|
|
1296
|
-
bounds:
|
|
1320
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x, y, width, height }, rotation, 2),
|
|
1297
1321
|
x,
|
|
1298
1322
|
y,
|
|
1299
1323
|
width,
|
|
@@ -1310,18 +1334,18 @@ function buildTickScale(component, index) {
|
|
|
1310
1334
|
}
|
|
1311
1335
|
function buildTickLabels(component, box) {
|
|
1312
1336
|
const labels = component.labels ?? {};
|
|
1313
|
-
const
|
|
1314
|
-
const major = Math.max(1,
|
|
1315
|
-
const start =
|
|
1316
|
-
const sweep =
|
|
1317
|
-
const radius =
|
|
1318
|
-
const fontSize =
|
|
1337
|
+
const ticks2 = Math.max(1, chunkKXYSO6GC_cjs.finite(Number(component.parameters.ticks), 48));
|
|
1338
|
+
const major = Math.max(1, chunkKXYSO6GC_cjs.finite(Number(component.parameters.major), 5));
|
|
1339
|
+
const start = chunkKXYSO6GC_cjs.finite(Number(component.parameters.start), 225) * Math.PI / 180;
|
|
1340
|
+
const sweep = chunkKXYSO6GC_cjs.finite(Number(component.parameters.sweep), 270) * Math.PI / 180;
|
|
1341
|
+
const radius = chunkKXYSO6GC_cjs.finite(Number(component.parameters.radius), 0.9) + chunkKXYSO6GC_cjs.finite(labels.offset, 0.08);
|
|
1342
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(labels.size, 12);
|
|
1319
1343
|
const centerX = box.x + box.width / 2;
|
|
1320
1344
|
const centerY = box.y + box.height / 2;
|
|
1321
|
-
const count = Math.floor(
|
|
1345
|
+
const count = Math.floor(ticks2 / major);
|
|
1322
1346
|
const nodes = [];
|
|
1323
1347
|
for (let step = 0; step <= count; step += 1) {
|
|
1324
|
-
const fraction = step * major /
|
|
1348
|
+
const fraction = step * major / ticks2;
|
|
1325
1349
|
const angle = start - fraction * sweep;
|
|
1326
1350
|
const labelX2 = centerX + Math.cos(angle) * radius * (box.width / 2);
|
|
1327
1351
|
const labelY = centerY - Math.sin(angle) * radius * (box.height / 2);
|
|
@@ -1330,10 +1354,10 @@ function buildTickLabels(component, box) {
|
|
|
1330
1354
|
id: `widget-${component.id}-label-${step}`,
|
|
1331
1355
|
type: "text",
|
|
1332
1356
|
order: box.order + 0.1,
|
|
1333
|
-
bounds:
|
|
1357
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(labelBox, 0, 2),
|
|
1334
1358
|
...labelBox,
|
|
1335
1359
|
lines: [String(Math.round(box.max * fraction * 10) / 10)],
|
|
1336
|
-
fontFamily: labels.fontFamily ||
|
|
1360
|
+
fontFamily: labels.fontFamily || chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1337
1361
|
fontSize,
|
|
1338
1362
|
fontWeight: labels.weight ?? "normal",
|
|
1339
1363
|
color: labels.color || "#8f95c4",
|
|
@@ -1345,20 +1369,20 @@ function buildTickLabels(component, box) {
|
|
|
1345
1369
|
return nodes;
|
|
1346
1370
|
}
|
|
1347
1371
|
function buildRuler(component, index) {
|
|
1348
|
-
const x =
|
|
1349
|
-
const y =
|
|
1350
|
-
const width = Math.max(0,
|
|
1351
|
-
const height = Math.max(0,
|
|
1352
|
-
const rotation =
|
|
1353
|
-
const min =
|
|
1354
|
-
const max =
|
|
1355
|
-
const progress = max === min ? 0 : Math.min(1, Math.max(0, (
|
|
1372
|
+
const x = chunkKXYSO6GC_cjs.finite(component.x, 0);
|
|
1373
|
+
const y = chunkKXYSO6GC_cjs.finite(component.y, 0);
|
|
1374
|
+
const width = Math.max(0, chunkKXYSO6GC_cjs.finite(component.width, 120));
|
|
1375
|
+
const height = Math.max(0, chunkKXYSO6GC_cjs.finite(component.height, 360));
|
|
1376
|
+
const rotation = chunkKXYSO6GC_cjs.finite(component.rotation, 0);
|
|
1377
|
+
const min = chunkKXYSO6GC_cjs.finite(component.min, 0);
|
|
1378
|
+
const max = chunkKXYSO6GC_cjs.finite(component.max, 100);
|
|
1379
|
+
const progress = max === min ? 0 : Math.min(1, Math.max(0, (chunkKXYSO6GC_cjs.finite(Number(component.value), min) - min) / (max - min)));
|
|
1356
1380
|
const nodes = [
|
|
1357
1381
|
{
|
|
1358
1382
|
id: `widget-${component.id}`,
|
|
1359
1383
|
type: "shader-surface",
|
|
1360
1384
|
order: 1e4 + index,
|
|
1361
|
-
bounds:
|
|
1385
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x, y, width, height }, rotation, 2),
|
|
1362
1386
|
x,
|
|
1363
1387
|
y,
|
|
1364
1388
|
width,
|
|
@@ -1376,28 +1400,28 @@ function buildRuler(component, index) {
|
|
|
1376
1400
|
function buildRulerLabels(component, box) {
|
|
1377
1401
|
const labels = component.labels ?? {};
|
|
1378
1402
|
const horizontal = component.parameters.axis === "horizontal";
|
|
1379
|
-
const
|
|
1380
|
-
const major = Math.max(1,
|
|
1381
|
-
const inset =
|
|
1382
|
-
const line =
|
|
1403
|
+
const ticks2 = Math.max(1, chunkKXYSO6GC_cjs.finite(Number(component.parameters.ticks), 50));
|
|
1404
|
+
const major = Math.max(1, chunkKXYSO6GC_cjs.finite(Number(component.parameters.major), 5));
|
|
1405
|
+
const inset = chunkKXYSO6GC_cjs.finite(Number(component.parameters.inset), 0.05) > 0 ? chunkKXYSO6GC_cjs.finite(Number(component.parameters.inset), 0.05) : 0.05;
|
|
1406
|
+
const line = chunkKXYSO6GC_cjs.finite(Number(component.parameters.line), 0.7) > 0 ? chunkKXYSO6GC_cjs.finite(Number(component.parameters.line), 0.7) : 0.7;
|
|
1383
1407
|
const across = horizontal ? box.height : box.width;
|
|
1384
|
-
const tickLength = (
|
|
1385
|
-
const edge = line * across - 0.12 * across - tickLength -
|
|
1386
|
-
const fontSize =
|
|
1387
|
-
const count = Math.floor(
|
|
1408
|
+
const tickLength = (chunkKXYSO6GC_cjs.finite(Number(component.parameters.length), 0.1) > 0 ? chunkKXYSO6GC_cjs.finite(Number(component.parameters.length), 0.1) : 0.1) * across * 1.9;
|
|
1409
|
+
const edge = line * across - 0.12 * across - tickLength - chunkKXYSO6GC_cjs.finite(labels.offset, 0.04) * across;
|
|
1410
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(labels.size, 12);
|
|
1411
|
+
const count = Math.floor(ticks2 / major);
|
|
1388
1412
|
const nodes = [];
|
|
1389
1413
|
for (let step = 0; step <= count; step += 1) {
|
|
1390
|
-
const fraction = step * major /
|
|
1391
|
-
const
|
|
1392
|
-
const labelBox = horizontal ? { x: box.x + box.width *
|
|
1414
|
+
const fraction = step * major / ticks2;
|
|
1415
|
+
const along2 = inset + (1 - 2 * inset) * fraction;
|
|
1416
|
+
const labelBox = horizontal ? { x: box.x + box.width * along2 - 24, y: box.y + edge - fontSize * 2, width: 48, height: fontSize * 2 } : { x: box.x + edge - 48, y: box.y + box.height * (1 - along2) - fontSize, width: 48, height: fontSize * 2 };
|
|
1393
1417
|
nodes.push({
|
|
1394
1418
|
id: `widget-${component.id}-label-${step}`,
|
|
1395
1419
|
type: "text",
|
|
1396
1420
|
order: box.order + 0.1,
|
|
1397
|
-
bounds:
|
|
1421
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(labelBox, 0, 2),
|
|
1398
1422
|
...labelBox,
|
|
1399
1423
|
lines: [String(Math.round((box.min + (box.max - box.min) * fraction) * 10) / 10)],
|
|
1400
|
-
fontFamily: labels.fontFamily ||
|
|
1424
|
+
fontFamily: labels.fontFamily || chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1401
1425
|
fontSize,
|
|
1402
1426
|
fontWeight: labels.weight ?? "normal",
|
|
1403
1427
|
color: labels.color || "#8f95c4",
|
|
@@ -1413,10 +1437,10 @@ function buildRulerLabels(component, box) {
|
|
|
1413
1437
|
var DISABLED_INK = "#94a3b8";
|
|
1414
1438
|
function controlBox(component, index, fallback) {
|
|
1415
1439
|
return {
|
|
1416
|
-
x:
|
|
1417
|
-
y:
|
|
1418
|
-
width: Math.max(1,
|
|
1419
|
-
height: Math.max(1,
|
|
1440
|
+
x: chunkKXYSO6GC_cjs.finite(component.x, 0),
|
|
1441
|
+
y: chunkKXYSO6GC_cjs.finite(component.y, 0),
|
|
1442
|
+
width: Math.max(1, chunkKXYSO6GC_cjs.finite(component.width, fallback.width)),
|
|
1443
|
+
height: Math.max(1, chunkKXYSO6GC_cjs.finite(component.height, fallback.height)),
|
|
1420
1444
|
order: 1e4 + index
|
|
1421
1445
|
};
|
|
1422
1446
|
}
|
|
@@ -1425,14 +1449,16 @@ var numberProperty2 = (component, key) => Number(component.properties[key] ?? 0)
|
|
|
1425
1449
|
var solid = (color) => ({ kind: "solid", color });
|
|
1426
1450
|
var ink = (component, color) => component.disabled ? DISABLED_INK : color;
|
|
1427
1451
|
function fade(component, style) {
|
|
1428
|
-
|
|
1452
|
+
const animate = Number(component.properties.animate ?? 0);
|
|
1453
|
+
const shown = component.disabled ? { ...style, opacity: 0.4 } : style;
|
|
1454
|
+
return animate > 0 ? { ...shown, transition: animate } : shown;
|
|
1429
1455
|
}
|
|
1430
1456
|
function hitArea(component, box) {
|
|
1431
1457
|
return {
|
|
1432
1458
|
id: `widget-${component.id}`,
|
|
1433
1459
|
type: "rect",
|
|
1434
1460
|
order: box.order,
|
|
1435
|
-
bounds:
|
|
1461
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(box, 0, 0),
|
|
1436
1462
|
x: box.x,
|
|
1437
1463
|
y: box.y,
|
|
1438
1464
|
width: box.width,
|
|
@@ -1445,13 +1471,13 @@ function labelText(component, part, area, label, order) {
|
|
|
1445
1471
|
id: `widget-${component.id}-${part}`,
|
|
1446
1472
|
type: "text",
|
|
1447
1473
|
order,
|
|
1448
|
-
bounds:
|
|
1474
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(area, 0, 0),
|
|
1449
1475
|
x: area.x,
|
|
1450
1476
|
y: area.y,
|
|
1451
1477
|
width: area.width,
|
|
1452
1478
|
height: area.height,
|
|
1453
1479
|
lines: [label.text],
|
|
1454
|
-
fontFamily:
|
|
1480
|
+
fontFamily: chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1455
1481
|
fontSize: label.fontSize,
|
|
1456
1482
|
fontWeight: "600",
|
|
1457
1483
|
color: label.color,
|
|
@@ -1470,7 +1496,7 @@ function buildButton(component, index) {
|
|
|
1470
1496
|
id: `widget-${component.id}-face`,
|
|
1471
1497
|
type: "rect",
|
|
1472
1498
|
order: box.order + 0.1,
|
|
1473
|
-
bounds:
|
|
1499
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(box, 0, 0),
|
|
1474
1500
|
x: box.x,
|
|
1475
1501
|
y: box.y,
|
|
1476
1502
|
width: box.width,
|
|
@@ -1509,7 +1535,7 @@ function boxNode(component, box, square) {
|
|
|
1509
1535
|
id: `widget-${component.id}-box`,
|
|
1510
1536
|
type: "rect",
|
|
1511
1537
|
order: box.order + 0.1,
|
|
1512
|
-
bounds:
|
|
1538
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(square, 0, 2),
|
|
1513
1539
|
...square,
|
|
1514
1540
|
rx: square.width * CORNER_RATIO,
|
|
1515
1541
|
style: fade(component, {
|
|
@@ -1524,7 +1550,7 @@ function checkNode(component, box, square) {
|
|
|
1524
1550
|
id: `widget-${component.id}-check`,
|
|
1525
1551
|
type: "path",
|
|
1526
1552
|
order: box.order + 0.2,
|
|
1527
|
-
bounds:
|
|
1553
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(square, 0, 0),
|
|
1528
1554
|
d: checkPath(square),
|
|
1529
1555
|
style: fade(component, {
|
|
1530
1556
|
fill: { kind: "none" },
|
|
@@ -1558,6 +1584,463 @@ function buildCheckbox(component, index) {
|
|
|
1558
1584
|
];
|
|
1559
1585
|
}
|
|
1560
1586
|
|
|
1587
|
+
// src/renderScene/artifacts/component/knob.ts
|
|
1588
|
+
var DOT_RATIO = 0.62;
|
|
1589
|
+
function decimals(step) {
|
|
1590
|
+
return step > 0 ? String(step).split(".")[1]?.length ?? 0 : 0;
|
|
1591
|
+
}
|
|
1592
|
+
function readout(component, fraction) {
|
|
1593
|
+
const display = textProperty(component, "display");
|
|
1594
|
+
if (display === "percent") {
|
|
1595
|
+
return `${Math.round(fraction * 100)}%`;
|
|
1596
|
+
}
|
|
1597
|
+
return display === "value" ? Number(component.value).toFixed(decimals(numberProperty2(component, "step"))) : "";
|
|
1598
|
+
}
|
|
1599
|
+
function buildKnob(component, index) {
|
|
1600
|
+
const box = controlBox(component, index, { width: 96, height: 96 });
|
|
1601
|
+
const min = numberProperty2(component, "min");
|
|
1602
|
+
const max = numberProperty2(component, "max");
|
|
1603
|
+
const fraction = Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1)));
|
|
1604
|
+
const start = numberProperty2(component, "start");
|
|
1605
|
+
const sweep = Math.min(360, Math.max(1, numberProperty2(component, "sweep")));
|
|
1606
|
+
const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 3);
|
|
1607
|
+
const cx = box.x + box.width / 2;
|
|
1608
|
+
const cy = box.y + box.height / 2;
|
|
1609
|
+
const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
|
|
1610
|
+
const circumference = 2 * Math.PI * radius;
|
|
1611
|
+
const round2 = textProperty(component, "rounded") !== "false";
|
|
1612
|
+
const angle = (start - fraction * sweep) * Math.PI / 180;
|
|
1613
|
+
const arc = (part, order, color, length, extra = {}) => ({
|
|
1614
|
+
id: `widget-${component.id}-${part}`,
|
|
1615
|
+
type: "ellipse",
|
|
1616
|
+
order: box.order + order,
|
|
1617
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, thickness),
|
|
1618
|
+
cx,
|
|
1619
|
+
cy,
|
|
1620
|
+
rx: radius,
|
|
1621
|
+
ry: radius,
|
|
1622
|
+
rotation: -start,
|
|
1623
|
+
style: fade(component, {
|
|
1624
|
+
fill: { kind: "none" },
|
|
1625
|
+
stroke: solid(color),
|
|
1626
|
+
strokeWidth: thickness,
|
|
1627
|
+
dash: [Math.max(1e-3, length), circumference],
|
|
1628
|
+
lineCap: round2 ? "round" : "butt",
|
|
1629
|
+
...extra
|
|
1630
|
+
})
|
|
1631
|
+
});
|
|
1632
|
+
const faceRadius = Math.max(1, radius - thickness / 2 - Math.max(2, thickness * 0.4));
|
|
1633
|
+
const dotRadius = thickness / 2 * DOT_RATIO + 1;
|
|
1634
|
+
const nodes = [
|
|
1635
|
+
hitArea(component, box),
|
|
1636
|
+
arc("track", 0.1, textProperty(component, "track"), sweep / 360 * circumference),
|
|
1637
|
+
arc("fill", 0.2, textProperty(component, "accent"), fraction * sweep / 360 * circumference, {
|
|
1638
|
+
opacity: fraction > 0 ? 1 : 0
|
|
1639
|
+
}),
|
|
1640
|
+
{
|
|
1641
|
+
id: `widget-${component.id}-face`,
|
|
1642
|
+
type: "ellipse",
|
|
1643
|
+
order: box.order + 0.3,
|
|
1644
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(
|
|
1645
|
+
{ x: cx - faceRadius, y: cy - faceRadius, width: faceRadius * 2, height: faceRadius * 2 },
|
|
1646
|
+
0,
|
|
1647
|
+
0
|
|
1648
|
+
),
|
|
1649
|
+
cx,
|
|
1650
|
+
cy,
|
|
1651
|
+
rx: faceRadius,
|
|
1652
|
+
ry: faceRadius,
|
|
1653
|
+
style: fade(component, { fill: solid(textProperty(component, "face")), stroke: { kind: "none" } })
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
id: `widget-${component.id}-dot`,
|
|
1657
|
+
type: "ellipse",
|
|
1658
|
+
order: box.order + 0.4,
|
|
1659
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(
|
|
1660
|
+
{
|
|
1661
|
+
x: cx + radius * Math.cos(angle) - dotRadius,
|
|
1662
|
+
y: cy - radius * Math.sin(angle) - dotRadius,
|
|
1663
|
+
width: dotRadius * 2,
|
|
1664
|
+
height: dotRadius * 2
|
|
1665
|
+
},
|
|
1666
|
+
0,
|
|
1667
|
+
0
|
|
1668
|
+
),
|
|
1669
|
+
cx: cx + radius * Math.cos(angle),
|
|
1670
|
+
cy: cy - radius * Math.sin(angle),
|
|
1671
|
+
rx: dotRadius,
|
|
1672
|
+
ry: dotRadius,
|
|
1673
|
+
style: fade(component, { fill: solid(textProperty(component, "dot")), stroke: { kind: "none" } })
|
|
1674
|
+
}
|
|
1675
|
+
];
|
|
1676
|
+
const text = readout(component, fraction);
|
|
1677
|
+
if (text) {
|
|
1678
|
+
const label = {
|
|
1679
|
+
text,
|
|
1680
|
+
color: ink(component, textProperty(component, "textColor")),
|
|
1681
|
+
fontSize: numberProperty2(component, "fontSize"),
|
|
1682
|
+
align: "center"
|
|
1683
|
+
};
|
|
1684
|
+
nodes.push(
|
|
1685
|
+
labelText(
|
|
1686
|
+
component,
|
|
1687
|
+
"value",
|
|
1688
|
+
{ x: cx - faceRadius, y: cy - faceRadius, width: faceRadius * 2, height: faceRadius * 2 },
|
|
1689
|
+
label,
|
|
1690
|
+
box.order + 0.5
|
|
1691
|
+
)
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
return nodes;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
// src/renderScene/artifacts/component/progress.ts
|
|
1698
|
+
function readout2(component, fraction) {
|
|
1699
|
+
const display = textProperty(component, "display");
|
|
1700
|
+
if (display === "percent") {
|
|
1701
|
+
return `${Math.round(fraction * 100)}%`;
|
|
1702
|
+
}
|
|
1703
|
+
return display === "value" ? String(Number(component.value)) : "";
|
|
1704
|
+
}
|
|
1705
|
+
function buildProgress(component, index) {
|
|
1706
|
+
const box = controlBox(component, index, { width: 220, height: 12 });
|
|
1707
|
+
const min = numberProperty2(component, "min");
|
|
1708
|
+
const max = numberProperty2(component, "max");
|
|
1709
|
+
const fraction = Math.min(1, Math.max(0, (Number(component.value) - min) / (max - min || 1)));
|
|
1710
|
+
const round2 = textProperty(component, "rounded") !== "false";
|
|
1711
|
+
const nodes = [hitArea(component, box)];
|
|
1712
|
+
if (textProperty(component, "variant") === "ring") {
|
|
1713
|
+
const thickness = Math.min(numberProperty2(component, "thickness"), Math.min(box.width, box.height) / 2);
|
|
1714
|
+
const radius = Math.max(1, Math.min(box.width, box.height) / 2 - thickness / 2);
|
|
1715
|
+
const circumference = 2 * Math.PI * radius;
|
|
1716
|
+
const cx = box.x + box.width / 2;
|
|
1717
|
+
const cy = box.y + box.height / 2;
|
|
1718
|
+
const ring = (part, order, color, extra) => ({
|
|
1719
|
+
id: `widget-${component.id}-${part}`,
|
|
1720
|
+
type: "ellipse",
|
|
1721
|
+
order: box.order + order,
|
|
1722
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, thickness),
|
|
1723
|
+
cx,
|
|
1724
|
+
cy,
|
|
1725
|
+
rx: radius,
|
|
1726
|
+
ry: radius,
|
|
1727
|
+
rotation: -90,
|
|
1728
|
+
style: fade(component, { fill: { kind: "none" }, stroke: solid(color), strokeWidth: thickness, ...extra })
|
|
1729
|
+
});
|
|
1730
|
+
nodes.push(ring("track", 0.1, textProperty(component, "track"), {}));
|
|
1731
|
+
nodes.push(
|
|
1732
|
+
ring("fill", 0.2, textProperty(component, "accent"), {
|
|
1733
|
+
dash: [Math.max(1e-3, fraction * circumference), circumference],
|
|
1734
|
+
lineCap: round2 ? "round" : "butt",
|
|
1735
|
+
opacity: fraction > 0 ? 1 : 0
|
|
1736
|
+
})
|
|
1737
|
+
);
|
|
1738
|
+
} else {
|
|
1739
|
+
const vertical = textProperty(component, "direction") === "vertical";
|
|
1740
|
+
const radius = round2 ? (vertical ? box.width : box.height) / 2 : 0;
|
|
1741
|
+
const bar = (part, order, length, color, opacity) => {
|
|
1742
|
+
const shape = vertical ? { x: box.x, y: box.y + box.height - length, width: box.width, height: length } : { x: box.x, y: box.y, width: length, height: box.height };
|
|
1743
|
+
return {
|
|
1744
|
+
id: `widget-${component.id}-${part}`,
|
|
1745
|
+
type: "rect",
|
|
1746
|
+
order: box.order + order,
|
|
1747
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(shape, 0, 0),
|
|
1748
|
+
...shape,
|
|
1749
|
+
rx: radius,
|
|
1750
|
+
style: fade(component, {
|
|
1751
|
+
fill: solid(color),
|
|
1752
|
+
stroke: { kind: "none" },
|
|
1753
|
+
...opacity === void 0 ? {} : { opacity }
|
|
1754
|
+
})
|
|
1755
|
+
};
|
|
1756
|
+
};
|
|
1757
|
+
const full = vertical ? box.height : box.width;
|
|
1758
|
+
nodes.push(bar("track", 0.1, full, textProperty(component, "track")));
|
|
1759
|
+
nodes.push(bar("fill", 0.2, Math.max(0, fraction * full), textProperty(component, "accent"), fraction > 0 ? 1 : 0));
|
|
1760
|
+
}
|
|
1761
|
+
const text = readout2(component, fraction);
|
|
1762
|
+
if (text) {
|
|
1763
|
+
const label = {
|
|
1764
|
+
text,
|
|
1765
|
+
color: ink(component, textProperty(component, "textColor")),
|
|
1766
|
+
fontSize: numberProperty2(component, "fontSize"),
|
|
1767
|
+
align: "center"
|
|
1768
|
+
};
|
|
1769
|
+
nodes.push(labelText(component, "value", box, label, box.order + 0.3));
|
|
1770
|
+
}
|
|
1771
|
+
return nodes;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
// src/renderScene/artifacts/component/segmented.ts
|
|
1775
|
+
function buildSegmented(component, index) {
|
|
1776
|
+
const box = controlBox(component, index, { width: 300, height: 40 });
|
|
1777
|
+
const options = textProperty(component, "options").split(",").map((option) => option.trim()).filter(Boolean);
|
|
1778
|
+
const count = Math.max(1, options.length);
|
|
1779
|
+
const active = Math.min(count - 1, Math.max(0, Math.round(Number(component.value)) || 0));
|
|
1780
|
+
const inset = Math.min(numberProperty2(component, "inset"), box.height / 2);
|
|
1781
|
+
const radius = Math.min(numberProperty2(component, "radius"), box.height / 2);
|
|
1782
|
+
const cellWidth = (box.width - inset * 2) / count;
|
|
1783
|
+
const cell = { y: box.y + inset, height: box.height - inset * 2 };
|
|
1784
|
+
const nodes = [
|
|
1785
|
+
hitArea(component, box),
|
|
1786
|
+
{
|
|
1787
|
+
id: `widget-${component.id}-track`,
|
|
1788
|
+
type: "rect",
|
|
1789
|
+
order: box.order + 0.1,
|
|
1790
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(box, 0, 0),
|
|
1791
|
+
x: box.x,
|
|
1792
|
+
y: box.y,
|
|
1793
|
+
width: box.width,
|
|
1794
|
+
height: box.height,
|
|
1795
|
+
rx: radius,
|
|
1796
|
+
style: fade(component, { fill: solid(textProperty(component, "track")), stroke: { kind: "none" } })
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
id: `widget-${component.id}-active`,
|
|
1800
|
+
type: "rect",
|
|
1801
|
+
order: box.order + 0.2,
|
|
1802
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x: box.x + inset + active * cellWidth, width: cellWidth, ...cell }, 0, 0),
|
|
1803
|
+
x: box.x + inset + active * cellWidth,
|
|
1804
|
+
y: cell.y,
|
|
1805
|
+
width: cellWidth,
|
|
1806
|
+
height: cell.height,
|
|
1807
|
+
rx: Math.max(0, radius - inset),
|
|
1808
|
+
style: fade(component, {
|
|
1809
|
+
fill: solid(textProperty(component, "accent")),
|
|
1810
|
+
stroke: { kind: "none" },
|
|
1811
|
+
shadow: { color: "#000000", opacity: 0.18, blur: 3, dx: 0, dy: 1 }
|
|
1812
|
+
})
|
|
1813
|
+
}
|
|
1814
|
+
];
|
|
1815
|
+
options.forEach((option, position) => {
|
|
1816
|
+
const area = { x: box.x + inset + position * cellWidth, width: cellWidth, ...cell };
|
|
1817
|
+
const color = ink(component, textProperty(component, position === active ? "activeTextColor" : "textColor"));
|
|
1818
|
+
nodes.push(
|
|
1819
|
+
labelText(
|
|
1820
|
+
component,
|
|
1821
|
+
`option-${position}`,
|
|
1822
|
+
area,
|
|
1823
|
+
{ text: option, color, fontSize: numberProperty2(component, "fontSize"), align: "center" },
|
|
1824
|
+
box.order + 0.3
|
|
1825
|
+
)
|
|
1826
|
+
);
|
|
1827
|
+
});
|
|
1828
|
+
return nodes;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
// src/model/component/sliderReach.ts
|
|
1832
|
+
function sliderReach(variant2, height) {
|
|
1833
|
+
return variant2 === "field" ? Math.min(8, height / 2) : height / 2;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
// src/renderScene/artifacts/component/slider.ts
|
|
1837
|
+
var HANDLE_WIDTH = 4;
|
|
1838
|
+
var TEXT_PADDING = 12;
|
|
1839
|
+
var TICK_LENGTH = 5;
|
|
1840
|
+
var TICK_THICKNESS = 1.5;
|
|
1841
|
+
function decimals2(step) {
|
|
1842
|
+
return step > 0 ? String(step).split(".")[1]?.length ?? 0 : 0;
|
|
1843
|
+
}
|
|
1844
|
+
function readout3(component, thumbs) {
|
|
1845
|
+
const display = textProperty(component, "display");
|
|
1846
|
+
const places = decimals2(numberProperty2(component, "step"));
|
|
1847
|
+
const parts = display === "percent" ? thumbs.two ? [thumbs.from, thumbs.to].map((fraction) => `${Math.round(fraction * 100)}%`) : [`${Math.round(thumbs.to * 100)}%`] : display === "value" ? thumbs.values.map((value) => value.toFixed(places)) : [];
|
|
1848
|
+
return parts.join(" \u2013 ");
|
|
1849
|
+
}
|
|
1850
|
+
var rect = (component, box, part, order, shape, color, extra = {}) => ({
|
|
1851
|
+
id: `widget-${component.id}-${part}`,
|
|
1852
|
+
type: "rect",
|
|
1853
|
+
order: box.order + order,
|
|
1854
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(shape, 0, 0),
|
|
1855
|
+
...shape,
|
|
1856
|
+
style: fade(component, { fill: solid(color), stroke: { kind: "none" }, ...extra })
|
|
1857
|
+
});
|
|
1858
|
+
function ticks(component, box, vertical, reach, offset) {
|
|
1859
|
+
const count = Math.round(numberProperty2(component, "ticks"));
|
|
1860
|
+
const color = textProperty(component, "tickColor");
|
|
1861
|
+
return Array.from({ length: count >= 2 ? count : 0 }, (_, index) => {
|
|
1862
|
+
const t = index / (count - 1);
|
|
1863
|
+
const shape = vertical ? {
|
|
1864
|
+
x: box.x + offset,
|
|
1865
|
+
y: box.y + box.height - reach - t * (box.height - reach * 2) - TICK_THICKNESS / 2,
|
|
1866
|
+
width: TICK_LENGTH,
|
|
1867
|
+
height: TICK_THICKNESS,
|
|
1868
|
+
rx: TICK_THICKNESS / 2
|
|
1869
|
+
} : {
|
|
1870
|
+
x: box.x + reach + t * (box.width - reach * 2) - TICK_THICKNESS / 2,
|
|
1871
|
+
y: box.y + offset,
|
|
1872
|
+
width: TICK_THICKNESS,
|
|
1873
|
+
height: TICK_LENGTH,
|
|
1874
|
+
rx: TICK_THICKNESS / 2
|
|
1875
|
+
};
|
|
1876
|
+
return rect(component, box, `tick-${index}`, 0.15, shape, color);
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
function buildLine(component, box, thumbs, vertical) {
|
|
1880
|
+
const reach = sliderReach("line", vertical ? box.width : box.height);
|
|
1881
|
+
const radius = reach * numberProperty2(component, "thumbSize") / 100;
|
|
1882
|
+
const thickness = Math.min(numberProperty2(component, "trackHeight"), vertical ? box.width : box.height);
|
|
1883
|
+
const mid = vertical ? box.x + box.width / 2 : box.y + box.height / 2;
|
|
1884
|
+
const along2 = (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
|
|
1885
|
+
const line = (start, end) => vertical ? {
|
|
1886
|
+
x: mid - thickness / 2,
|
|
1887
|
+
y: Math.min(start, end),
|
|
1888
|
+
width: thickness,
|
|
1889
|
+
height: Math.abs(end - start),
|
|
1890
|
+
rx: thickness / 2
|
|
1891
|
+
} : {
|
|
1892
|
+
x: Math.min(start, end),
|
|
1893
|
+
y: mid - thickness / 2,
|
|
1894
|
+
width: Math.abs(end - start),
|
|
1895
|
+
height: thickness,
|
|
1896
|
+
rx: thickness / 2
|
|
1897
|
+
};
|
|
1898
|
+
const whole = vertical ? line(box.y, box.y + box.height) : line(box.x, box.x + box.width);
|
|
1899
|
+
const filled = line(thumbs.two ? along2(thumbs.from) : vertical ? box.y + box.height : box.x, along2(thumbs.to));
|
|
1900
|
+
const thumb = (part, fraction, order) => {
|
|
1901
|
+
const cx = vertical ? mid : along2(fraction);
|
|
1902
|
+
const cy = vertical ? along2(fraction) : mid;
|
|
1903
|
+
return {
|
|
1904
|
+
id: `widget-${component.id}-${part}`,
|
|
1905
|
+
type: "ellipse",
|
|
1906
|
+
order: box.order + order,
|
|
1907
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x: cx - radius, y: cy - radius, width: radius * 2, height: radius * 2 }, 0, 0),
|
|
1908
|
+
cx,
|
|
1909
|
+
cy,
|
|
1910
|
+
rx: radius,
|
|
1911
|
+
ry: radius,
|
|
1912
|
+
style: fade(component, {
|
|
1913
|
+
fill: solid(textProperty(component, "thumb")),
|
|
1914
|
+
stroke: { kind: "none" },
|
|
1915
|
+
shadow: { color: "#000000", opacity: 0.25, blur: 3, dx: 0, dy: 1 }
|
|
1916
|
+
})
|
|
1917
|
+
};
|
|
1918
|
+
};
|
|
1919
|
+
return [
|
|
1920
|
+
rect(component, box, "track", 0.1, whole, textProperty(component, "track")),
|
|
1921
|
+
...ticks(
|
|
1922
|
+
component,
|
|
1923
|
+
box,
|
|
1924
|
+
vertical,
|
|
1925
|
+
reach,
|
|
1926
|
+
vertical ? box.width / 2 + thickness / 2 + 5 : box.height / 2 + thickness / 2 + 5
|
|
1927
|
+
),
|
|
1928
|
+
rect(component, box, "fill", 0.2, filled, textProperty(component, "accent")),
|
|
1929
|
+
...thumbs.two ? [thumb("thumb-start", thumbs.from, 0.3)] : [],
|
|
1930
|
+
thumb(thumbs.two ? "thumb-end" : "thumb", thumbs.to, 0.31)
|
|
1931
|
+
];
|
|
1932
|
+
}
|
|
1933
|
+
function buildField(component, box, thumbs, vertical) {
|
|
1934
|
+
const reach = sliderReach("field", vertical ? box.width : box.height);
|
|
1935
|
+
const radius = Math.min(numberProperty2(component, "radius"), Math.min(box.width, box.height) / 2);
|
|
1936
|
+
const whole = { x: box.x, y: box.y, width: box.width, height: box.height, rx: radius };
|
|
1937
|
+
const along2 = (fraction) => vertical ? box.y + box.height - reach - fraction * (box.height - reach * 2) : box.x + reach + fraction * (box.width - reach * 2);
|
|
1938
|
+
const start = thumbs.two ? along2(thumbs.from) : vertical ? box.y + box.height : box.x;
|
|
1939
|
+
const end = along2(thumbs.to);
|
|
1940
|
+
const first = Math.min(start, end) - (thumbs.two ? HANDLE_WIDTH / 2 : 0);
|
|
1941
|
+
const last = Math.max(start, end) + HANDLE_WIDTH / 2;
|
|
1942
|
+
const filled = vertical ? {
|
|
1943
|
+
...whole,
|
|
1944
|
+
y: thumbs.two ? first : end - HANDLE_WIDTH / 2,
|
|
1945
|
+
height: thumbs.two ? last - first : Math.max(0, box.y + box.height - end + HANDLE_WIDTH / 2),
|
|
1946
|
+
rx: thumbs.two ? 0 : radius
|
|
1947
|
+
} : {
|
|
1948
|
+
...whole,
|
|
1949
|
+
x: thumbs.two ? first : box.x,
|
|
1950
|
+
width: thumbs.two ? last - first : Math.max(0, end + HANDLE_WIDTH / 2 - box.x),
|
|
1951
|
+
rx: thumbs.two ? 0 : radius
|
|
1952
|
+
};
|
|
1953
|
+
const handleLength = (vertical ? box.width : box.height) * 0.5;
|
|
1954
|
+
const handle = (part, at) => {
|
|
1955
|
+
const shape = vertical ? {
|
|
1956
|
+
x: box.x + (box.width - handleLength) / 2,
|
|
1957
|
+
y: at - HANDLE_WIDTH / 2,
|
|
1958
|
+
width: handleLength,
|
|
1959
|
+
height: HANDLE_WIDTH,
|
|
1960
|
+
rx: HANDLE_WIDTH / 2
|
|
1961
|
+
} : {
|
|
1962
|
+
x: at - HANDLE_WIDTH / 2,
|
|
1963
|
+
y: box.y + (box.height - handleLength) / 2,
|
|
1964
|
+
width: HANDLE_WIDTH,
|
|
1965
|
+
height: handleLength,
|
|
1966
|
+
rx: HANDLE_WIDTH / 2
|
|
1967
|
+
};
|
|
1968
|
+
return rect(component, box, part, 0.3, shape, textProperty(component, "accent"));
|
|
1969
|
+
};
|
|
1970
|
+
const nodes = [
|
|
1971
|
+
rect(component, box, "track", 0.1, whole, textProperty(component, "surface")),
|
|
1972
|
+
rect(component, box, "fill", 0.2, filled, textProperty(component, "fill")),
|
|
1973
|
+
...thumbs.two ? [handle("handle-start", start)] : [],
|
|
1974
|
+
handle(thumbs.two ? "handle-end" : "handle", end)
|
|
1975
|
+
];
|
|
1976
|
+
const text = {
|
|
1977
|
+
color: ink(component, textProperty(component, "textColor")),
|
|
1978
|
+
fontSize: numberProperty2(component, "fontSize")
|
|
1979
|
+
};
|
|
1980
|
+
const value = readout3(component, thumbs);
|
|
1981
|
+
if (vertical) {
|
|
1982
|
+
if (value) {
|
|
1983
|
+
nodes.push(
|
|
1984
|
+
labelText(
|
|
1985
|
+
component,
|
|
1986
|
+
"value",
|
|
1987
|
+
{ x: box.x, y: box.y + 6, width: box.width, height: 20 },
|
|
1988
|
+
{ ...text, text: value, align: "center" },
|
|
1989
|
+
box.order + 0.4
|
|
1990
|
+
)
|
|
1991
|
+
);
|
|
1992
|
+
}
|
|
1993
|
+
return nodes;
|
|
1994
|
+
}
|
|
1995
|
+
const inner = { y: box.y, height: box.height, width: Math.max(0, box.width / 2 - TEXT_PADDING) };
|
|
1996
|
+
if (component.label) {
|
|
1997
|
+
nodes.push(
|
|
1998
|
+
labelText(
|
|
1999
|
+
component,
|
|
2000
|
+
"label",
|
|
2001
|
+
{ x: box.x + TEXT_PADDING, ...inner },
|
|
2002
|
+
{ ...text, text: component.label, align: "left" },
|
|
2003
|
+
box.order + 0.4
|
|
2004
|
+
)
|
|
2005
|
+
);
|
|
2006
|
+
}
|
|
2007
|
+
if (value) {
|
|
2008
|
+
nodes.push(
|
|
2009
|
+
labelText(
|
|
2010
|
+
component,
|
|
2011
|
+
"value",
|
|
2012
|
+
{ x: box.x + box.width / 2, ...inner },
|
|
2013
|
+
{ ...text, text: value, align: "right" },
|
|
2014
|
+
box.order + 0.4
|
|
2015
|
+
)
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
nodes.push(...ticks(component, box, false, reach, box.height - TICK_LENGTH - 5));
|
|
2019
|
+
return nodes;
|
|
2020
|
+
}
|
|
2021
|
+
function buildSlider(component, index) {
|
|
2022
|
+
const field = textProperty(component, "variant") === "field";
|
|
2023
|
+
const vertical = textProperty(component, "direction") === "vertical";
|
|
2024
|
+
const fallback = vertical ? { width: field ? 56 : 28, height: 180 } : { width: 220, height: field ? 36 : 28 };
|
|
2025
|
+
const box = controlBox(component, index, fallback);
|
|
2026
|
+
const min = numberProperty2(component, "min");
|
|
2027
|
+
const max = numberProperty2(component, "max");
|
|
2028
|
+
const fractionOf = (value) => Math.min(1, Math.max(0, (value - min) / (max - min || 1)));
|
|
2029
|
+
const two = component.type === "range";
|
|
2030
|
+
const low = Number(component.value);
|
|
2031
|
+
const high = two ? Number(component.properties.valueEnd ?? max) : low;
|
|
2032
|
+
const thumbs = {
|
|
2033
|
+
from: fractionOf(two ? Math.min(low, high) : min),
|
|
2034
|
+
to: fractionOf(two ? Math.max(low, high) : low),
|
|
2035
|
+
values: two ? [Math.min(low, high), Math.max(low, high)] : [low],
|
|
2036
|
+
two
|
|
2037
|
+
};
|
|
2038
|
+
return [
|
|
2039
|
+
hitArea(component, box),
|
|
2040
|
+
...field ? buildField(component, box, thumbs, vertical) : buildLine(component, box, thumbs, vertical)
|
|
2041
|
+
];
|
|
2042
|
+
}
|
|
2043
|
+
|
|
1561
2044
|
// src/renderScene/artifacts/component/switch.ts
|
|
1562
2045
|
var PADDING_RATIO = 0.12;
|
|
1563
2046
|
function buildSwitch(component, index) {
|
|
@@ -1573,7 +2056,7 @@ function buildSwitch(component, index) {
|
|
|
1573
2056
|
id: `widget-${component.id}-track`,
|
|
1574
2057
|
type: "rect",
|
|
1575
2058
|
order: box.order + 0.1,
|
|
1576
|
-
bounds:
|
|
2059
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(box, 0, 0),
|
|
1577
2060
|
x: box.x,
|
|
1578
2061
|
y: box.y,
|
|
1579
2062
|
width: box.width,
|
|
@@ -1588,7 +2071,7 @@ function buildSwitch(component, index) {
|
|
|
1588
2071
|
id: `widget-${component.id}-thumb`,
|
|
1589
2072
|
type: "ellipse",
|
|
1590
2073
|
order: box.order + 0.2,
|
|
1591
|
-
bounds:
|
|
2074
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(thumb, 0, 0),
|
|
1592
2075
|
cx: centerX,
|
|
1593
2076
|
cy: box.y + box.height / 2,
|
|
1594
2077
|
rx: radius,
|
|
@@ -1612,7 +2095,7 @@ function buildToggleButton(component, index) {
|
|
|
1612
2095
|
id: `widget-${component.id}-face`,
|
|
1613
2096
|
type: "rect",
|
|
1614
2097
|
order: box.order + 0.1,
|
|
1615
|
-
bounds:
|
|
2098
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(box, 0, 2),
|
|
1616
2099
|
x: box.x,
|
|
1617
2100
|
y: box.y,
|
|
1618
2101
|
width: box.width,
|
|
@@ -1646,7 +2129,12 @@ var builders = /* @__PURE__ */ new Map([
|
|
|
1646
2129
|
["switch", asComponentBuilder(buildSwitch)],
|
|
1647
2130
|
["checkbox", asComponentBuilder(buildCheckbox)],
|
|
1648
2131
|
["toggleButton", asComponentBuilder(buildToggleButton)],
|
|
1649
|
-
["button", asComponentBuilder(buildButton)]
|
|
2132
|
+
["button", asComponentBuilder(buildButton)],
|
|
2133
|
+
["slider", asComponentBuilder(buildSlider)],
|
|
2134
|
+
["progress", asComponentBuilder(buildProgress)],
|
|
2135
|
+
["segmented", asComponentBuilder(buildSegmented)],
|
|
2136
|
+
["knob", asComponentBuilder(buildKnob)],
|
|
2137
|
+
["range", asComponentBuilder(buildSlider)]
|
|
1650
2138
|
]);
|
|
1651
2139
|
function registerComponentBuilder(type, builder) {
|
|
1652
2140
|
builders.set(type, builder);
|
|
@@ -1662,8 +2150,8 @@ function getComponentBuilder(type) {
|
|
|
1662
2150
|
|
|
1663
2151
|
// src/renderScene/artifacts/component/build.ts
|
|
1664
2152
|
function ariaOf(component) {
|
|
1665
|
-
const role =
|
|
1666
|
-
if (!role || !
|
|
2153
|
+
const role = chunkKXYSO6GC_cjs.getComponentDescriptor(component.type)?.role;
|
|
2154
|
+
if (!role || !chunkKXYSO6GC_cjs.isGenericComponent(component)) {
|
|
1667
2155
|
return void 0;
|
|
1668
2156
|
}
|
|
1669
2157
|
const flag = typeof component.value === "boolean" ? component.value : void 0;
|
|
@@ -1674,12 +2162,12 @@ function ariaOf(component) {
|
|
|
1674
2162
|
};
|
|
1675
2163
|
}
|
|
1676
2164
|
function labelOf(component) {
|
|
1677
|
-
return component.label ?? (
|
|
2165
|
+
return component.label ?? (chunkKXYSO6GC_cjs.isGenericComponent(component) ? component.id : String(component.value));
|
|
1678
2166
|
}
|
|
1679
2167
|
function buildComponents(components) {
|
|
1680
2168
|
return components.flatMap((component, index) => {
|
|
1681
2169
|
const build = getComponentBuilder(component.type) ?? buildPlaceholder;
|
|
1682
|
-
const nodes =
|
|
2170
|
+
const nodes = chunkKXYSO6GC_cjs.tag(
|
|
1683
2171
|
build(component, index),
|
|
1684
2172
|
"widget",
|
|
1685
2173
|
component.id,
|
|
@@ -1719,13 +2207,13 @@ function tabBox(input, thickness, length) {
|
|
|
1719
2207
|
y,
|
|
1720
2208
|
width: length,
|
|
1721
2209
|
height: thickness,
|
|
1722
|
-
path:
|
|
2210
|
+
path: chunkKXYSO6GC_cjs.bottomRoundedRectPath(x, y, length, thickness, TAB_RADIUS)
|
|
1723
2211
|
};
|
|
1724
2212
|
}
|
|
1725
2213
|
case "left": {
|
|
1726
2214
|
const x = input.x - thickness;
|
|
1727
2215
|
const y = input.y - inset;
|
|
1728
|
-
return { x, y, width: thickness, height: length, path:
|
|
2216
|
+
return { x, y, width: thickness, height: length, path: chunkKXYSO6GC_cjs.leftRoundedRectPath(x, y, thickness, length, TAB_RADIUS) };
|
|
1729
2217
|
}
|
|
1730
2218
|
case "right": {
|
|
1731
2219
|
const x = input.x + input.width;
|
|
@@ -1735,13 +2223,13 @@ function tabBox(input, thickness, length) {
|
|
|
1735
2223
|
y,
|
|
1736
2224
|
width: thickness,
|
|
1737
2225
|
height: length,
|
|
1738
|
-
path:
|
|
2226
|
+
path: chunkKXYSO6GC_cjs.rightRoundedRectPath(x, y, thickness, length, TAB_RADIUS)
|
|
1739
2227
|
};
|
|
1740
2228
|
}
|
|
1741
2229
|
default: {
|
|
1742
2230
|
const x = input.x - inset;
|
|
1743
2231
|
const y = input.y - thickness;
|
|
1744
|
-
return { x, y, width: length, height: thickness, path:
|
|
2232
|
+
return { x, y, width: length, height: thickness, path: chunkKXYSO6GC_cjs.topRoundedRectPath(x, y, length, thickness, TAB_RADIUS) };
|
|
1745
2233
|
}
|
|
1746
2234
|
}
|
|
1747
2235
|
}
|
|
@@ -1750,7 +2238,7 @@ function renderTitleTab(input) {
|
|
|
1750
2238
|
const padding = 16;
|
|
1751
2239
|
const length = Math.max(120, input.title.length * input.fontSize * 0.62 + padding * 2);
|
|
1752
2240
|
const box = tabBox(input, thickness, length);
|
|
1753
|
-
const bounds =
|
|
2241
|
+
const bounds = chunkKXYSO6GC_cjs.boxBounds(box, 6);
|
|
1754
2242
|
const vertical = input.labelPosition === "left" || input.labelPosition === "right";
|
|
1755
2243
|
return [
|
|
1756
2244
|
{
|
|
@@ -1778,7 +2266,7 @@ function horizontalTitleText(input, box, padding, bounds) {
|
|
|
1778
2266
|
width: Math.max(0, box.width - padding * 2),
|
|
1779
2267
|
height: box.height,
|
|
1780
2268
|
lines: [input.title],
|
|
1781
|
-
fontFamily: input.fontFamily ??
|
|
2269
|
+
fontFamily: input.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1782
2270
|
fontSize: input.fontSize,
|
|
1783
2271
|
fontWeight: input.fontWeight,
|
|
1784
2272
|
color: input.textColor,
|
|
@@ -1802,7 +2290,7 @@ function verticalTitleText(input, box, padding, bounds) {
|
|
|
1802
2290
|
width: textLength,
|
|
1803
2291
|
height: textThickness,
|
|
1804
2292
|
lines: [input.title],
|
|
1805
|
-
fontFamily: input.fontFamily ??
|
|
2293
|
+
fontFamily: input.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1806
2294
|
fontSize: input.fontSize,
|
|
1807
2295
|
fontWeight: input.fontWeight,
|
|
1808
2296
|
color: input.textColor,
|
|
@@ -1823,7 +2311,7 @@ var SQUARED_CORNER_BY_LABEL_POSITION = {
|
|
|
1823
2311
|
};
|
|
1824
2312
|
function frameBoundaryNode(frame, order, hasTab) {
|
|
1825
2313
|
const shadow = frame.shadow ?? true;
|
|
1826
|
-
const bounds =
|
|
2314
|
+
const bounds = chunkKXYSO6GC_cjs.boxBounds(
|
|
1827
2315
|
{ x: frame.x, y: frame.y, width: frame.width, height: frame.height },
|
|
1828
2316
|
frame.strokeWidth + (shadow ? 20 : 4)
|
|
1829
2317
|
);
|
|
@@ -1858,7 +2346,7 @@ function frameBoundaryNode(frame, order, hasTab) {
|
|
|
1858
2346
|
id: `frame-${frame.id}`,
|
|
1859
2347
|
order,
|
|
1860
2348
|
bounds,
|
|
1861
|
-
d:
|
|
2349
|
+
d: chunkKXYSO6GC_cjs.cornersRoundedRectPath(frame.x, frame.y, frame.width, frame.height, radii),
|
|
1862
2350
|
detail: { of: "frameBoundary", cornerRadius: frame.cornerRadius, squareCorner: squared },
|
|
1863
2351
|
style
|
|
1864
2352
|
};
|
|
@@ -1947,7 +2435,7 @@ function labelBase(context, lane, index) {
|
|
|
1947
2435
|
id: `swimlane-label-${context.swimlane.id}-${lane.id}`,
|
|
1948
2436
|
order: context.order + 0.5 + index / 100,
|
|
1949
2437
|
lines: [lane.label],
|
|
1950
|
-
fontFamily: context.swimlane.fontFamily ??
|
|
2438
|
+
fontFamily: context.swimlane.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
1951
2439
|
fontSize: context.swimlane.fontSize,
|
|
1952
2440
|
fontWeight: context.swimlane.fontWeight,
|
|
1953
2441
|
color: context.swimlane.textColor,
|
|
@@ -1963,7 +2451,7 @@ function horizontalLabel(context, lane, index) {
|
|
|
1963
2451
|
const y = centerY - thickness / 2;
|
|
1964
2452
|
return {
|
|
1965
2453
|
...labelBase(context, lane, index),
|
|
1966
|
-
bounds:
|
|
2454
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x, y, width, height: thickness }, -90, 12),
|
|
1967
2455
|
x,
|
|
1968
2456
|
y,
|
|
1969
2457
|
width,
|
|
@@ -2015,7 +2503,7 @@ function createSwimlaneRenderContext(swimlane, index) {
|
|
|
2015
2503
|
return {
|
|
2016
2504
|
swimlane,
|
|
2017
2505
|
order: 5e3 + index,
|
|
2018
|
-
bounds:
|
|
2506
|
+
bounds: chunkKXYSO6GC_cjs.boxBounds(
|
|
2019
2507
|
{ x: swimlane.x, y: swimlane.y, width: swimlane.width, height: swimlane.height },
|
|
2020
2508
|
swimlane.strokeWidth + 4
|
|
2021
2509
|
),
|
|
@@ -2054,17 +2542,140 @@ function buildSwimlane(swimlane, index) {
|
|
|
2054
2542
|
function buildContainers(input) {
|
|
2055
2543
|
return [
|
|
2056
2544
|
...input.frames.flatMap(
|
|
2057
|
-
(frame, index) =>
|
|
2545
|
+
(frame, index) => chunkKXYSO6GC_cjs.tag(buildFrame(frame, index), "frame", frame.id, void 0, frame.title ?? void 0)
|
|
2058
2546
|
),
|
|
2059
|
-
...input.swimlanes.flatMap((swimlane, index) =>
|
|
2547
|
+
...input.swimlanes.flatMap((swimlane, index) => chunkKXYSO6GC_cjs.tag(buildSwimlane(swimlane, index), "swimlane", swimlane.id))
|
|
2548
|
+
];
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
// src/model/dimension/geometry.ts
|
|
2552
|
+
var GAP = 4;
|
|
2553
|
+
var OVERSHOOT = 6;
|
|
2554
|
+
var along = (origin, direction, distance) => ({
|
|
2555
|
+
x: origin.x + direction.x * distance,
|
|
2556
|
+
y: origin.y + direction.y * distance
|
|
2557
|
+
});
|
|
2558
|
+
function dimensionLength(dimension) {
|
|
2559
|
+
return Math.hypot(dimension.end.x - dimension.start.x, dimension.end.y - dimension.start.y);
|
|
2560
|
+
}
|
|
2561
|
+
function dimensionText(dimension) {
|
|
2562
|
+
if (dimension.text !== void 0) {
|
|
2563
|
+
return dimension.text;
|
|
2564
|
+
}
|
|
2565
|
+
const length = Math.round(dimensionLength(dimension) * 10) / 10;
|
|
2566
|
+
return `${length}${dimension.unit ? ` ${dimension.unit}` : ""}`;
|
|
2567
|
+
}
|
|
2568
|
+
function dimensionGeometry(dimension) {
|
|
2569
|
+
const length = dimensionLength(dimension);
|
|
2570
|
+
const direction = length === 0 ? { x: 1, y: 0 } : { x: (dimension.end.x - dimension.start.x) / length, y: (dimension.end.y - dimension.start.y) / length };
|
|
2571
|
+
const normal = { x: direction.y, y: -direction.x };
|
|
2572
|
+
const side = dimension.offset < 0 ? -1 : 1;
|
|
2573
|
+
const line = [
|
|
2574
|
+
along(dimension.start, normal, dimension.offset),
|
|
2575
|
+
along(dimension.end, normal, dimension.offset)
|
|
2060
2576
|
];
|
|
2577
|
+
const extensions = Math.abs(dimension.offset) <= GAP ? [] : [dimension.start, dimension.end].map((point) => [
|
|
2578
|
+
along(point, normal, GAP * side),
|
|
2579
|
+
along(point, normal, dimension.offset + OVERSHOOT * side)
|
|
2580
|
+
]);
|
|
2581
|
+
const lift = ((dimension.fontSize ?? 11) * 0.75 + 2) * side;
|
|
2582
|
+
const middle = { x: (line[0].x + line[1].x) / 2, y: (line[0].y + line[1].y) / 2 };
|
|
2583
|
+
let angle = Math.atan2(direction.y, direction.x) * 180 / Math.PI;
|
|
2584
|
+
if (angle > 90) {
|
|
2585
|
+
angle -= 180;
|
|
2586
|
+
} else if (angle <= -90) {
|
|
2587
|
+
angle += 180;
|
|
2588
|
+
}
|
|
2589
|
+
return { length, line, extensions, label: { center: along(middle, normal, lift), angle } };
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
// src/renderScene/artifacts/dimension.ts
|
|
2593
|
+
var DEFAULT_COLOR = "#475569";
|
|
2594
|
+
var CHAR_WIDTH = 0.6;
|
|
2595
|
+
var pathData = (segments) => segments.map(([from, to]) => `M ${from.x} ${from.y} L ${to.x} ${to.y}`).join(" ");
|
|
2596
|
+
function pathNode(dimension, name, order, segments) {
|
|
2597
|
+
const strokeWidth = Math.max(0, chunkKXYSO6GC_cjs.finite(dimension.strokeWidth, 1));
|
|
2598
|
+
const points = segments.flat();
|
|
2599
|
+
return {
|
|
2600
|
+
type: "path",
|
|
2601
|
+
id: `dimension-${dimension.id}-${name}`,
|
|
2602
|
+
order,
|
|
2603
|
+
bounds: {
|
|
2604
|
+
minX: Math.min(...points.map((point) => point.x)) - strokeWidth,
|
|
2605
|
+
minY: Math.min(...points.map((point) => point.y)) - strokeWidth,
|
|
2606
|
+
maxX: Math.max(...points.map((point) => point.x)) + strokeWidth,
|
|
2607
|
+
maxY: Math.max(...points.map((point) => point.y)) + strokeWidth
|
|
2608
|
+
},
|
|
2609
|
+
d: pathData(segments),
|
|
2610
|
+
style: {
|
|
2611
|
+
fill: { kind: "none" },
|
|
2612
|
+
stroke: { kind: "solid", color: dimension.strokeColor ?? DEFAULT_COLOR },
|
|
2613
|
+
strokeWidth,
|
|
2614
|
+
lineCap: "round"
|
|
2615
|
+
}
|
|
2616
|
+
};
|
|
2617
|
+
}
|
|
2618
|
+
function labelNode2(dimension, order, text, center, angle) {
|
|
2619
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(dimension.fontSize, 11);
|
|
2620
|
+
const width = Math.max(24, text.length * fontSize * CHAR_WIDTH + 8);
|
|
2621
|
+
const height = fontSize * 1.3;
|
|
2622
|
+
return {
|
|
2623
|
+
type: "text",
|
|
2624
|
+
id: `dimension-${dimension.id}-label`,
|
|
2625
|
+
order,
|
|
2626
|
+
bounds: {
|
|
2627
|
+
minX: center.x - width / 2,
|
|
2628
|
+
minY: center.y - height / 2,
|
|
2629
|
+
maxX: center.x + width / 2,
|
|
2630
|
+
maxY: center.y + height / 2
|
|
2631
|
+
},
|
|
2632
|
+
x: center.x - width / 2,
|
|
2633
|
+
y: center.y - height / 2,
|
|
2634
|
+
width,
|
|
2635
|
+
height,
|
|
2636
|
+
lines: [text],
|
|
2637
|
+
fontFamily: chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
2638
|
+
fontSize,
|
|
2639
|
+
fontWeight: "normal",
|
|
2640
|
+
color: dimension.textColor ?? dimension.strokeColor ?? DEFAULT_COLOR,
|
|
2641
|
+
align: "center",
|
|
2642
|
+
verticalAlign: "middle",
|
|
2643
|
+
lineHeight: 1.2,
|
|
2644
|
+
rotation: angle,
|
|
2645
|
+
rotationCenter: center
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2648
|
+
function buildDimension(dimension, index) {
|
|
2649
|
+
const geometry = dimensionGeometry(dimension);
|
|
2650
|
+
const order = 31e3 + index;
|
|
2651
|
+
const line = {
|
|
2652
|
+
...pathNode(dimension, "line", order + 0.1, [geometry.line]),
|
|
2653
|
+
markerStart: "filled_arrow",
|
|
2654
|
+
markerEnd: "filled_arrow"
|
|
2655
|
+
};
|
|
2656
|
+
const extensions = geometry.extensions.length > 0 ? [pathNode(dimension, "extensions", order, geometry.extensions)] : [];
|
|
2657
|
+
const text = dimensionText(dimension);
|
|
2658
|
+
return [...extensions, line, labelNode2(dimension, order + 0.2, text, geometry.label.center, geometry.label.angle)];
|
|
2659
|
+
}
|
|
2660
|
+
function buildDimensions(dimensions) {
|
|
2661
|
+
return dimensions.flatMap(
|
|
2662
|
+
(dimension, index) => chunkKXYSO6GC_cjs.tag(
|
|
2663
|
+
buildDimension(dimension, index),
|
|
2664
|
+
"dimension",
|
|
2665
|
+
dimension.id,
|
|
2666
|
+
"dimension",
|
|
2667
|
+
dimensionText(dimension),
|
|
2668
|
+
dimension.parentFrameId
|
|
2669
|
+
)
|
|
2670
|
+
);
|
|
2061
2671
|
}
|
|
2062
2672
|
|
|
2063
|
-
// src/renderScene/artifacts/isometric.ts
|
|
2673
|
+
// src/renderScene/artifacts/isometric/context.ts
|
|
2674
|
+
var FILL_PROP = { prop: "style.fill", propKind: "color", propSolidOnly: true };
|
|
2064
2675
|
function isometricContext(object, index) {
|
|
2065
|
-
const strokeWidth = Math.max(0,
|
|
2066
|
-
const rotation =
|
|
2067
|
-
const box =
|
|
2676
|
+
const strokeWidth = Math.max(0, chunkKXYSO6GC_cjs.finite(object.strokeWidth, 1));
|
|
2677
|
+
const rotation = chunkKXYSO6GC_cjs.finite(object.rotation, 0);
|
|
2678
|
+
const box = chunkKXYSO6GC_cjs.isometricBounds(object);
|
|
2068
2679
|
const rotationCenter = { x: box.x + box.width / 2, y: box.y + box.height / 2 };
|
|
2069
2680
|
return {
|
|
2070
2681
|
object,
|
|
@@ -2076,7 +2687,7 @@ function isometricContext(object, index) {
|
|
|
2076
2687
|
strokeWidth,
|
|
2077
2688
|
common: {
|
|
2078
2689
|
type: "path",
|
|
2079
|
-
bounds:
|
|
2690
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(box, rotation, strokeWidth + 2),
|
|
2080
2691
|
rotation,
|
|
2081
2692
|
rotationCenter,
|
|
2082
2693
|
style: {
|
|
@@ -2087,82 +2698,19 @@ function isometricContext(object, index) {
|
|
|
2087
2698
|
}
|
|
2088
2699
|
};
|
|
2089
2700
|
}
|
|
2090
|
-
function
|
|
2091
|
-
const { object, index, rotation, rotationCenter } = context;
|
|
2092
|
-
if (!object.hasShadow) {
|
|
2093
|
-
return void 0;
|
|
2094
|
-
}
|
|
2095
|
-
const height = Math.max(0, object.height);
|
|
2096
|
-
const heightFactor = 0.6 + Math.min(1, height / 150) * 0.7;
|
|
2097
|
-
const shadowDrop = height + chunkXY2GZUHC_cjs.finite(object.shadowStyle?.distance, 0);
|
|
2098
|
-
const contactFootprint = faces.top.map((point) => ({ x: point.x, y: point.y + shadowDrop }));
|
|
2099
|
-
const footprintCenter = {
|
|
2100
|
-
x: contactFootprint.reduce((sum, point) => sum + point.x, 0) / contactFootprint.length,
|
|
2101
|
-
y: contactFootprint.reduce((sum, point) => sum + point.y, 0) / contactFootprint.length
|
|
2102
|
-
};
|
|
2103
|
-
const shadowSpread = 1.3;
|
|
2104
|
-
const footprint = contactFootprint.map((point) => ({
|
|
2105
|
-
x: footprintCenter.x + (point.x - footprintCenter.x) * shadowSpread,
|
|
2106
|
-
y: footprintCenter.y + (point.y - footprintCenter.y) * shadowSpread
|
|
2107
|
-
}));
|
|
2108
|
-
const footprintXs = footprint.map((point) => point.x);
|
|
2109
|
-
const footprintYs = footprint.map((point) => point.y);
|
|
2701
|
+
function faceNode(context, name, offset, points, style) {
|
|
2110
2702
|
return {
|
|
2111
|
-
|
|
2112
|
-
id: `isometric-${object.id}
|
|
2113
|
-
order:
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
maxX: Math.max(...footprintXs),
|
|
2118
|
-
maxY: Math.max(...footprintYs)
|
|
2119
|
-
},
|
|
2120
|
-
d: chunkXY2GZUHC_cjs.roundedPolygonPath(footprint, 0),
|
|
2121
|
-
rotation,
|
|
2122
|
-
rotationCenter,
|
|
2123
|
-
style: {
|
|
2124
|
-
fill: { kind: "solid", color: object.shadowStyle?.color ?? "#000000" },
|
|
2125
|
-
stroke: { kind: "none" },
|
|
2126
|
-
opacity: Math.min(1, (object.shadowStyle?.opacity ?? 0.18) * heightFactor),
|
|
2127
|
-
blur: chunkXY2GZUHC_cjs.finite(object.shadowStyle?.blur, 8),
|
|
2128
|
-
pointerEvents: "none"
|
|
2129
|
-
}
|
|
2703
|
+
...context.common,
|
|
2704
|
+
id: `isometric-${context.object.id}-${name}`,
|
|
2705
|
+
order: context.order + offset,
|
|
2706
|
+
d: chunkKXYSO6GC_cjs.roundedPolygonPath([...points], 0),
|
|
2707
|
+
style,
|
|
2708
|
+
...FILL_PROP
|
|
2130
2709
|
};
|
|
2131
2710
|
}
|
|
2132
|
-
function
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
const faceFills = chunkXY2GZUHC_cjs.deriveFaceFills(object.fill ?? "#f8fafc");
|
|
2136
|
-
const colorProp = { prop: "style.fill", propKind: "color", propSolidOnly: true };
|
|
2137
|
-
const face = (name, offset, points, color) => ({
|
|
2138
|
-
...common,
|
|
2139
|
-
id: `isometric-${object.id}-${name}`,
|
|
2140
|
-
order: order + offset,
|
|
2141
|
-
d: chunkXY2GZUHC_cjs.roundedPolygonPath(points, 0),
|
|
2142
|
-
style: { ...noStroke, fill: { kind: "solid", color }, clip: hullClip },
|
|
2143
|
-
...colorProp
|
|
2144
|
-
});
|
|
2145
|
-
return [
|
|
2146
|
-
face("top", 0, faces.top, faceFills.topFill),
|
|
2147
|
-
face("front", 0.1, faces.front, faceFills.frontFill),
|
|
2148
|
-
face("side", 0.2, faces.right, faceFills.sideFill)
|
|
2149
|
-
];
|
|
2150
|
-
}
|
|
2151
|
-
function seamsNode(context, faces, hullClip) {
|
|
2152
|
-
const { object, order, common, strokeWidth } = context;
|
|
2153
|
-
return {
|
|
2154
|
-
...common,
|
|
2155
|
-
id: `isometric-${object.id}-seams`,
|
|
2156
|
-
order: order + 0.22,
|
|
2157
|
-
d: `M ${faces.top[3].x} ${faces.top[3].y} L ${faces.top[2].x} ${faces.top[2].y} L ${faces.top[1].x} ${faces.top[1].y} M ${faces.top[2].x} ${faces.top[2].y} L ${faces.front[2].x} ${faces.front[2].y}`,
|
|
2158
|
-
style: {
|
|
2159
|
-
...common.style,
|
|
2160
|
-
fill: { kind: "none" },
|
|
2161
|
-
stroke: { kind: "solid", color: "#cbd5e1" },
|
|
2162
|
-
strokeWidth: Math.min(strokeWidth, 1),
|
|
2163
|
-
clip: hullClip
|
|
2164
|
-
}
|
|
2165
|
-
};
|
|
2711
|
+
function silhouette(object) {
|
|
2712
|
+
const faces = chunkKXYSO6GC_cjs.isometricFaces(object);
|
|
2713
|
+
return [faces.top[0], faces.top[1], faces.right[2], faces.front[2], faces.front[3], faces.top[3]];
|
|
2166
2714
|
}
|
|
2167
2715
|
function hullNode(context, hullPath, cornerRadius) {
|
|
2168
2716
|
const { object, order, common, box } = context;
|
|
@@ -2178,12 +2726,20 @@ function hullNode(context, hullPath, cornerRadius) {
|
|
|
2178
2726
|
depth: Math.max(0, object.depth),
|
|
2179
2727
|
cornerRadius,
|
|
2180
2728
|
bounds: box,
|
|
2181
|
-
labelOffsetX:
|
|
2182
|
-
labelOffsetY:
|
|
2729
|
+
labelOffsetX: chunkKXYSO6GC_cjs.finite(object.labelOffsetX, 0),
|
|
2730
|
+
labelOffsetY: chunkKXYSO6GC_cjs.finite(object.labelOffsetY, 0)
|
|
2183
2731
|
},
|
|
2184
2732
|
style: { ...common.style, fill: { kind: "none" } }
|
|
2185
2733
|
};
|
|
2186
2734
|
}
|
|
2735
|
+
function unseenHullNode(context) {
|
|
2736
|
+
return {
|
|
2737
|
+
...hullNode(context, chunkKXYSO6GC_cjs.roundedPolygonPath(silhouette(context.object), 0), 0),
|
|
2738
|
+
style: { ...context.common.style, fill: { kind: "none" }, stroke: { kind: "none" } }
|
|
2739
|
+
};
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
// src/renderScene/artifacts/isometric/label.ts
|
|
2187
2743
|
var LABEL_HEIGHT = 20;
|
|
2188
2744
|
var LABEL_GAP = 12;
|
|
2189
2745
|
var LABEL_PADDING_X = 6;
|
|
@@ -2191,9 +2747,9 @@ var LABEL_PADDING_Y = 3;
|
|
|
2191
2747
|
var LABEL_CHAR_WIDTH = 6.5;
|
|
2192
2748
|
function labelPlacement(context) {
|
|
2193
2749
|
const { object } = context;
|
|
2194
|
-
const anchor =
|
|
2195
|
-
const bottomY = anchor.y - LABEL_GAP +
|
|
2196
|
-
return { anchor, centerX: anchor.x +
|
|
2750
|
+
const anchor = chunkKXYSO6GC_cjs.isometricTopFaceCenter(object);
|
|
2751
|
+
const bottomY = anchor.y - LABEL_GAP + chunkKXYSO6GC_cjs.finite(object.labelOffsetY, 0);
|
|
2752
|
+
return { anchor, centerX: anchor.x + chunkKXYSO6GC_cjs.finite(object.labelOffsetX, 0), topY: bottomY - LABEL_HEIGHT, bottomY };
|
|
2197
2753
|
}
|
|
2198
2754
|
function labelTextNode(context, placement, text) {
|
|
2199
2755
|
const { object, order, rotation, rotationCenter, box } = context;
|
|
@@ -2208,7 +2764,7 @@ function labelTextNode(context, placement, text) {
|
|
|
2208
2764
|
width: box.width,
|
|
2209
2765
|
height: LABEL_HEIGHT,
|
|
2210
2766
|
lines: [text],
|
|
2211
|
-
fontFamily:
|
|
2767
|
+
fontFamily: chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
2212
2768
|
fontSize: 12,
|
|
2213
2769
|
fontWeight: "normal",
|
|
2214
2770
|
color: "#111827",
|
|
@@ -2279,23 +2835,235 @@ function labelNodes(context, text) {
|
|
|
2279
2835
|
}
|
|
2280
2836
|
return [guide, labelBackgroundNode(context, placement, text, background), label];
|
|
2281
2837
|
}
|
|
2282
|
-
|
|
2838
|
+
|
|
2839
|
+
// src/renderScene/artifacts/isometric/shadow.ts
|
|
2840
|
+
function groundShadowNode(context, topOutline) {
|
|
2841
|
+
const { object, index, rotation, rotationCenter } = context;
|
|
2842
|
+
if (!object.hasShadow) {
|
|
2843
|
+
return void 0;
|
|
2844
|
+
}
|
|
2845
|
+
const height = Math.max(0, object.height);
|
|
2846
|
+
const heightFactor = 0.6 + Math.min(1, height / 150) * 0.7;
|
|
2847
|
+
const shadowDrop = height + chunkKXYSO6GC_cjs.finite(object.shadowStyle?.distance, 0);
|
|
2848
|
+
const contactFootprint = topOutline.map((point) => ({ x: point.x, y: point.y + shadowDrop }));
|
|
2849
|
+
const footprintCenter = {
|
|
2850
|
+
x: contactFootprint.reduce((sum, point) => sum + point.x, 0) / contactFootprint.length,
|
|
2851
|
+
y: contactFootprint.reduce((sum, point) => sum + point.y, 0) / contactFootprint.length
|
|
2852
|
+
};
|
|
2853
|
+
const shadowSpread = 1.3;
|
|
2854
|
+
const footprint = contactFootprint.map((point) => ({
|
|
2855
|
+
x: footprintCenter.x + (point.x - footprintCenter.x) * shadowSpread,
|
|
2856
|
+
y: footprintCenter.y + (point.y - footprintCenter.y) * shadowSpread
|
|
2857
|
+
}));
|
|
2858
|
+
const footprintXs = footprint.map((point) => point.x);
|
|
2859
|
+
const footprintYs = footprint.map((point) => point.y);
|
|
2860
|
+
return {
|
|
2861
|
+
type: "path",
|
|
2862
|
+
id: `isometric-${object.id}-ground-shadow`,
|
|
2863
|
+
order: 14e3 + index,
|
|
2864
|
+
bounds: {
|
|
2865
|
+
minX: Math.min(...footprintXs),
|
|
2866
|
+
minY: Math.min(...footprintYs),
|
|
2867
|
+
maxX: Math.max(...footprintXs),
|
|
2868
|
+
maxY: Math.max(...footprintYs)
|
|
2869
|
+
},
|
|
2870
|
+
d: chunkKXYSO6GC_cjs.roundedPolygonPath(footprint, 0),
|
|
2871
|
+
rotation,
|
|
2872
|
+
rotationCenter,
|
|
2873
|
+
style: {
|
|
2874
|
+
fill: { kind: "solid", color: object.shadowStyle?.color ?? "#000000" },
|
|
2875
|
+
stroke: { kind: "none" },
|
|
2876
|
+
opacity: Math.min(1, (object.shadowStyle?.opacity ?? 0.18) * heightFactor),
|
|
2877
|
+
blur: chunkKXYSO6GC_cjs.finite(object.shadowStyle?.blur, 8),
|
|
2878
|
+
pointerEvents: "none"
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
function sphereShadowNode(context, radius) {
|
|
2883
|
+
const { object, index, box } = context;
|
|
2884
|
+
if (!object.hasShadow) {
|
|
2885
|
+
return void 0;
|
|
2886
|
+
}
|
|
2887
|
+
const width = Math.max(0, object.width);
|
|
2888
|
+
const depth = Math.max(0, object.depth);
|
|
2889
|
+
const center = {
|
|
2890
|
+
x: box.x + box.width / 2,
|
|
2891
|
+
y: object.y + Math.max(0, object.height) + (width + depth) * chunkKXYSO6GC_cjs.AXIS_SIN / 2
|
|
2892
|
+
};
|
|
2893
|
+
return {
|
|
2894
|
+
type: "ellipse",
|
|
2895
|
+
id: `isometric-${object.id}-ground-shadow`,
|
|
2896
|
+
order: 14e3 + index,
|
|
2897
|
+
bounds: {
|
|
2898
|
+
minX: center.x - radius * 1.1,
|
|
2899
|
+
minY: center.y - radius * 0.6,
|
|
2900
|
+
maxX: center.x + radius * 1.1,
|
|
2901
|
+
maxY: center.y + radius * 0.6
|
|
2902
|
+
},
|
|
2903
|
+
cx: center.x,
|
|
2904
|
+
cy: center.y,
|
|
2905
|
+
rx: radius * 1.05,
|
|
2906
|
+
ry: radius * 0.52,
|
|
2907
|
+
style: {
|
|
2908
|
+
fill: { kind: "solid", color: object.shadowStyle?.color ?? "#000000" },
|
|
2909
|
+
stroke: { kind: "none" },
|
|
2910
|
+
opacity: object.shadowStyle?.opacity ?? 0.2,
|
|
2911
|
+
blur: chunkKXYSO6GC_cjs.finite(object.shadowStyle?.blur, 8),
|
|
2912
|
+
pointerEvents: "none"
|
|
2913
|
+
}
|
|
2914
|
+
};
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
// src/renderScene/artifacts/isometric/box.ts
|
|
2918
|
+
function faceNodes(context, faces, hullClip) {
|
|
2919
|
+
const { object, common } = context;
|
|
2920
|
+
const noStroke = { ...common.style, stroke: { kind: "none" } };
|
|
2921
|
+
const fills = chunkKXYSO6GC_cjs.deriveFaceFills(object.fill ?? "#f8fafc");
|
|
2922
|
+
const face = (name, offset, points, color) => faceNode(context, name, offset, points, { ...noStroke, fill: { kind: "solid", color }, clip: hullClip });
|
|
2923
|
+
return [
|
|
2924
|
+
face("top", 0, faces.top, fills.topFill),
|
|
2925
|
+
face("front", 0.1, faces.front, fills.frontFill),
|
|
2926
|
+
face("side", 0.2, faces.right, fills.sideFill)
|
|
2927
|
+
];
|
|
2928
|
+
}
|
|
2929
|
+
function seamsNode(context, faces, hullClip) {
|
|
2930
|
+
const { object, order, common, strokeWidth } = context;
|
|
2931
|
+
return {
|
|
2932
|
+
...common,
|
|
2933
|
+
id: `isometric-${object.id}-seams`,
|
|
2934
|
+
order: order + 0.22,
|
|
2935
|
+
d: `M ${faces.top[3].x} ${faces.top[3].y} L ${faces.top[2].x} ${faces.top[2].y} L ${faces.top[1].x} ${faces.top[1].y} M ${faces.top[2].x} ${faces.top[2].y} L ${faces.front[2].x} ${faces.front[2].y}`,
|
|
2936
|
+
style: {
|
|
2937
|
+
...common.style,
|
|
2938
|
+
fill: { kind: "none" },
|
|
2939
|
+
stroke: { kind: "solid", color: "#cbd5e1" },
|
|
2940
|
+
strokeWidth: Math.min(strokeWidth, 1),
|
|
2941
|
+
clip: hullClip
|
|
2942
|
+
}
|
|
2943
|
+
};
|
|
2944
|
+
}
|
|
2945
|
+
function buildBox(object, index) {
|
|
2283
2946
|
const context = isometricContext(object, index);
|
|
2284
|
-
const faces =
|
|
2285
|
-
const cornerRadius = Math.max(0,
|
|
2286
|
-
const
|
|
2287
|
-
const hullPath = chunkXY2GZUHC_cjs.roundedPolygonPath(silhouette, cornerRadius);
|
|
2947
|
+
const faces = chunkKXYSO6GC_cjs.isometricFaces(object);
|
|
2948
|
+
const cornerRadius = Math.max(0, chunkKXYSO6GC_cjs.finite(object.cornerRadius, 8));
|
|
2949
|
+
const hullPath = chunkKXYSO6GC_cjs.roundedPolygonPath(silhouette(object), cornerRadius);
|
|
2288
2950
|
const hullClip = { type: "path", d: hullPath };
|
|
2289
|
-
const groundShadow = groundShadowNode(context, faces);
|
|
2951
|
+
const groundShadow = groundShadowNode(context, faces.top);
|
|
2290
2952
|
const seams = seamsNode(context, faces, hullClip);
|
|
2291
2953
|
const hull = hullNode(context, hullPath, cornerRadius);
|
|
2292
2954
|
const facesNodes = faceNodes(context, faces, hullClip);
|
|
2293
2955
|
const objectNodes = groundShadow ? [hull, ...facesNodes, groundShadow, seams] : [hull, ...facesNodes, seams];
|
|
2294
2956
|
return object.text ? [...objectNodes, ...labelNodes(context, object.text)] : objectNodes;
|
|
2295
2957
|
}
|
|
2958
|
+
|
|
2959
|
+
// src/renderScene/artifacts/isometric/extruded.ts
|
|
2960
|
+
function wallNode(context, side, index, fill2) {
|
|
2961
|
+
const color = chunkKXYSO6GC_cjs.shadeFill(fill2, side.light);
|
|
2962
|
+
return faceNode(context, `side-${index}`, 0.05 + index * 1e-3, side.points, {
|
|
2963
|
+
...context.common.style,
|
|
2964
|
+
stroke: { kind: "solid", color },
|
|
2965
|
+
strokeWidth: 0.6,
|
|
2966
|
+
fill: { kind: "solid", color }
|
|
2967
|
+
});
|
|
2968
|
+
}
|
|
2969
|
+
function wallEdgesNode(context, side, index) {
|
|
2970
|
+
const [topFrom, topTo, bottomTo, bottomFrom] = side.points;
|
|
2971
|
+
const lines = [
|
|
2972
|
+
`M ${bottomFrom.x} ${bottomFrom.y} L ${bottomTo.x} ${bottomTo.y}`,
|
|
2973
|
+
...side.smoothStart ? [] : [`M ${topFrom.x} ${topFrom.y} L ${bottomFrom.x} ${bottomFrom.y}`],
|
|
2974
|
+
...side.smoothEnd ? [] : [`M ${topTo.x} ${topTo.y} L ${bottomTo.x} ${bottomTo.y}`]
|
|
2975
|
+
];
|
|
2976
|
+
return {
|
|
2977
|
+
...context.common,
|
|
2978
|
+
id: `isometric-${context.object.id}-side-${index}-edges`,
|
|
2979
|
+
order: context.order + 0.0505 + index * 1e-3,
|
|
2980
|
+
d: lines.join(" "),
|
|
2981
|
+
style: { ...context.common.style, fill: { kind: "none" } }
|
|
2982
|
+
};
|
|
2983
|
+
}
|
|
2984
|
+
function buildExtruded(object, index, footprint) {
|
|
2985
|
+
const context = isometricContext(object, index);
|
|
2986
|
+
const { top, sides } = chunkKXYSO6GC_cjs.extrudeFootprint(object, footprint, Math.max(0, chunkKXYSO6GC_cjs.finite(object.cornerRadius, 0)));
|
|
2987
|
+
const fill2 = object.fill ?? "#f8fafc";
|
|
2988
|
+
const groundShadow = groundShadowNode(context, top);
|
|
2989
|
+
const topFace = faceNode(context, "top", 0.2, top, { ...context.common.style, fill: { kind: "solid", color: fill2 } });
|
|
2990
|
+
const nodes = [
|
|
2991
|
+
unseenHullNode(context),
|
|
2992
|
+
...groundShadow ? [groundShadow] : [],
|
|
2993
|
+
...sides.flatMap((side, i) => [wallNode(context, side, i, fill2), wallEdgesNode(context, side, i)]),
|
|
2994
|
+
topFace
|
|
2995
|
+
];
|
|
2996
|
+
return object.text ? [...nodes, ...labelNodes(context, object.text)] : nodes;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
// src/renderScene/artifacts/isometric/sphere.ts
|
|
3000
|
+
function buildSphere(object, index) {
|
|
3001
|
+
const context = isometricContext(object, index);
|
|
3002
|
+
const { order, common, box } = context;
|
|
3003
|
+
const radius = Math.max(0, Math.min(object.width, object.height, object.depth)) / 2;
|
|
3004
|
+
const cx = box.x + box.width / 2;
|
|
3005
|
+
const cy = box.y + box.height / 2;
|
|
3006
|
+
const fill2 = object.fill ?? "#f8fafc";
|
|
3007
|
+
const bounds = { minX: cx - radius, minY: cy - radius, maxX: cx + radius, maxY: cy + radius };
|
|
3008
|
+
const body = {
|
|
3009
|
+
type: "ellipse",
|
|
3010
|
+
id: `isometric-${object.id}-sphere`,
|
|
3011
|
+
order: order + 0.1,
|
|
3012
|
+
bounds,
|
|
3013
|
+
cx,
|
|
3014
|
+
cy,
|
|
3015
|
+
rx: radius,
|
|
3016
|
+
ry: radius,
|
|
3017
|
+
style: {
|
|
3018
|
+
...common.style,
|
|
3019
|
+
fill: {
|
|
3020
|
+
kind: "linear-gradient",
|
|
3021
|
+
angle: 135,
|
|
3022
|
+
stops: [
|
|
3023
|
+
{ offset: 0, color: chunkKXYSO6GC_cjs.shadeFill(fill2, 1.22) },
|
|
3024
|
+
{ offset: 0.5, color: fill2 },
|
|
3025
|
+
{ offset: 1, color: chunkKXYSO6GC_cjs.shadeFill(fill2, 0.82) }
|
|
3026
|
+
]
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
prop: "style.fill",
|
|
3030
|
+
propKind: "color",
|
|
3031
|
+
propSolidOnly: true
|
|
3032
|
+
};
|
|
3033
|
+
const highlight = {
|
|
3034
|
+
type: "ellipse",
|
|
3035
|
+
id: `isometric-${object.id}-highlight`,
|
|
3036
|
+
order: order + 0.2,
|
|
3037
|
+
bounds,
|
|
3038
|
+
cx: cx - radius * 0.32,
|
|
3039
|
+
cy: cy - radius * 0.38,
|
|
3040
|
+
rx: radius * 0.26,
|
|
3041
|
+
ry: radius * 0.18,
|
|
3042
|
+
rotation: -35,
|
|
3043
|
+
style: {
|
|
3044
|
+
fill: { kind: "solid", color: "#ffffff" },
|
|
3045
|
+
stroke: { kind: "none" },
|
|
3046
|
+
opacity: 0.45,
|
|
3047
|
+
blur: radius * 0.1,
|
|
3048
|
+
pointerEvents: "none"
|
|
3049
|
+
}
|
|
3050
|
+
};
|
|
3051
|
+
const shadow = sphereShadowNode(context, radius);
|
|
3052
|
+
const nodes = [unseenHullNode(context), ...shadow ? [shadow] : [], body, highlight];
|
|
3053
|
+
return object.text ? [...nodes, ...labelNodes(context, object.text)] : nodes;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
// src/renderScene/artifacts/isometric/index.ts
|
|
3057
|
+
function buildIsometricObject(object, index) {
|
|
3058
|
+
if (object.form === "sphere") {
|
|
3059
|
+
return buildSphere(object, index);
|
|
3060
|
+
}
|
|
3061
|
+
const footprint = chunkKXYSO6GC_cjs.cleanFootprint(object.footprint);
|
|
3062
|
+
return footprint.length > 0 ? buildExtruded(object, index, footprint) : buildBox(object, index);
|
|
3063
|
+
}
|
|
2296
3064
|
function buildIsometricObjects(objects) {
|
|
2297
3065
|
return objects.flatMap(
|
|
2298
|
-
(object, index) =>
|
|
3066
|
+
(object, index) => chunkKXYSO6GC_cjs.tag(
|
|
2299
3067
|
buildIsometricObject(object, index),
|
|
2300
3068
|
"isometric",
|
|
2301
3069
|
object.id,
|
|
@@ -2324,7 +3092,7 @@ function renderEndpointLabel(context, end, labelIndex) {
|
|
|
2324
3092
|
if (!label) {
|
|
2325
3093
|
return [];
|
|
2326
3094
|
}
|
|
2327
|
-
const fontSize =
|
|
3095
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(context.link.style?.fontSize, 10);
|
|
2328
3096
|
const position = endpointLabelPosition(context.points, end);
|
|
2329
3097
|
const width = 90;
|
|
2330
3098
|
return [
|
|
@@ -2338,7 +3106,7 @@ function renderEndpointLabel(context, end, labelIndex) {
|
|
|
2338
3106
|
width,
|
|
2339
3107
|
height: fontSize * 2,
|
|
2340
3108
|
lines: [label],
|
|
2341
|
-
fontFamily: context.link.style?.fontFamily ??
|
|
3109
|
+
fontFamily: context.link.style?.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
2342
3110
|
fontSize,
|
|
2343
3111
|
fontWeight: "normal",
|
|
2344
3112
|
color: context.color,
|
|
@@ -2368,7 +3136,7 @@ function renderMainLabel(context) {
|
|
|
2368
3136
|
width: context.label.width,
|
|
2369
3137
|
height: context.label.fontSize * 2,
|
|
2370
3138
|
lines: context.label.lines,
|
|
2371
|
-
fontFamily: context.link.style?.fontFamily ??
|
|
3139
|
+
fontFamily: context.link.style?.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
2372
3140
|
fontSize: context.label.fontSize,
|
|
2373
3141
|
fontWeight: "normal",
|
|
2374
3142
|
color: context.color,
|
|
@@ -2422,10 +3190,10 @@ function linkBounds(points, padding) {
|
|
|
2422
3190
|
}
|
|
2423
3191
|
function labelLayout(link, measureText) {
|
|
2424
3192
|
const visible = Boolean(link.showText && link.text);
|
|
2425
|
-
const fontSize =
|
|
3193
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(link.style?.fontSize, 10);
|
|
2426
3194
|
const width = Math.min(250, Math.max(fontSize * 2, (link.text?.length ?? 0) * fontSize * 0.65 + 10));
|
|
2427
|
-
const metrics = measureText?.(link.style?.fontFamily ??
|
|
2428
|
-
const lines = visible ?
|
|
3195
|
+
const metrics = measureText?.(link.style?.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT, fontSize);
|
|
3196
|
+
const lines = visible ? chunkKXYSO6GC_cjs.wrapText(link.text ?? "", width, fontSize, metrics) : [];
|
|
2429
3197
|
return { visible, fontSize, width, height: lines.length * fontSize * 1.4, lines };
|
|
2430
3198
|
}
|
|
2431
3199
|
function linkStyle(item, strokeWidth, color, dash) {
|
|
@@ -2442,26 +3210,26 @@ function linkStyle(item, strokeWidth, color, dash) {
|
|
|
2442
3210
|
dash,
|
|
2443
3211
|
lineCap: "round",
|
|
2444
3212
|
lineJoin: "round",
|
|
2445
|
-
opacity:
|
|
3213
|
+
opacity: chunkKXYSO6GC_cjs.finite(link.style?.opacity, 1),
|
|
2446
3214
|
shadow: resolveShadow(link.style?.shadow)
|
|
2447
3215
|
};
|
|
2448
3216
|
}
|
|
2449
3217
|
function createLinkRenderContext(item, index, measureText) {
|
|
2450
3218
|
const { link, from, to } = item;
|
|
2451
3219
|
const pathType = link.style?.pathType ?? "orthogonal";
|
|
2452
|
-
const { points, segments } =
|
|
2453
|
-
const strokeWidth =
|
|
3220
|
+
const { points, segments } = chunkKXYSO6GC_cjs.calculateLinkRoute(link, from, to, pathType);
|
|
3221
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(link.style?.strokeWidth, 2);
|
|
2454
3222
|
const color = getLinkStrokeColor(link.style?.color) || "#64748b";
|
|
2455
3223
|
const label = labelLayout(link, measureText);
|
|
2456
3224
|
const contentDash = getDashArray(strokeWidth, link.style?.strokeStyle ?? "solid");
|
|
2457
|
-
const gap = label.visible && !contentDash ?
|
|
3225
|
+
const gap = label.visible && !contentDash ? chunkKXYSO6GC_cjs.labelGapDash(points, pathType, label.width, label.height) : null;
|
|
2458
3226
|
const dash = gap ? [gap.dashBefore, gap.gapLength, 1e6] : contentDash;
|
|
2459
3227
|
return {
|
|
2460
3228
|
link,
|
|
2461
3229
|
pathType,
|
|
2462
3230
|
points,
|
|
2463
3231
|
segments,
|
|
2464
|
-
midpoint:
|
|
3232
|
+
midpoint: chunkKXYSO6GC_cjs.getLineMidpoint(points, pathType, from, to),
|
|
2465
3233
|
strokeWidth,
|
|
2466
3234
|
bounds: linkBounds(points, strokeWidth + 14),
|
|
2467
3235
|
color,
|
|
@@ -2499,7 +3267,7 @@ function polylinePathData(points) {
|
|
|
2499
3267
|
}
|
|
2500
3268
|
return path;
|
|
2501
3269
|
}
|
|
2502
|
-
function
|
|
3270
|
+
function pathData2(points, pathType, segments, strokeWidth) {
|
|
2503
3271
|
if (points.length < 4) {
|
|
2504
3272
|
return "";
|
|
2505
3273
|
}
|
|
@@ -2507,7 +3275,7 @@ function pathData(points, pathType, segments, strokeWidth) {
|
|
|
2507
3275
|
return `M ${points[0]} ${points[1]} C ${points[2]} ${points[3]} ${points[4]} ${points[5]} ${points[6]} ${points[7]}`;
|
|
2508
3276
|
}
|
|
2509
3277
|
if (pathType === "orthogonal" && segments.length > 0) {
|
|
2510
|
-
return
|
|
3278
|
+
return chunkKXYSO6GC_cjs.roundedOrthogonalPathData(segments, Math.max(16, strokeWidth * 4));
|
|
2511
3279
|
}
|
|
2512
3280
|
return polylinePathData(points);
|
|
2513
3281
|
}
|
|
@@ -2533,7 +3301,7 @@ function renderLinkPath(context) {
|
|
|
2533
3301
|
id: `link-${link.id}`,
|
|
2534
3302
|
order: context.order,
|
|
2535
3303
|
bounds: context.bounds,
|
|
2536
|
-
d:
|
|
3304
|
+
d: pathData2(context.points, context.pathType, context.segments, context.strokeWidth),
|
|
2537
3305
|
style: context.style,
|
|
2538
3306
|
markerStart: markerForEnd(link, "start"),
|
|
2539
3307
|
markerEnd: markerForEnd(link, "end"),
|
|
@@ -2611,7 +3379,7 @@ function buildLink(item, index, measureText) {
|
|
|
2611
3379
|
}
|
|
2612
3380
|
function buildLinks(links, measureText) {
|
|
2613
3381
|
return links.flatMap(
|
|
2614
|
-
(item, index) =>
|
|
3382
|
+
(item, index) => chunkKXYSO6GC_cjs.tag(
|
|
2615
3383
|
buildLink(item, index, measureText),
|
|
2616
3384
|
"link",
|
|
2617
3385
|
item.link.id,
|
|
@@ -2626,7 +3394,7 @@ function buildFreeformPath(path, index) {
|
|
|
2626
3394
|
if (path.isVisible === false || path.points.length < 2) {
|
|
2627
3395
|
return [];
|
|
2628
3396
|
}
|
|
2629
|
-
const strokeWidth =
|
|
3397
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(path.strokeWidth, 2);
|
|
2630
3398
|
const extra = strokeWidth + 12;
|
|
2631
3399
|
const bounds = {
|
|
2632
3400
|
minX: Math.min(...path.points.map((point) => point.x)) - extra,
|
|
@@ -2634,7 +3402,7 @@ function buildFreeformPath(path, index) {
|
|
|
2634
3402
|
maxX: Math.max(...path.points.map((point) => point.x)) + extra,
|
|
2635
3403
|
maxY: Math.max(...path.points.map((point) => point.y)) + extra
|
|
2636
3404
|
};
|
|
2637
|
-
const tension =
|
|
3405
|
+
const tension = chunkKXYSO6GC_cjs.finite(path.tension, 0);
|
|
2638
3406
|
const closed = path.closed === true;
|
|
2639
3407
|
return [
|
|
2640
3408
|
{
|
|
@@ -2642,7 +3410,7 @@ function buildFreeformPath(path, index) {
|
|
|
2642
3410
|
id: `path-${path.id}`,
|
|
2643
3411
|
order: 3e4 + index,
|
|
2644
3412
|
bounds,
|
|
2645
|
-
d:
|
|
3413
|
+
d: chunkKXYSO6GC_cjs.freeformPathData({ points: path.points, tension, closed }),
|
|
2646
3414
|
markerStart: path.startMarker,
|
|
2647
3415
|
markerEnd: path.endMarker,
|
|
2648
3416
|
detail: {
|
|
@@ -2658,13 +3426,13 @@ function buildFreeformPath(path, index) {
|
|
|
2658
3426
|
dash: path.dash?.length ? path.dash : void 0,
|
|
2659
3427
|
lineCap: "round",
|
|
2660
3428
|
lineJoin: "round",
|
|
2661
|
-
opacity:
|
|
3429
|
+
opacity: chunkKXYSO6GC_cjs.finite(path.opacity, 1)
|
|
2662
3430
|
}
|
|
2663
3431
|
}
|
|
2664
3432
|
];
|
|
2665
3433
|
}
|
|
2666
3434
|
function buildFreeformPaths(paths) {
|
|
2667
|
-
return paths.flatMap((path, index) =>
|
|
3435
|
+
return paths.flatMap((path, index) => chunkKXYSO6GC_cjs.tag(buildFreeformPath(path, index), "path", path.id, "path", "Path"));
|
|
2668
3436
|
}
|
|
2669
3437
|
|
|
2670
3438
|
// src/renderScene/artifacts/shape/geometry/base.ts
|
|
@@ -2680,7 +3448,7 @@ function shapeNodeBase(context) {
|
|
|
2680
3448
|
|
|
2681
3449
|
// src/renderScene/artifacts/shape/geometry/simple.ts
|
|
2682
3450
|
function renderPath(context) {
|
|
2683
|
-
const path =
|
|
3451
|
+
const path = chunkKXYSO6GC_cjs.localShapePath(context.shape.shapeType, context.x, context.y, context.width, context.height);
|
|
2684
3452
|
if (!path) {
|
|
2685
3453
|
return [];
|
|
2686
3454
|
}
|
|
@@ -2696,7 +3464,7 @@ function renderBoundedPath(context) {
|
|
|
2696
3464
|
}));
|
|
2697
3465
|
}
|
|
2698
3466
|
function renderRectangle(context) {
|
|
2699
|
-
const rx = context.shape.shapeType === "pill" ?
|
|
3467
|
+
const rx = context.shape.shapeType === "pill" ? chunkKXYSO6GC_cjs.pillCornerRadius(context.width, context.height) : context.shape.shapeType === "rounded_rectangle" ? chunkKXYSO6GC_cjs.finite(context.shape.cornerRadius, 8) : 0;
|
|
2700
3468
|
return [
|
|
2701
3469
|
{
|
|
2702
3470
|
...shapeNodeBase(context),
|
|
@@ -2725,7 +3493,7 @@ function renderSymbol(context) {
|
|
|
2725
3493
|
if (!context.shape.symbol || context.shape.symbol.points.length < 2) {
|
|
2726
3494
|
return renderRectangle(context);
|
|
2727
3495
|
}
|
|
2728
|
-
const tension =
|
|
3496
|
+
const tension = chunkKXYSO6GC_cjs.finite(context.shape.symbol.tension, 0);
|
|
2729
3497
|
const points = context.shape.symbol.points.map(([x, y]) => ({
|
|
2730
3498
|
x: context.x + x * context.width,
|
|
2731
3499
|
y: context.y + y * context.height
|
|
@@ -2734,7 +3502,7 @@ function renderSymbol(context) {
|
|
|
2734
3502
|
{
|
|
2735
3503
|
...shapeNodeBase(context),
|
|
2736
3504
|
type: "path",
|
|
2737
|
-
d:
|
|
3505
|
+
d: chunkKXYSO6GC_cjs.freeformPathData({ points, tension, closed: true }),
|
|
2738
3506
|
rotationCenter: context.rotationCenter,
|
|
2739
3507
|
detail: {
|
|
2740
3508
|
of: "symbolGeometry",
|
|
@@ -2771,6 +3539,46 @@ function renderShapeGeometry(context) {
|
|
|
2771
3539
|
return renderer(context);
|
|
2772
3540
|
}
|
|
2773
3541
|
|
|
3542
|
+
// src/renderScene/artifacts/shape/shaderSurface.ts
|
|
3543
|
+
var RECT_PROGRAMS = /* @__PURE__ */ new Set(["reactivePanel", "ledMatrix", "lightBand", "silkFolds"]);
|
|
3544
|
+
function shaderMask(context) {
|
|
3545
|
+
if (context.shape.shapeType === "circle" || context.shape.shapeType === "oval") {
|
|
3546
|
+
return "ellipse";
|
|
3547
|
+
}
|
|
3548
|
+
const rectangular = context.shape.shapeType === "rectangle" || context.shape.shapeType === "rounded_rectangle";
|
|
3549
|
+
if (rectangular && context.shape.shader && RECT_PROGRAMS.has(context.shape.shader.program)) {
|
|
3550
|
+
return "rect";
|
|
3551
|
+
}
|
|
3552
|
+
return void 0;
|
|
3553
|
+
}
|
|
3554
|
+
function renderShapeShaderSurface(context) {
|
|
3555
|
+
if (!context.shape.shader) {
|
|
3556
|
+
return void 0;
|
|
3557
|
+
}
|
|
3558
|
+
const mask = shaderMask(context);
|
|
3559
|
+
if (!mask) {
|
|
3560
|
+
return void 0;
|
|
3561
|
+
}
|
|
3562
|
+
const padding = mask === "rect" ? Math.max(0, context.shape.shader.surfacePadding ?? 0) : 0;
|
|
3563
|
+
const surfaceBounds = {
|
|
3564
|
+
x: context.x - padding,
|
|
3565
|
+
y: context.y - padding,
|
|
3566
|
+
width: context.width + padding * 2,
|
|
3567
|
+
height: context.height + padding * 2
|
|
3568
|
+
};
|
|
3569
|
+
return {
|
|
3570
|
+
id: `${context.id}-shader`,
|
|
3571
|
+
type: "shader-surface",
|
|
3572
|
+
order: context.order,
|
|
3573
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds(surfaceBounds, context.rotation, 0),
|
|
3574
|
+
...surfaceBounds,
|
|
3575
|
+
rotation: context.rotation,
|
|
3576
|
+
shader: context.shape.shader,
|
|
3577
|
+
mask,
|
|
3578
|
+
fillColor: context.style.fill?.kind === "solid" ? context.style.fill.color : void 0
|
|
3579
|
+
};
|
|
3580
|
+
}
|
|
3581
|
+
|
|
2774
3582
|
// src/renderScene/artifacts/shape/style.ts
|
|
2775
3583
|
var REMOVED_SHAPE_HINTS = {
|
|
2776
3584
|
container_rectangle: " (use 'rectangle' with strokeStyle: dashed)"
|
|
@@ -2832,22 +3640,22 @@ function shapeDash(shape, strokeWidth) {
|
|
|
2832
3640
|
}
|
|
2833
3641
|
function shapeStyle(shape, diagnostics) {
|
|
2834
3642
|
const defaults = shapeDefaults(shape, diagnostics);
|
|
2835
|
-
const strokeWidth =
|
|
3643
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(shape.strokeWidth, defaults.strokeWidth);
|
|
2836
3644
|
const shadow = shape.shadowStyle ?? (shape.hasShadow ? { enabled: true, color: "#000000", opacity: 0.25, blur: 10, angle: 45, distance: 5 } : void 0);
|
|
2837
|
-
const angle =
|
|
3645
|
+
const angle = chunkKXYSO6GC_cjs.finite(shadow?.angle, 45) * Math.PI / 180;
|
|
2838
3646
|
return {
|
|
2839
|
-
fill:
|
|
2840
|
-
stroke:
|
|
3647
|
+
fill: chunkKXYSO6GC_cjs.paint(shape.fillColor, diagnostics, shape.id),
|
|
3648
|
+
stroke: chunkKXYSO6GC_cjs.paint(shape.strokeColor, diagnostics, shape.id),
|
|
2841
3649
|
strokeWidth,
|
|
2842
3650
|
dash: shapeDash(shape, strokeWidth),
|
|
2843
3651
|
lineCap: shape.strokeStyle === "dotted" ? "round" : "butt",
|
|
2844
|
-
opacity:
|
|
3652
|
+
opacity: chunkKXYSO6GC_cjs.finite(shape.opacity, defaults.opacity),
|
|
2845
3653
|
shadow: shadow?.enabled ? {
|
|
2846
3654
|
color: shadow.color ?? "#000000",
|
|
2847
|
-
opacity:
|
|
2848
|
-
blur:
|
|
2849
|
-
dx: Math.cos(angle) *
|
|
2850
|
-
dy: Math.sin(angle) *
|
|
3655
|
+
opacity: chunkKXYSO6GC_cjs.finite(shadow.opacity, 0.25),
|
|
3656
|
+
blur: chunkKXYSO6GC_cjs.finite(shadow.blur, 10),
|
|
3657
|
+
dx: Math.cos(angle) * chunkKXYSO6GC_cjs.finite(shadow.distance, 5),
|
|
3658
|
+
dy: Math.sin(angle) * chunkKXYSO6GC_cjs.finite(shadow.distance, 5)
|
|
2851
3659
|
} : void 0
|
|
2852
3660
|
};
|
|
2853
3661
|
}
|
|
@@ -2923,11 +3731,11 @@ function renderShapeText(context, strokeWidth, measureText) {
|
|
|
2923
3731
|
if (!shape.text) {
|
|
2924
3732
|
return null;
|
|
2925
3733
|
}
|
|
2926
|
-
const fontSize =
|
|
3734
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(shape.fontSize, shapeDefaults(shape, []).fontSize);
|
|
2927
3735
|
const padding = shape.isText ? 0 : Math.max(8, strokeWidth * 2);
|
|
2928
|
-
const area = shape.shapeType === "person" ?
|
|
3736
|
+
const area = shape.shapeType === "person" ? chunkKXYSO6GC_cjs.personLabelArea(x, y, width, height) : { x, y, width, height };
|
|
2929
3737
|
const textWidth = Math.max(0, area.width - padding * 2);
|
|
2930
|
-
const fontFamily2 = shape.fontFamily ||
|
|
3738
|
+
const fontFamily2 = shape.fontFamily || chunkKXYSO6GC_cjs.DEFAULT_FONT;
|
|
2931
3739
|
const metrics = measureText?.(fontFamily2, fontSize);
|
|
2932
3740
|
const textNode = {
|
|
2933
3741
|
type: "text",
|
|
@@ -2938,7 +3746,7 @@ function renderShapeText(context, strokeWidth, measureText) {
|
|
|
2938
3746
|
y: area.y + padding,
|
|
2939
3747
|
width: textWidth,
|
|
2940
3748
|
height: Math.max(0, area.height - padding * 2),
|
|
2941
|
-
lines:
|
|
3749
|
+
lines: chunkKXYSO6GC_cjs.wrapText(shape.text, textWidth, fontSize, metrics),
|
|
2942
3750
|
fontFamily: fontFamily2,
|
|
2943
3751
|
fontSize,
|
|
2944
3752
|
fontWeight: shape.fontWeight ?? "normal",
|
|
@@ -2946,12 +3754,12 @@ function renderShapeText(context, strokeWidth, measureText) {
|
|
|
2946
3754
|
color: shape.textColor || "#111827",
|
|
2947
3755
|
align: shape.textAlign ?? "center",
|
|
2948
3756
|
verticalAlign: shape.textVerticalAlign ?? "middle",
|
|
2949
|
-
lineHeight:
|
|
3757
|
+
lineHeight: chunkKXYSO6GC_cjs.finite(shape.lineHeight, 1.3),
|
|
2950
3758
|
rotation,
|
|
2951
3759
|
rotationCenter
|
|
2952
3760
|
};
|
|
2953
3761
|
if (hasBoldMarkup(shape.text)) {
|
|
2954
|
-
const { measure, spaceWidth } = metrics ??
|
|
3762
|
+
const { measure, spaceWidth } = metrics ?? chunkKXYSO6GC_cjs.heuristicRichMeasure(fontSize);
|
|
2955
3763
|
textNode.richLines = wrapRichText(shape.text, textWidth, measure, spaceWidth);
|
|
2956
3764
|
}
|
|
2957
3765
|
return textNode;
|
|
@@ -2990,19 +3798,19 @@ function renderDoubleStroke(context, strokeWidth) {
|
|
|
2990
3798
|
return nodes;
|
|
2991
3799
|
}
|
|
2992
3800
|
function createRenderContext(shape, index, diagnostics) {
|
|
2993
|
-
const x =
|
|
2994
|
-
const y =
|
|
2995
|
-
const width = Math.max(0,
|
|
2996
|
-
const height = Math.max(0,
|
|
2997
|
-
const rotation =
|
|
2998
|
-
const strokeWidth =
|
|
3801
|
+
const x = chunkKXYSO6GC_cjs.finite(shape.x, 0);
|
|
3802
|
+
const y = chunkKXYSO6GC_cjs.finite(shape.y, 0);
|
|
3803
|
+
const width = Math.max(0, chunkKXYSO6GC_cjs.finite(shape.width, 100));
|
|
3804
|
+
const height = Math.max(0, chunkKXYSO6GC_cjs.finite(shape.height, 100));
|
|
3805
|
+
const rotation = chunkKXYSO6GC_cjs.finite(shape.rotation, 0);
|
|
3806
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(shape.strokeWidth, 2);
|
|
2999
3807
|
return {
|
|
3000
3808
|
strokeWidth,
|
|
3001
3809
|
context: {
|
|
3002
3810
|
shape,
|
|
3003
3811
|
id: `shape-${shape.id}`,
|
|
3004
3812
|
order: 1e4 + index,
|
|
3005
|
-
bounds:
|
|
3813
|
+
bounds: chunkKXYSO6GC_cjs.rotatedBounds({ x, y, width, height }, rotation, strokeWidth + (shape.hasShadow ? 20 : 2)),
|
|
3006
3814
|
rotation,
|
|
3007
3815
|
rotationCenter: { x: x + width / 2, y: y + height / 2 },
|
|
3008
3816
|
style: shapeStyle(shape, diagnostics),
|
|
@@ -3013,32 +3821,13 @@ function createRenderContext(shape, index, diagnostics) {
|
|
|
3013
3821
|
}
|
|
3014
3822
|
};
|
|
3015
3823
|
}
|
|
3016
|
-
function renderShaderSurface(context) {
|
|
3017
|
-
if (!context.shape.shader || context.shape.shapeType !== "circle" && context.shape.shapeType !== "oval") {
|
|
3018
|
-
return void 0;
|
|
3019
|
-
}
|
|
3020
|
-
return {
|
|
3021
|
-
id: `${context.id}-shader`,
|
|
3022
|
-
type: "shader-surface",
|
|
3023
|
-
order: context.order,
|
|
3024
|
-
bounds: context.bounds,
|
|
3025
|
-
x: context.x,
|
|
3026
|
-
y: context.y,
|
|
3027
|
-
width: context.width,
|
|
3028
|
-
height: context.height,
|
|
3029
|
-
rotation: context.rotation,
|
|
3030
|
-
shader: context.shape.shader,
|
|
3031
|
-
mask: "ellipse",
|
|
3032
|
-
fillColor: context.style.fill?.kind === "solid" ? context.style.fill.color : void 0
|
|
3033
|
-
};
|
|
3034
|
-
}
|
|
3035
3824
|
function buildShape(shape, index, diagnostics, measureText) {
|
|
3036
3825
|
if (shape.isVisible === false) {
|
|
3037
3826
|
return [];
|
|
3038
3827
|
}
|
|
3039
3828
|
const { context, strokeWidth } = createRenderContext(shape, index, diagnostics);
|
|
3040
3829
|
const nodes = shape.strokeStyle === "double" ? renderDoubleStroke(context, strokeWidth || 1) : renderShapeGeometry(context);
|
|
3041
|
-
const shader =
|
|
3830
|
+
const shader = renderShapeShaderSurface(context);
|
|
3042
3831
|
if (shader) {
|
|
3043
3832
|
for (const node of nodes) {
|
|
3044
3833
|
if (node.type === "ellipse" || node.type === "path" || node.type === "rect") {
|
|
@@ -3055,7 +3844,7 @@ function buildShape(shape, index, diagnostics, measureText) {
|
|
|
3055
3844
|
}
|
|
3056
3845
|
function buildShapes(shapes, diagnostics, measureText) {
|
|
3057
3846
|
return shapes.flatMap(
|
|
3058
|
-
(shape, index) =>
|
|
3847
|
+
(shape, index) => chunkKXYSO6GC_cjs.tag(
|
|
3059
3848
|
buildShape(shape, index, diagnostics, measureText),
|
|
3060
3849
|
"shape",
|
|
3061
3850
|
shape.id,
|
|
@@ -3072,7 +3861,7 @@ function buildXAxisLabel(chart, layout, order) {
|
|
|
3072
3861
|
return null;
|
|
3073
3862
|
}
|
|
3074
3863
|
return {
|
|
3075
|
-
...
|
|
3864
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3076
3865
|
role: "axis",
|
|
3077
3866
|
id: `chart-x-label-${chart.id}`,
|
|
3078
3867
|
order,
|
|
@@ -3082,7 +3871,7 @@ function buildXAxisLabel(chart, layout, order) {
|
|
|
3082
3871
|
chart,
|
|
3083
3872
|
align: "center"
|
|
3084
3873
|
}),
|
|
3085
|
-
prop:
|
|
3874
|
+
prop: chunkKXYSO6GC_cjs.axisLabelProp("x")
|
|
3086
3875
|
};
|
|
3087
3876
|
}
|
|
3088
3877
|
function buildYAxisLabel(chart, layout, order) {
|
|
@@ -3090,7 +3879,7 @@ function buildYAxisLabel(chart, layout, order) {
|
|
|
3090
3879
|
return null;
|
|
3091
3880
|
}
|
|
3092
3881
|
return {
|
|
3093
|
-
...
|
|
3882
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3094
3883
|
role: "axis",
|
|
3095
3884
|
id: `chart-y-label-${chart.id}`,
|
|
3096
3885
|
order,
|
|
@@ -3106,7 +3895,7 @@ function buildYAxisLabel(chart, layout, order) {
|
|
|
3106
3895
|
align: "center",
|
|
3107
3896
|
rotation: -90
|
|
3108
3897
|
}),
|
|
3109
|
-
prop:
|
|
3898
|
+
prop: chunkKXYSO6GC_cjs.axisLabelProp("y")
|
|
3110
3899
|
};
|
|
3111
3900
|
}
|
|
3112
3901
|
function buildAxisLabels(chart, layout, order) {
|
|
@@ -3129,7 +3918,7 @@ function buildBoxplotSeriesYAxisTicks(chart, layout, order) {
|
|
|
3129
3918
|
return chart.series.map((series, index) => {
|
|
3130
3919
|
const centerY = layout.plot.y + (index + 0.5) * slotWidth;
|
|
3131
3920
|
return {
|
|
3132
|
-
...
|
|
3921
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3133
3922
|
role: "axis",
|
|
3134
3923
|
id: `chart-y-tick-${chart.id}-${index}`,
|
|
3135
3924
|
order: order + index,
|
|
@@ -3139,7 +3928,7 @@ function buildBoxplotSeriesYAxisTicks(chart, layout, order) {
|
|
|
3139
3928
|
chart,
|
|
3140
3929
|
align: "right"
|
|
3141
3930
|
}),
|
|
3142
|
-
prop:
|
|
3931
|
+
prop: chunkKXYSO6GC_cjs.seriesLabelProp(series.id)
|
|
3143
3932
|
};
|
|
3144
3933
|
});
|
|
3145
3934
|
}
|
|
@@ -3165,7 +3954,7 @@ function isStackedLegendPosition(position) {
|
|
|
3165
3954
|
return position === "bottomLeft" || position === "bottomRight";
|
|
3166
3955
|
}
|
|
3167
3956
|
function legendItemWidths(chart) {
|
|
3168
|
-
return legendSeries(chart).map((item) => Math.max(42, item.label.length *
|
|
3957
|
+
return legendSeries(chart).map((item) => Math.max(42, item.label.length * chunkKXYSO6GC_cjs.finite(chart.fontSize, 12) * 0.58 + 22));
|
|
3169
3958
|
}
|
|
3170
3959
|
function stackedLegendColumnWidth(chart) {
|
|
3171
3960
|
const widths = legendItemWidths(chart);
|
|
@@ -3218,9 +4007,9 @@ function renderLegendItem(render2, item) {
|
|
|
3218
4007
|
}
|
|
3219
4008
|
function createLegendSwatch(render2, item) {
|
|
3220
4009
|
const { chart, bounds, diagnostics } = render2;
|
|
3221
|
-
const fallback =
|
|
4010
|
+
const fallback = chunkKXYSO6GC_cjs.CHART_COLORS[item.seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
3222
4011
|
const solidOnly = chart.chartType === "line";
|
|
3223
|
-
const color = solidOnly ?
|
|
4012
|
+
const color = solidOnly ? chunkKXYSO6GC_cjs.representativeColor(item.series.color, fallback) : item.series.color ?? fallback;
|
|
3224
4013
|
return {
|
|
3225
4014
|
type: "rect",
|
|
3226
4015
|
id: `chart-legend-swatch-${chart.id}-${item.series.id}`,
|
|
@@ -3231,16 +4020,16 @@ function createLegendSwatch(render2, item) {
|
|
|
3231
4020
|
width: 10,
|
|
3232
4021
|
height: 10,
|
|
3233
4022
|
rx: 3,
|
|
3234
|
-
prop:
|
|
4023
|
+
prop: chunkKXYSO6GC_cjs.seriesColorProp(item.series.id),
|
|
3235
4024
|
propKind: "color",
|
|
3236
4025
|
propSolidOnly: solidOnly,
|
|
3237
|
-
style: { fill:
|
|
4026
|
+
style: { fill: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id) }
|
|
3238
4027
|
};
|
|
3239
4028
|
}
|
|
3240
4029
|
function createLegendLabel(render2, item) {
|
|
3241
4030
|
const { chart, bounds } = render2;
|
|
3242
4031
|
return {
|
|
3243
|
-
...
|
|
4032
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3244
4033
|
role: "legend",
|
|
3245
4034
|
id: `chart-legend-${chart.id}-${item.series.id}`,
|
|
3246
4035
|
order: item.order + 1,
|
|
@@ -3249,7 +4038,7 @@ function createLegendLabel(render2, item) {
|
|
|
3249
4038
|
text: item.series.label,
|
|
3250
4039
|
chart
|
|
3251
4040
|
}),
|
|
3252
|
-
prop:
|
|
4041
|
+
prop: chunkKXYSO6GC_cjs.seriesLabelProp(item.series.id)
|
|
3253
4042
|
};
|
|
3254
4043
|
}
|
|
3255
4044
|
|
|
@@ -3268,13 +4057,13 @@ function hasCartesianDecorations(chart) {
|
|
|
3268
4057
|
return !CHARTS_WITHOUT_CARTESIAN_DECORATIONS.has(chart.chartType);
|
|
3269
4058
|
}
|
|
3270
4059
|
function tickOffset(chart) {
|
|
3271
|
-
return hasCartesianDecorations(chart) ? Math.max(0,
|
|
4060
|
+
return hasCartesianDecorations(chart) ? Math.max(0, chunkKXYSO6GC_cjs.finite(chart.tickLength, 0)) : 0;
|
|
3272
4061
|
}
|
|
3273
4062
|
function isHorizontalBoxplot(chart) {
|
|
3274
4063
|
return chart.chartType === "boxplot" && chart.config?.orientation === "horizontal";
|
|
3275
4064
|
}
|
|
3276
4065
|
function boxplotCategoryLabelWidth(chart) {
|
|
3277
|
-
const fontSize =
|
|
4066
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(chart.fontSize, 12);
|
|
3278
4067
|
const longest = Math.max(0, ...chart.series.map((series) => (series.label || series.id).length));
|
|
3279
4068
|
return longest * fontSize * 0.58 + 16;
|
|
3280
4069
|
}
|
|
@@ -3286,7 +4075,7 @@ function treemapSideLegendSide(chart, showLegend) {
|
|
|
3286
4075
|
return chart.legendPosition === "left" ? "left" : chart.legendPosition === "right" ? "right" : null;
|
|
3287
4076
|
}
|
|
3288
4077
|
function barCategoryLabelWidth(chart) {
|
|
3289
|
-
const fontSize =
|
|
4078
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(chart.axisFontSize ?? chart.fontSize, 12);
|
|
3290
4079
|
const categories = chart.config?.categories ?? [];
|
|
3291
4080
|
return Math.max(0, ...categories.map((category) => category.length)) * fontSize * 0.58 + 16;
|
|
3292
4081
|
}
|
|
@@ -3294,7 +4083,7 @@ function leftLabelWidth(chart) {
|
|
|
3294
4083
|
if (isHorizontalBoxplot(chart)) {
|
|
3295
4084
|
return boxplotCategoryLabelWidth(chart);
|
|
3296
4085
|
}
|
|
3297
|
-
if (
|
|
4086
|
+
if (chunkKXYSO6GC_cjs.isHorizontalBar(chart)) {
|
|
3298
4087
|
return chart.categoryAlign === "left" || chart.categoryAlign === "inside" ? 20 : barCategoryLabelWidth(chart);
|
|
3299
4088
|
}
|
|
3300
4089
|
if (chart.showValueAxis === false) {
|
|
@@ -3315,17 +4104,17 @@ function decorations(chart) {
|
|
|
3315
4104
|
const padLeft = tick + (showLabels ? leftLabelWidth(chart) : 12) + (legendPosition === "bottomLeft" ? sideColumnWidth : 0) + (treemapSide === "left" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
|
|
3316
4105
|
const padRight = 24 + (legendPosition === "bottomRight" ? sideColumnWidth : 0) + (treemapSide === "right" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
|
|
3317
4106
|
const valueRow = chart.chartType === "bar" && chart.config?.showBarLabels === true && chart.config.barLabelPosition === "axis";
|
|
3318
|
-
const horizontalValueAxis =
|
|
3319
|
-
const basePadBottom = showLabels ?
|
|
4107
|
+
const horizontalValueAxis = chunkKXYSO6GC_cjs.isHorizontalBar(chart) && chart.showValueAxis !== false;
|
|
4108
|
+
const basePadBottom = showLabels ? chunkKXYSO6GC_cjs.isHorizontalBar(chart) ? horizontalValueAxis ? 34 : 12 : (chart.axisX.label ? 52 : 34) + (valueRow ? 18 : 0) : 12;
|
|
3320
4109
|
const hasColorBar = chart.chartType === "field" && showLegend && Boolean(chart.config?.scale?.stops.length);
|
|
3321
4110
|
const legendAtBottomRow = hasLegendItems && !legendAtTop && !legendStacked;
|
|
3322
4111
|
const padBottom = tick + basePadBottom + (hasColorBar ? 44 : 0) + (legendAtBottomRow ? 16 + LEGEND_ROW_HEIGHT : 0);
|
|
3323
|
-
const titleHeight = chart.title ? Math.max(44, 20 +
|
|
4112
|
+
const titleHeight = chart.title ? Math.max(44, 20 + chunkKXYSO6GC_cjs.finite(chart.titleSize, 14) * 1.6) : 0;
|
|
3324
4113
|
const padTop = titleHeight || (legendAtTop && hasLegendItems ? 44 : 24);
|
|
3325
4114
|
return {
|
|
3326
|
-
bounds:
|
|
4115
|
+
bounds: chunkKXYSO6GC_cjs.boxBounds(
|
|
3327
4116
|
{ x: chart.x, y: chart.y, width: chart.width, height: chart.height },
|
|
3328
|
-
|
|
4117
|
+
chunkKXYSO6GC_cjs.finite(chart.strokeWidth, 1) + 2
|
|
3329
4118
|
),
|
|
3330
4119
|
plot: {
|
|
3331
4120
|
x: chart.x + padLeft,
|
|
@@ -3347,19 +4136,19 @@ function categoryLabels(chart, count) {
|
|
|
3347
4136
|
return Array.from({ length: count }, (_value, index) => String(index + 1));
|
|
3348
4137
|
}
|
|
3349
4138
|
function buildCategoricalXAxisTicks(chart, layout, order) {
|
|
3350
|
-
const count =
|
|
4139
|
+
const count = chunkKXYSO6GC_cjs.barCategoryCount(chart);
|
|
3351
4140
|
const slotWidth = layout.plot.width / count;
|
|
3352
4141
|
const labels = categoryLabels(chart, count);
|
|
3353
4142
|
const editable = Boolean(chart.config?.categories?.length);
|
|
3354
4143
|
const left = chart.categoryAlign === "left";
|
|
3355
4144
|
const groupGap = left ? Math.min(
|
|
3356
|
-
Math.max(0,
|
|
4145
|
+
Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barGroupGap, 8)),
|
|
3357
4146
|
Math.max(0, slotWidth - 1)
|
|
3358
4147
|
) : 0;
|
|
3359
4148
|
return Array.from({ length: count }, (_value, index) => {
|
|
3360
4149
|
const centerX = layout.plot.x + (index + 0.5) * slotWidth;
|
|
3361
4150
|
return {
|
|
3362
|
-
...
|
|
4151
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3363
4152
|
role: "axis",
|
|
3364
4153
|
id: `chart-x-tick-${chart.id}-${index}`,
|
|
3365
4154
|
order: order + index,
|
|
@@ -3374,7 +4163,7 @@ function buildCategoricalXAxisTicks(chart, layout, order) {
|
|
|
3374
4163
|
chart,
|
|
3375
4164
|
align: left ? "left" : "center"
|
|
3376
4165
|
}),
|
|
3377
|
-
prop: editable ?
|
|
4166
|
+
prop: editable ? chunkKXYSO6GC_cjs.categoryProp(index) : void 0
|
|
3378
4167
|
};
|
|
3379
4168
|
});
|
|
3380
4169
|
}
|
|
@@ -3384,7 +4173,7 @@ function buildSeriesXAxisTicks(chart, layout, order) {
|
|
|
3384
4173
|
return chart.series.map((series, index) => {
|
|
3385
4174
|
const centerX = layout.plot.x + (index + 0.5) * slotWidth;
|
|
3386
4175
|
return {
|
|
3387
|
-
...
|
|
4176
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3388
4177
|
role: "axis",
|
|
3389
4178
|
id: `chart-x-tick-${chart.id}-${index}`,
|
|
3390
4179
|
order: order + index,
|
|
@@ -3399,16 +4188,16 @@ function buildSeriesXAxisTicks(chart, layout, order) {
|
|
|
3399
4188
|
chart,
|
|
3400
4189
|
align: "center"
|
|
3401
4190
|
}),
|
|
3402
|
-
prop:
|
|
4191
|
+
prop: chunkKXYSO6GC_cjs.seriesLabelProp(series.id)
|
|
3403
4192
|
};
|
|
3404
4193
|
});
|
|
3405
4194
|
}
|
|
3406
4195
|
|
|
3407
4196
|
// src/renderScene/charts/decorations/numericXAxis.ts
|
|
3408
4197
|
function buildNumericXAxisTicks(chart, layout, order) {
|
|
3409
|
-
return
|
|
3410
|
-
const x = layout.plot.x +
|
|
3411
|
-
return
|
|
4198
|
+
return chunkKXYSO6GC_cjs.chartTicks(chart.axisX).map((tick, index) => {
|
|
4199
|
+
const x = layout.plot.x + chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisX, layout.plot.width);
|
|
4200
|
+
return chunkKXYSO6GC_cjs.chartText({
|
|
3412
4201
|
role: "axis",
|
|
3413
4202
|
id: `chart-x-tick-${chart.id}-${tick}`,
|
|
3414
4203
|
order: order + index,
|
|
@@ -3423,9 +4212,9 @@ function buildNumericXAxisTicks(chart, layout, order) {
|
|
|
3423
4212
|
|
|
3424
4213
|
// src/renderScene/charts/decorations/numericYAxis.ts
|
|
3425
4214
|
function buildNumericYAxisTicks(chart, layout, order) {
|
|
3426
|
-
return
|
|
3427
|
-
const y = layout.plot.y + layout.plot.height -
|
|
3428
|
-
return
|
|
4215
|
+
return chunkKXYSO6GC_cjs.chartTicks(chart.axisY).map((tick, index) => {
|
|
4216
|
+
const y = layout.plot.y + layout.plot.height - chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisY, layout.plot.height);
|
|
4217
|
+
return chunkKXYSO6GC_cjs.chartText({
|
|
3429
4218
|
role: "axis",
|
|
3430
4219
|
id: `chart-y-tick-${chart.id}-${tick}`,
|
|
3431
4220
|
order: order + index,
|
|
@@ -3460,10 +4249,10 @@ function buildYAxisTicks(chart, layout, order) {
|
|
|
3460
4249
|
function xTickPositions(chart, layout) {
|
|
3461
4250
|
const { plot } = layout;
|
|
3462
4251
|
if (chart.chartType === "bar") {
|
|
3463
|
-
const count =
|
|
4252
|
+
const count = chunkKXYSO6GC_cjs.barCategoryCount(chart);
|
|
3464
4253
|
return Array.from({ length: count }, (_value, index) => plot.x + (index + 0.5) * plot.width / count);
|
|
3465
4254
|
}
|
|
3466
|
-
return
|
|
4255
|
+
return chunkKXYSO6GC_cjs.chartTicks(chart.axisX).map((tick) => plot.x + chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisX, plot.width));
|
|
3467
4256
|
}
|
|
3468
4257
|
function axisLineDash(chart, width) {
|
|
3469
4258
|
if (chart.axisLineStyle === "dashed") {
|
|
@@ -3472,8 +4261,8 @@ function axisLineDash(chart, width) {
|
|
|
3472
4261
|
return chart.axisLineStyle === "dotted" ? { dash: [0.1, width * 3], lineCap: "round" } : {};
|
|
3473
4262
|
}
|
|
3474
4263
|
function buildAxisLines(chart, layout, order) {
|
|
3475
|
-
const lineWidth =
|
|
3476
|
-
const tickLength =
|
|
4264
|
+
const lineWidth = chunkKXYSO6GC_cjs.finite(chart.axisLineWidth, 0);
|
|
4265
|
+
const tickLength = chunkKXYSO6GC_cjs.finite(chart.tickLength, 0);
|
|
3477
4266
|
if (lineWidth <= 0 && tickLength <= 0) {
|
|
3478
4267
|
return [];
|
|
3479
4268
|
}
|
|
@@ -3494,20 +4283,20 @@ function buildAxisLines(chart, layout, order) {
|
|
|
3494
4283
|
}
|
|
3495
4284
|
add("line-x", `M ${plot.x} ${bottom} L ${plot.x + plot.width} ${bottom}`);
|
|
3496
4285
|
}
|
|
3497
|
-
if (tickLength > 0 &&
|
|
3498
|
-
|
|
3499
|
-
const x = plot.x +
|
|
4286
|
+
if (tickLength > 0 && chunkKXYSO6GC_cjs.isHorizontalBar(chart)) {
|
|
4287
|
+
chunkKXYSO6GC_cjs.chartTicks(chart.axisY).forEach((tick) => {
|
|
4288
|
+
const x = plot.x + chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisY, plot.width);
|
|
3500
4289
|
add(`tick-v-${tick}`, `M ${x} ${bottom} L ${x} ${bottom + tickLength}`);
|
|
3501
4290
|
});
|
|
3502
|
-
const rows =
|
|
4291
|
+
const rows = chunkKXYSO6GC_cjs.horizontalRows(chart, plot);
|
|
3503
4292
|
for (let index = 0; index < rows.count; index++) {
|
|
3504
|
-
const y =
|
|
4293
|
+
const y = chunkKXYSO6GC_cjs.rowTop(rows, plot, index) + rows.labelRow + rows.barsHeight / 2;
|
|
3505
4294
|
add(`tick-c-${index}`, `M ${plot.x - tickLength} ${y} L ${plot.x} ${y}`);
|
|
3506
4295
|
}
|
|
3507
4296
|
}
|
|
3508
|
-
if (tickLength > 0 && !isHorizontalBoxplot2(chart) && !
|
|
3509
|
-
|
|
3510
|
-
const y = bottom -
|
|
4297
|
+
if (tickLength > 0 && !isHorizontalBoxplot2(chart) && !chunkKXYSO6GC_cjs.isHorizontalBar(chart)) {
|
|
4298
|
+
chunkKXYSO6GC_cjs.chartTicks(chart.axisY).forEach((tick) => {
|
|
4299
|
+
const y = bottom - chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisY, plot.height);
|
|
3511
4300
|
add(`tick-y-${tick}`, `M ${plot.x - tickLength} ${y} L ${plot.x} ${y}`);
|
|
3512
4301
|
});
|
|
3513
4302
|
xTickPositions(chart, layout).forEach((x, index) => {
|
|
@@ -3522,14 +4311,14 @@ function categoryNames(chart, count) {
|
|
|
3522
4311
|
}
|
|
3523
4312
|
function buildHorizontalBarAxes(chart, layout, order) {
|
|
3524
4313
|
const { plot, bounds } = layout;
|
|
3525
|
-
const rows =
|
|
4314
|
+
const rows = chunkKXYSO6GC_cjs.horizontalRows(chart, plot);
|
|
3526
4315
|
const above = chart.categoryAlign === "left";
|
|
3527
4316
|
const inside = chart.categoryAlign === "inside";
|
|
3528
4317
|
const editable = Boolean(chart.config?.categories?.length);
|
|
3529
4318
|
const nodes = categoryNames(chart, rows.count).map((name, index) => {
|
|
3530
|
-
const top =
|
|
4319
|
+
const top = chunkKXYSO6GC_cjs.rowTop(rows, plot, index);
|
|
3531
4320
|
return {
|
|
3532
|
-
...
|
|
4321
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3533
4322
|
role: "axis",
|
|
3534
4323
|
id: `chart-y-category-${chart.id}-${index}`,
|
|
3535
4324
|
order: order + index,
|
|
@@ -3539,19 +4328,19 @@ function buildHorizontalBarAxes(chart, layout, order) {
|
|
|
3539
4328
|
chart,
|
|
3540
4329
|
align: above || inside ? "left" : "right"
|
|
3541
4330
|
}),
|
|
3542
|
-
prop: editable ?
|
|
4331
|
+
prop: editable ? chunkKXYSO6GC_cjs.categoryProp(index) : void 0
|
|
3543
4332
|
};
|
|
3544
4333
|
});
|
|
3545
4334
|
if (chart.showValueAxis !== false) {
|
|
3546
|
-
|
|
3547
|
-
const x = plot.x +
|
|
4335
|
+
chunkKXYSO6GC_cjs.chartTicks(chart.axisY).forEach((tick, index) => {
|
|
4336
|
+
const x = plot.x + chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisY, plot.width);
|
|
3548
4337
|
nodes.push(
|
|
3549
|
-
|
|
4338
|
+
chunkKXYSO6GC_cjs.chartText({
|
|
3550
4339
|
role: "axis",
|
|
3551
4340
|
id: `chart-x-tick-${chart.id}-${tick}`,
|
|
3552
4341
|
order: order + rows.count + index,
|
|
3553
4342
|
bounds,
|
|
3554
|
-
frame: { x: x - 20, y: plot.y + plot.height + 4 +
|
|
4343
|
+
frame: { x: x - 20, y: plot.y + plot.height + 4 + chunkKXYSO6GC_cjs.finite(chart.tickLength, 0), width: 40, height: 18 },
|
|
3555
4344
|
text: String(tick),
|
|
3556
4345
|
chart,
|
|
3557
4346
|
align: "center"
|
|
@@ -3570,7 +4359,7 @@ function buildChartAxes(chart, layout, order) {
|
|
|
3570
4359
|
return lines;
|
|
3571
4360
|
}
|
|
3572
4361
|
order += lines.length;
|
|
3573
|
-
if (
|
|
4362
|
+
if (chunkKXYSO6GC_cjs.isHorizontalBar(chart)) {
|
|
3574
4363
|
return [...lines, ...buildHorizontalBarAxes(chart, layout, order)];
|
|
3575
4364
|
}
|
|
3576
4365
|
const xTicks = buildXAxisTicks(chart, layout, order);
|
|
@@ -3648,7 +4437,7 @@ function buildCircularChartGrid(chart, plot, bounds, order) {
|
|
|
3648
4437
|
const centerX = plot.x + plot.width / 2;
|
|
3649
4438
|
const centerY = plot.y + plot.height / 2;
|
|
3650
4439
|
const radius = Math.max(0, Math.min(plot.width, plot.height) / 2);
|
|
3651
|
-
const width =
|
|
4440
|
+
const width = chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1);
|
|
3652
4441
|
if (chart.gridLineStyle === "dotted") {
|
|
3653
4442
|
return buildDottedCircularGrid(chart, bounds, order, centerX, centerY, radius, width);
|
|
3654
4443
|
}
|
|
@@ -3659,7 +4448,7 @@ function buildCircularChartGrid(chart, plot, bounds, order) {
|
|
|
3659
4448
|
...gridLineDashStyle(chart, width)
|
|
3660
4449
|
};
|
|
3661
4450
|
const nodes = [];
|
|
3662
|
-
|
|
4451
|
+
chunkKXYSO6GC_cjs.chartTicks(chart.axisY).filter((tick) => tick > chart.axisY.min).forEach((tick) => {
|
|
3663
4452
|
const ringRadius = radius * ringRatio(chart, tick);
|
|
3664
4453
|
nodes.push({
|
|
3665
4454
|
type: "ellipse",
|
|
@@ -3673,8 +4462,8 @@ function buildCircularChartGrid(chart, plot, bounds, order) {
|
|
|
3673
4462
|
style
|
|
3674
4463
|
});
|
|
3675
4464
|
});
|
|
3676
|
-
|
|
3677
|
-
const angle =
|
|
4465
|
+
chunkKXYSO6GC_cjs.chartTicks(chart.axisX).forEach((tick) => {
|
|
4466
|
+
const angle = chunkKXYSO6GC_cjs.angleForAxisValue(chart.axisX.min, chart.axisX.max, tick);
|
|
3678
4467
|
const edgeX = centerX + Math.cos(angle) * radius;
|
|
3679
4468
|
const edgeY = centerY + Math.sin(angle) * radius;
|
|
3680
4469
|
nodes.push({
|
|
@@ -3689,13 +4478,13 @@ function buildCircularChartGrid(chart, plot, bounds, order) {
|
|
|
3689
4478
|
return nodes;
|
|
3690
4479
|
}
|
|
3691
4480
|
function buildDottedCircularGrid(chart, bounds, order, centerX, centerY, radius, width) {
|
|
3692
|
-
const yTicks =
|
|
3693
|
-
const xTicks =
|
|
4481
|
+
const yTicks = chunkKXYSO6GC_cjs.chartTicks(chart.axisY).filter((tick) => tick > chart.axisY.min);
|
|
4482
|
+
const xTicks = chunkKXYSO6GC_cjs.chartTicks(chart.axisX);
|
|
3694
4483
|
const nodes = [];
|
|
3695
4484
|
yTicks.forEach((yTick) => {
|
|
3696
4485
|
const ringRadius = radius * ringRatio(chart, yTick);
|
|
3697
4486
|
xTicks.forEach((xTick) => {
|
|
3698
|
-
const angle =
|
|
4487
|
+
const angle = chunkKXYSO6GC_cjs.angleForAxisValue(chart.axisX.min, chart.axisX.max, xTick);
|
|
3699
4488
|
const x = centerX + Math.cos(angle) * ringRadius;
|
|
3700
4489
|
const y = centerY + Math.sin(angle) * ringRadius;
|
|
3701
4490
|
const id = `chart-grid-dot-${chart.id}-${xTick}-${yTick}`;
|
|
@@ -3717,8 +4506,8 @@ function buildChartGrid(chart, plot, bounds, order) {
|
|
|
3717
4506
|
if (chart.gridShape === "circle" && CIRCULAR_GRID_CHART_TYPES.has(chart.chartType)) {
|
|
3718
4507
|
return buildCircularChartGrid(chart, plot, bounds, order);
|
|
3719
4508
|
}
|
|
3720
|
-
const width =
|
|
3721
|
-
if (
|
|
4509
|
+
const width = chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1);
|
|
4510
|
+
if (chunkKXYSO6GC_cjs.isHorizontalBar(chart)) {
|
|
3722
4511
|
return buildHorizontalBarGrid(chart, plot, bounds, order, width);
|
|
3723
4512
|
}
|
|
3724
4513
|
const clip = chart.chartType === "field" ? fieldSurfaceClip(chart, plot) : void 0;
|
|
@@ -3733,8 +4522,8 @@ function buildChartGrid(chart, plot, bounds, order) {
|
|
|
3733
4522
|
clip
|
|
3734
4523
|
};
|
|
3735
4524
|
const nodes = [];
|
|
3736
|
-
(chart.gridAxes === "y" ? [] :
|
|
3737
|
-
const x = plot.x +
|
|
4525
|
+
(chart.gridAxes === "y" ? [] : chunkKXYSO6GC_cjs.chartTicks(chart.axisX)).forEach((tick) => {
|
|
4526
|
+
const x = plot.x + chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisX, plot.width);
|
|
3738
4527
|
nodes.push({
|
|
3739
4528
|
type: "path",
|
|
3740
4529
|
id: `chart-grid-x-${chart.id}-${tick}`,
|
|
@@ -3744,8 +4533,8 @@ function buildChartGrid(chart, plot, bounds, order) {
|
|
|
3744
4533
|
style
|
|
3745
4534
|
});
|
|
3746
4535
|
});
|
|
3747
|
-
(chart.gridAxes === "x" ? [] :
|
|
3748
|
-
const y = plot.y + plot.height -
|
|
4536
|
+
(chart.gridAxes === "x" ? [] : chunkKXYSO6GC_cjs.chartTicks(chart.axisY)).forEach((tick) => {
|
|
4537
|
+
const y = plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisY, plot.height);
|
|
3749
4538
|
nodes.push({
|
|
3750
4539
|
type: "path",
|
|
3751
4540
|
id: `chart-grid-y-${chart.id}-${tick}`,
|
|
@@ -3767,8 +4556,8 @@ function buildHorizontalBarGrid(chart, plot, bounds, order, width) {
|
|
|
3767
4556
|
strokeWidth: width,
|
|
3768
4557
|
...chart.gridLineStyle === "dotted" ? { dash: [0.1, width * 3], lineCap: "round" } : gridLineDashStyle(chart, width)
|
|
3769
4558
|
};
|
|
3770
|
-
return
|
|
3771
|
-
const x = plot.x +
|
|
4559
|
+
return chunkKXYSO6GC_cjs.chartTicks(chart.axisY).map((tick, index) => {
|
|
4560
|
+
const x = plot.x + chunkKXYSO6GC_cjs.mapChartValue(tick, chart.axisY, plot.width);
|
|
3772
4561
|
return {
|
|
3773
4562
|
type: "path",
|
|
3774
4563
|
id: `chart-grid-x-${chart.id}-${tick}`,
|
|
@@ -3780,13 +4569,13 @@ function buildHorizontalBarGrid(chart, plot, bounds, order, width) {
|
|
|
3780
4569
|
});
|
|
3781
4570
|
}
|
|
3782
4571
|
function buildDottedRectGrid(chart, plot, bounds, order, width, clip) {
|
|
3783
|
-
const xTicks =
|
|
3784
|
-
const yTicks =
|
|
4572
|
+
const xTicks = chunkKXYSO6GC_cjs.chartTicks(chart.axisX);
|
|
4573
|
+
const yTicks = chunkKXYSO6GC_cjs.chartTicks(chart.axisY);
|
|
3785
4574
|
const nodes = [];
|
|
3786
4575
|
xTicks.forEach((xTick) => {
|
|
3787
|
-
const x = plot.x +
|
|
4576
|
+
const x = plot.x + chunkKXYSO6GC_cjs.mapChartValue(xTick, chart.axisX, plot.width);
|
|
3788
4577
|
yTicks.forEach((yTick) => {
|
|
3789
|
-
const y = plot.y + plot.height -
|
|
4578
|
+
const y = plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(yTick, chart.axisY, plot.height);
|
|
3790
4579
|
const id = `chart-grid-dot-${chart.id}-${xTick}-${yTick}`;
|
|
3791
4580
|
nodes.push(createGridDot(chart, id, order + nodes.length, bounds, x, y, width, clip));
|
|
3792
4581
|
});
|
|
@@ -3809,7 +4598,7 @@ function createChartRuleMarks(render2) {
|
|
|
3809
4598
|
return {
|
|
3810
4599
|
rule,
|
|
3811
4600
|
color: rule.color || render2.chart.strokeColor || "#475569",
|
|
3812
|
-
y: render2.plot.y + render2.plot.height -
|
|
4601
|
+
y: render2.plot.y + render2.plot.height - chunkKXYSO6GC_cjs.mapChartValue(rule.at, render2.chart.axisY, render2.plot.height),
|
|
3813
4602
|
lineOrder,
|
|
3814
4603
|
labelOrder
|
|
3815
4604
|
};
|
|
@@ -3829,7 +4618,7 @@ function createChartRuleLine(render2, mark) {
|
|
|
3829
4618
|
order: mark.lineOrder,
|
|
3830
4619
|
bounds: render2.bounds,
|
|
3831
4620
|
d: `M ${render2.plot.x} ${mark.y} L ${render2.plot.x + render2.plot.width} ${mark.y}`,
|
|
3832
|
-
prop:
|
|
4621
|
+
prop: chunkKXYSO6GC_cjs.ruleAtProp(mark.rule.id),
|
|
3833
4622
|
propKind: "value",
|
|
3834
4623
|
style: {
|
|
3835
4624
|
fill: { kind: "none" },
|
|
@@ -3840,9 +4629,9 @@ function createChartRuleLine(render2, mark) {
|
|
|
3840
4629
|
};
|
|
3841
4630
|
}
|
|
3842
4631
|
function createChartRuleLabel(render2, mark) {
|
|
3843
|
-
const fontSize = Math.max(9,
|
|
4632
|
+
const fontSize = Math.max(9, chunkKXYSO6GC_cjs.finite(render2.chart.fontSize, 12) - 2);
|
|
3844
4633
|
return {
|
|
3845
|
-
...
|
|
4634
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
3846
4635
|
id: `chart-rule-label-${render2.chart.id}-${mark.rule.id}`,
|
|
3847
4636
|
order: mark.labelOrder ?? mark.lineOrder + 1,
|
|
3848
4637
|
bounds: render2.bounds,
|
|
@@ -3851,38 +4640,38 @@ function createChartRuleLabel(render2, mark) {
|
|
|
3851
4640
|
chart: render2.chart
|
|
3852
4641
|
}),
|
|
3853
4642
|
color: mark.color,
|
|
3854
|
-
prop:
|
|
4643
|
+
prop: chunkKXYSO6GC_cjs.ruleTextProp(mark.rule.id)
|
|
3855
4644
|
};
|
|
3856
4645
|
}
|
|
3857
4646
|
|
|
3858
4647
|
// src/renderScene/charts/chartBackdrop.ts
|
|
3859
4648
|
function chartImageRect(chart) {
|
|
3860
|
-
const inset =
|
|
4649
|
+
const inset = chunkKXYSO6GC_cjs.finite(chart.strokeWidth, 1) / 2;
|
|
3861
4650
|
return {
|
|
3862
4651
|
x: chart.x + inset,
|
|
3863
4652
|
y: chart.y + inset,
|
|
3864
4653
|
width: Math.max(1, chart.width - inset * 2),
|
|
3865
4654
|
height: Math.max(1, chart.height - inset * 2),
|
|
3866
|
-
rx: Math.max(0,
|
|
4655
|
+
rx: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.cornerRadius, 12) - inset)
|
|
3867
4656
|
};
|
|
3868
4657
|
}
|
|
3869
4658
|
function buildChartBackdrop(chart, bounds, order) {
|
|
3870
4659
|
if (!chart.fillImage) {
|
|
3871
4660
|
return [];
|
|
3872
4661
|
}
|
|
3873
|
-
const
|
|
4662
|
+
const rect2 = chartImageRect(chart);
|
|
3874
4663
|
const nodes = [
|
|
3875
4664
|
{
|
|
3876
4665
|
type: "image",
|
|
3877
4666
|
id: `chart-image-${chart.id}`,
|
|
3878
4667
|
order: order.next(),
|
|
3879
4668
|
bounds,
|
|
3880
|
-
x:
|
|
3881
|
-
y:
|
|
3882
|
-
width:
|
|
3883
|
-
height:
|
|
4669
|
+
x: rect2.x,
|
|
4670
|
+
y: rect2.y,
|
|
4671
|
+
width: rect2.width,
|
|
4672
|
+
height: rect2.height,
|
|
3884
4673
|
href: chart.fillImage.url,
|
|
3885
|
-
style: { clip: { type: "rect", ...
|
|
4674
|
+
style: { clip: { type: "rect", ...rect2 }, pointerEvents: "none" }
|
|
3886
4675
|
}
|
|
3887
4676
|
];
|
|
3888
4677
|
if (chart.fillImage.overlay) {
|
|
@@ -3891,11 +4680,11 @@ function buildChartBackdrop(chart, bounds, order) {
|
|
|
3891
4680
|
id: `chart-image-overlay-${chart.id}`,
|
|
3892
4681
|
order: order.next(),
|
|
3893
4682
|
bounds,
|
|
3894
|
-
x:
|
|
3895
|
-
y:
|
|
3896
|
-
width:
|
|
3897
|
-
height:
|
|
3898
|
-
rx:
|
|
4683
|
+
x: rect2.x,
|
|
4684
|
+
y: rect2.y,
|
|
4685
|
+
width: rect2.width,
|
|
4686
|
+
height: rect2.height,
|
|
4687
|
+
rx: rect2.rx,
|
|
3899
4688
|
style: { fill: { kind: "solid", color: chart.fillImage.overlay }, pointerEvents: "none" }
|
|
3900
4689
|
});
|
|
3901
4690
|
}
|
|
@@ -3905,25 +4694,25 @@ function buildChartBackdrop(chart, bounds, order) {
|
|
|
3905
4694
|
// src/renderScene/charts/renderers/bar/glass.ts
|
|
3906
4695
|
function createGlassBackdropNodes(context, id, d) {
|
|
3907
4696
|
const { chart, bounds, nextOrder } = context;
|
|
3908
|
-
const blur =
|
|
4697
|
+
const blur = chunkKXYSO6GC_cjs.finite(chart.config?.barGlassBlur, 0);
|
|
3909
4698
|
if (blur <= 0 || !chart.fillImage) {
|
|
3910
4699
|
return [];
|
|
3911
4700
|
}
|
|
3912
|
-
const
|
|
4701
|
+
const rect2 = chartImageRect(chart);
|
|
3913
4702
|
const nodes = [
|
|
3914
4703
|
{
|
|
3915
4704
|
type: "image",
|
|
3916
4705
|
id: `chart-bar-glass-${chart.id}-${id}`,
|
|
3917
4706
|
order: nextOrder(),
|
|
3918
4707
|
bounds,
|
|
3919
|
-
x:
|
|
3920
|
-
y:
|
|
3921
|
-
width:
|
|
3922
|
-
height:
|
|
4708
|
+
x: rect2.x,
|
|
4709
|
+
y: rect2.y,
|
|
4710
|
+
width: rect2.width,
|
|
4711
|
+
height: rect2.height,
|
|
3923
4712
|
href: chart.fillImage.url,
|
|
3924
4713
|
style: {
|
|
3925
4714
|
blur,
|
|
3926
|
-
saturate:
|
|
4715
|
+
saturate: chunkKXYSO6GC_cjs.finite(chart.config?.barGlassSaturation, 1),
|
|
3927
4716
|
clip: { type: "path", d },
|
|
3928
4717
|
pointerEvents: "none"
|
|
3929
4718
|
}
|
|
@@ -3974,8 +4763,8 @@ function createBarGlowNode(context, id, d, color, glow, bounds = context.bounds)
|
|
|
3974
4763
|
bounds,
|
|
3975
4764
|
d,
|
|
3976
4765
|
style: {
|
|
3977
|
-
fill:
|
|
3978
|
-
shadow: { color:
|
|
4766
|
+
fill: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id),
|
|
4767
|
+
shadow: { color: chunkKXYSO6GC_cjs.representativeColor(color, "#ffffff"), opacity: 0.9, blur: glow, dx: 0, dy: 0 },
|
|
3979
4768
|
pointerEvents: "none"
|
|
3980
4769
|
}
|
|
3981
4770
|
};
|
|
@@ -3986,14 +4775,14 @@ function barLabelsEnabled(context) {
|
|
|
3986
4775
|
return context.chart.config?.showBarLabels === true;
|
|
3987
4776
|
}
|
|
3988
4777
|
function resolvePlacement(target, size) {
|
|
3989
|
-
const fits = target.frame.height >= size.height +
|
|
4778
|
+
const fits = target.frame.height >= size.height + chunkKXYSO6GC_cjs.BAR_LABEL.gap * 2;
|
|
3990
4779
|
return target.placement !== "outside" && !fits ? "outside" : target.placement;
|
|
3991
4780
|
}
|
|
3992
4781
|
function labelTop(placement, frame, height) {
|
|
3993
4782
|
if (placement === "outside") {
|
|
3994
|
-
return frame.y - height -
|
|
4783
|
+
return frame.y - height - chunkKXYSO6GC_cjs.BAR_LABEL.gap;
|
|
3995
4784
|
}
|
|
3996
|
-
return placement === "inside" ? frame.y +
|
|
4785
|
+
return placement === "inside" ? frame.y + chunkKXYSO6GC_cjs.BAR_LABEL.gap : frame.y + frame.height / 2 - height / 2;
|
|
3997
4786
|
}
|
|
3998
4787
|
function createPillNode(context, id, box, color) {
|
|
3999
4788
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
@@ -4003,11 +4792,11 @@ function createPillNode(context, id, box, color) {
|
|
|
4003
4792
|
id: `${id}-pill`,
|
|
4004
4793
|
order: nextOrder(),
|
|
4005
4794
|
bounds,
|
|
4006
|
-
d:
|
|
4795
|
+
d: chunkKXYSO6GC_cjs.pillPath(box.left, box.top, box.width, box.height),
|
|
4007
4796
|
style: {
|
|
4008
|
-
fill: config?.barLabelPillColor ?
|
|
4009
|
-
stroke:
|
|
4010
|
-
strokeWidth:
|
|
4797
|
+
fill: config?.barLabelPillColor ? chunkKXYSO6GC_cjs.paint(config.barLabelPillColor, diagnostics, chart.id) : { kind: "none" },
|
|
4798
|
+
stroke: chunkKXYSO6GC_cjs.paint(config?.barLabelBorderColor ?? color, diagnostics, chart.id),
|
|
4799
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(config?.barLabelBorderWidth, 1),
|
|
4011
4800
|
pointerEvents: "none"
|
|
4012
4801
|
}
|
|
4013
4802
|
};
|
|
@@ -4016,7 +4805,7 @@ function createTextNode(context, id, box, text, placement, fontSize, color) {
|
|
|
4016
4805
|
const { chart, bounds, nextOrder } = context;
|
|
4017
4806
|
const config = chart.config;
|
|
4018
4807
|
return {
|
|
4019
|
-
...
|
|
4808
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
4020
4809
|
id,
|
|
4021
4810
|
order: nextOrder(),
|
|
4022
4811
|
bounds,
|
|
@@ -4037,7 +4826,7 @@ function createAxisValueNode(context, target, text, fontSize) {
|
|
|
4037
4826
|
const config = chart.config;
|
|
4038
4827
|
const top = plot.y + plot.height + 4 + 16 + Math.max(0, chart.tickLength ?? 0);
|
|
4039
4828
|
return {
|
|
4040
|
-
...
|
|
4829
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
4041
4830
|
id: target.id,
|
|
4042
4831
|
order: nextOrder(),
|
|
4043
4832
|
bounds,
|
|
@@ -4046,7 +4835,7 @@ function createAxisValueNode(context, target, text, fontSize) {
|
|
|
4046
4835
|
y: target.frame.y + target.frame.height / 2 - fontSize * 0.6,
|
|
4047
4836
|
width: plot.width - 14,
|
|
4048
4837
|
height: fontSize * 1.2
|
|
4049
|
-
} : { x: plot.x, y: target.frame.y -
|
|
4838
|
+
} : { x: plot.x, y: target.frame.y - chunkKXYSO6GC_cjs.CATEGORY_LABEL_ROW, width: plot.width, height: fontSize * 1.2 } : { x: target.frame.x, y: top, width: target.frame.width, height: fontSize * 1.2 },
|
|
4050
4839
|
text,
|
|
4051
4840
|
chart,
|
|
4052
4841
|
align: target.horizontal ? "right" : chart.categoryAlign === "left" ? "left" : "center"
|
|
@@ -4060,24 +4849,24 @@ function createAxisValueNode(context, target, text, fontSize) {
|
|
|
4060
4849
|
}
|
|
4061
4850
|
function horizontalPlacement(target, size) {
|
|
4062
4851
|
const requested = target.placement === "axis" ? "outside" : target.placement;
|
|
4063
|
-
const fits = target.frame.width >= size.width +
|
|
4852
|
+
const fits = target.frame.width >= size.width + chunkKXYSO6GC_cjs.BAR_LABEL.gap * 2;
|
|
4064
4853
|
return requested !== "outside" && !fits ? "outside" : requested;
|
|
4065
4854
|
}
|
|
4066
4855
|
function horizontalBox(target, size, placement) {
|
|
4067
4856
|
const { frame } = target;
|
|
4068
|
-
const left = placement === "outside" ? frame.x + frame.width +
|
|
4857
|
+
const left = placement === "outside" ? frame.x + frame.width + chunkKXYSO6GC_cjs.BAR_LABEL.gap : placement === "inside" ? frame.x + frame.width - size.width - chunkKXYSO6GC_cjs.BAR_LABEL.gap : frame.x + frame.width / 2 - size.width / 2;
|
|
4069
4858
|
return { ...size, left, top: frame.y + frame.height / 2 - size.height / 2 };
|
|
4070
4859
|
}
|
|
4071
4860
|
function createBarLabelNodes(context, target) {
|
|
4072
4861
|
const { chart } = context;
|
|
4073
4862
|
const config = chart.config;
|
|
4074
|
-
const fontSize = Math.max(8,
|
|
4075
|
-
const text =
|
|
4863
|
+
const fontSize = Math.max(8, chunkKXYSO6GC_cjs.finite(config?.barLabelFontSize, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12)));
|
|
4864
|
+
const text = chunkKXYSO6GC_cjs.formatBarLabel(target.value, config?.barLabelFormat);
|
|
4076
4865
|
if (target.placement === "axis") {
|
|
4077
4866
|
return [createAxisValueNode(context, target, text, fontSize)];
|
|
4078
4867
|
}
|
|
4079
4868
|
const pill = config?.barLabelPill === true;
|
|
4080
|
-
const size =
|
|
4869
|
+
const size = chunkKXYSO6GC_cjs.barLabelSize(text, fontSize, pill);
|
|
4081
4870
|
const placement = target.horizontal ? horizontalPlacement(target, size) : resolvePlacement(target, size);
|
|
4082
4871
|
const box = target.horizontal ? horizontalBox(target, size, placement) : {
|
|
4083
4872
|
...size,
|
|
@@ -4118,7 +4907,7 @@ function barTrackClip(context, frame) {
|
|
|
4118
4907
|
}
|
|
4119
4908
|
return {
|
|
4120
4909
|
type: "path",
|
|
4121
|
-
d:
|
|
4910
|
+
d: chunkKXYSO6GC_cjs.roundedBarPath(frame.x, frame.y, frame.width, frame.height, context.chart.config?.barCornerRadius ?? 2)
|
|
4122
4911
|
};
|
|
4123
4912
|
}
|
|
4124
4913
|
function barTrackEnabled(context) {
|
|
@@ -4128,8 +4917,8 @@ function createBarTrackNodes(context, id, frame, orientation = "vertical") {
|
|
|
4128
4917
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
4129
4918
|
const config = chart.config;
|
|
4130
4919
|
const radius = config?.barCornerRadius ?? 2;
|
|
4131
|
-
const segments =
|
|
4132
|
-
const d = segments > 0 ?
|
|
4920
|
+
const segments = chunkKXYSO6GC_cjs.finite(config?.barSegments, 0);
|
|
4921
|
+
const d = segments > 0 ? chunkKXYSO6GC_cjs.segmentedBarPath(frame, orientation, segments, chunkKXYSO6GC_cjs.finite(config?.barSegmentGap, 4), radius, 1, true) : chunkKXYSO6GC_cjs.roundedBarPath(frame.x, frame.y, frame.width, frame.height, radius);
|
|
4133
4922
|
const nodes = [
|
|
4134
4923
|
{
|
|
4135
4924
|
type: "path",
|
|
@@ -4138,7 +4927,7 @@ function createBarTrackNodes(context, id, frame, orientation = "vertical") {
|
|
|
4138
4927
|
bounds,
|
|
4139
4928
|
d,
|
|
4140
4929
|
style: {
|
|
4141
|
-
fill:
|
|
4930
|
+
fill: chunkKXYSO6GC_cjs.paint(config?.barTrackColor ?? chart.gridColor ?? "#e2e8f0", diagnostics, chart.id),
|
|
4142
4931
|
pointerEvents: "none"
|
|
4143
4932
|
}
|
|
4144
4933
|
}
|
|
@@ -4154,13 +4943,13 @@ function createBarTrackNodes(context, id, frame, orientation = "vertical") {
|
|
|
4154
4943
|
frame.y,
|
|
4155
4944
|
frame.width,
|
|
4156
4945
|
frame.height,
|
|
4157
|
-
|
|
4158
|
-
Math.max(MIN_HATCH_SPACING,
|
|
4946
|
+
chunkKXYSO6GC_cjs.finite(config.barTrackHatchAngle, DEFAULT_HATCH.angle),
|
|
4947
|
+
Math.max(MIN_HATCH_SPACING, chunkKXYSO6GC_cjs.finite(config.barTrackHatchSpacing, DEFAULT_HATCH.spacing))
|
|
4159
4948
|
),
|
|
4160
4949
|
style: {
|
|
4161
4950
|
fill: { kind: "none" },
|
|
4162
|
-
stroke:
|
|
4163
|
-
strokeWidth:
|
|
4951
|
+
stroke: chunkKXYSO6GC_cjs.paint(config.barTrackHatchColor ?? chart.gridColor ?? "#cbd5e1", diagnostics, chart.id),
|
|
4952
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(config.barTrackHatchWidth, DEFAULT_HATCH.width),
|
|
4164
4953
|
pointerEvents: "none",
|
|
4165
4954
|
clip: { type: "path", d }
|
|
4166
4955
|
}
|
|
@@ -4207,23 +4996,23 @@ function groupedShape(context, frame) {
|
|
|
4207
4996
|
const { chart, plot } = context;
|
|
4208
4997
|
const config = chart.config;
|
|
4209
4998
|
const radius = config?.barCornerRadius ?? 2;
|
|
4210
|
-
const segments =
|
|
4999
|
+
const segments = chunkKXYSO6GC_cjs.finite(config?.barSegments, 0);
|
|
4211
5000
|
if (segments > 0) {
|
|
4212
|
-
return
|
|
5001
|
+
return chunkKXYSO6GC_cjs.segmentedBarPath(
|
|
4213
5002
|
{ x: frame.x, y: plot.y, width: frame.width, height: plot.height },
|
|
4214
5003
|
"vertical",
|
|
4215
5004
|
segments,
|
|
4216
|
-
|
|
5005
|
+
chunkKXYSO6GC_cjs.finite(config?.barSegmentGap, 4),
|
|
4217
5006
|
radius,
|
|
4218
5007
|
frame.height / plot.height,
|
|
4219
5008
|
config?.barSegmentSnap !== false
|
|
4220
5009
|
);
|
|
4221
5010
|
}
|
|
4222
|
-
return
|
|
5011
|
+
return chunkKXYSO6GC_cjs.barPath(frame.x, frame.y, frame.width, frame.height, radius, config?.barRoundedBottom === true);
|
|
4223
5012
|
}
|
|
4224
5013
|
function createGroupedGlow(context, mark) {
|
|
4225
5014
|
const { chart } = context;
|
|
4226
|
-
const glow =
|
|
5015
|
+
const glow = chunkKXYSO6GC_cjs.finite(chart.config?.barGlow, 0);
|
|
4227
5016
|
if (glow <= 0 || mark.frame.height <= 0) {
|
|
4228
5017
|
return [];
|
|
4229
5018
|
}
|
|
@@ -4234,10 +5023,10 @@ function createGroupedGlow(context, mark) {
|
|
|
4234
5023
|
}
|
|
4235
5024
|
function createGroupedBarLayout(context) {
|
|
4236
5025
|
const { chart, plot } = context;
|
|
4237
|
-
const valueCount =
|
|
5026
|
+
const valueCount = chunkKXYSO6GC_cjs.barCategoryCount(chart);
|
|
4238
5027
|
const slotWidth = plot.width / valueCount;
|
|
4239
|
-
const groupGap = Math.min(Math.max(0,
|
|
4240
|
-
const barGap = Math.max(0,
|
|
5028
|
+
const groupGap = Math.min(Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barGroupGap, 8)), Math.max(0, slotWidth - 1));
|
|
5029
|
+
const barGap = Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barGap, 2));
|
|
4241
5030
|
return {
|
|
4242
5031
|
slotWidth,
|
|
4243
5032
|
seriesWidth: Math.max(1, (slotWidth - groupGap) / Math.max(1, chart.series.length)),
|
|
@@ -4247,10 +5036,10 @@ function createGroupedBarLayout(context) {
|
|
|
4247
5036
|
}
|
|
4248
5037
|
function createSeriesBarMarks(context, layout, series, seriesIndex) {
|
|
4249
5038
|
const { chart, plot } = context;
|
|
4250
|
-
const seriesColor2 = series.color ??
|
|
5039
|
+
const seriesColor2 = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
4251
5040
|
return series.values.map((value, valueIndex) => {
|
|
4252
5041
|
const numericValue = Array.isArray(value) ? value[1] : value;
|
|
4253
|
-
const height = Math.max(0,
|
|
5042
|
+
const height = Math.max(0, chunkKXYSO6GC_cjs.mapChartValue(numericValue, chart.axisY, plot.height));
|
|
4254
5043
|
return {
|
|
4255
5044
|
seriesId: series.id,
|
|
4256
5045
|
valueIndex,
|
|
@@ -4284,10 +5073,10 @@ function createGroupedBarNodes(context, mark) {
|
|
|
4284
5073
|
const radius = chart.config?.barCornerRadius ?? 2;
|
|
4285
5074
|
const { x, width } = mark.frame;
|
|
4286
5075
|
const path = groupedShape(context, mark.frame);
|
|
4287
|
-
const fill2 =
|
|
4288
|
-
const stroke =
|
|
4289
|
-
const strokeWidth =
|
|
4290
|
-
const shadow =
|
|
5076
|
+
const fill2 = chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id);
|
|
5077
|
+
const stroke = chunkKXYSO6GC_cjs.paint(chart.config?.barBorderColor || "#000000", diagnostics, chart.id);
|
|
5078
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(chart.config?.barBorderWidth, 0);
|
|
5079
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
4291
5080
|
const shadowCaster = shadow ? {
|
|
4292
5081
|
type: "path",
|
|
4293
5082
|
id: `chart-bar-shadow-${chart.id}-${mark.seriesId}-${mark.valueIndex}`,
|
|
@@ -4317,10 +5106,10 @@ function createGroupedBarNodes(context, mark) {
|
|
|
4317
5106
|
valueIndex: mark.valueIndex,
|
|
4318
5107
|
mark: "bar",
|
|
4319
5108
|
radius,
|
|
4320
|
-
colorProp:
|
|
5109
|
+
colorProp: chunkKXYSO6GC_cjs.seriesValueColorProp(mark.seriesId, mark.valueIndex),
|
|
4321
5110
|
hasColorOverride: mark.hasColorOverride
|
|
4322
5111
|
},
|
|
4323
|
-
prop:
|
|
5112
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(mark.seriesId, mark.valueIndex),
|
|
4324
5113
|
style: { fill: fill2, stroke, strokeWidth, innerShadow: shadow }
|
|
4325
5114
|
};
|
|
4326
5115
|
const glass = createGlassBackdropNodes(context, `${mark.seriesId}-${mark.valueIndex}`, path);
|
|
@@ -4331,15 +5120,15 @@ function createGroupedBarError(context, mark) {
|
|
|
4331
5120
|
return null;
|
|
4332
5121
|
}
|
|
4333
5122
|
const { chart, plot, bounds, nextOrder } = context;
|
|
4334
|
-
const [lower, upper] =
|
|
4335
|
-
return
|
|
5123
|
+
const [lower, upper] = chunkKXYSO6GC_cjs.errorBarRange(mark.value, mark.error);
|
|
5124
|
+
return chunkKXYSO6GC_cjs.createVerticalErrorWhiskerNode({
|
|
4336
5125
|
id: `chart-bar-error-${chart.id}-${mark.seriesId}-${mark.valueIndex}`,
|
|
4337
5126
|
order: nextOrder(),
|
|
4338
5127
|
bounds,
|
|
4339
5128
|
geometry: {
|
|
4340
5129
|
centerX: mark.frame.x + mark.frame.width / 2,
|
|
4341
|
-
startY: plot.y + plot.height -
|
|
4342
|
-
endY: plot.y + plot.height -
|
|
5130
|
+
startY: plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(lower, chart.axisY, plot.height),
|
|
5131
|
+
endY: plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(upper, chart.axisY, plot.height)
|
|
4343
5132
|
},
|
|
4344
5133
|
color: chart.textColor ?? "#0f172a",
|
|
4345
5134
|
valueReference: { seriesId: mark.seriesId, valueIndex: mark.valueIndex }
|
|
@@ -4349,9 +5138,9 @@ function createGroupedBarError(context, mark) {
|
|
|
4349
5138
|
// src/renderScene/charts/renderers/bar/horizontal.ts
|
|
4350
5139
|
function barFrame(context, rows, seriesIndex, valueIndex, value) {
|
|
4351
5140
|
const { chart, plot } = context;
|
|
4352
|
-
const top =
|
|
5141
|
+
const top = chunkKXYSO6GC_cjs.rowTop(rows, plot, valueIndex) + rows.labelRow;
|
|
4353
5142
|
if (context.stackedMode) {
|
|
4354
|
-
const segment =
|
|
5143
|
+
const segment = chunkKXYSO6GC_cjs.stackedSegment(chart, context.stackedMode, valueIndex, seriesIndex, plot.width);
|
|
4355
5144
|
const start = Math.min(segment.pixelStart, segment.pixelEnd);
|
|
4356
5145
|
return {
|
|
4357
5146
|
x: plot.x + start,
|
|
@@ -4360,27 +5149,27 @@ function barFrame(context, rows, seriesIndex, valueIndex, value) {
|
|
|
4360
5149
|
height: rows.barsHeight
|
|
4361
5150
|
};
|
|
4362
5151
|
}
|
|
4363
|
-
const barGap = Math.max(0,
|
|
5152
|
+
const barGap = Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barGap, 2));
|
|
4364
5153
|
const seriesHeight = rows.barsHeight / Math.max(1, chart.series.length);
|
|
4365
|
-
const width = Math.max(0,
|
|
5154
|
+
const width = Math.max(0, chunkKXYSO6GC_cjs.mapChartValue(value, chart.axisY, plot.width));
|
|
4366
5155
|
return { x: plot.x, y: top + seriesIndex * seriesHeight, width, height: Math.max(1, seriesHeight - barGap) };
|
|
4367
5156
|
}
|
|
4368
5157
|
function barPath2(context, frame) {
|
|
4369
5158
|
const { chart, plot } = context;
|
|
4370
5159
|
const config = chart.config;
|
|
4371
|
-
const segments = context.stackedMode && chart.series.length > 1 ? 0 :
|
|
5160
|
+
const segments = context.stackedMode && chart.series.length > 1 ? 0 : chunkKXYSO6GC_cjs.finite(config?.barSegments, 0);
|
|
4372
5161
|
if (segments > 0) {
|
|
4373
|
-
return
|
|
5162
|
+
return chunkKXYSO6GC_cjs.segmentedBarPath(
|
|
4374
5163
|
{ x: plot.x, y: frame.y, width: plot.width, height: frame.height },
|
|
4375
5164
|
"horizontal",
|
|
4376
5165
|
segments,
|
|
4377
|
-
|
|
5166
|
+
chunkKXYSO6GC_cjs.finite(config?.barSegmentGap, 4),
|
|
4378
5167
|
config?.barCornerRadius ?? 2,
|
|
4379
5168
|
frame.width / plot.width,
|
|
4380
5169
|
config?.barSegmentSnap !== false
|
|
4381
5170
|
);
|
|
4382
5171
|
}
|
|
4383
|
-
return
|
|
5172
|
+
return chunkKXYSO6GC_cjs.roundedBarPath(frame.x, frame.y, frame.width, frame.height, config?.barCornerRadius ?? 2);
|
|
4384
5173
|
}
|
|
4385
5174
|
function markOf(context, rows, series, seriesIndex, valueIndex, value) {
|
|
4386
5175
|
const { plot } = context;
|
|
@@ -4400,16 +5189,16 @@ function markOf(context, rows, series, seriesIndex, valueIndex, value) {
|
|
|
4400
5189
|
maxY: frame.y + frame.height
|
|
4401
5190
|
},
|
|
4402
5191
|
path: barPath2(context, frame),
|
|
4403
|
-
color: series.colors?.[valueIndex] ?? series.color ??
|
|
5192
|
+
color: series.colors?.[valueIndex] ?? series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length]
|
|
4404
5193
|
};
|
|
4405
5194
|
}
|
|
4406
5195
|
function barNodes(context, mark) {
|
|
4407
5196
|
const { chart, diagnostics, nextOrder } = context;
|
|
4408
5197
|
const config = chart.config;
|
|
4409
|
-
const stroke =
|
|
4410
|
-
const strokeWidth =
|
|
4411
|
-
const shadow =
|
|
4412
|
-
const fill2 =
|
|
5198
|
+
const stroke = chunkKXYSO6GC_cjs.paint(config?.barBorderColor || "#000000", diagnostics, chart.id);
|
|
5199
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(config?.barBorderWidth, 0);
|
|
5200
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
5201
|
+
const fill2 = chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id);
|
|
4413
5202
|
const nodes = [...createGlassBackdropNodes(context, mark.id, mark.path)];
|
|
4414
5203
|
if (shadow) {
|
|
4415
5204
|
nodes.push({
|
|
@@ -4433,7 +5222,7 @@ function barNodes(context, mark) {
|
|
|
4433
5222
|
valueIndex: mark.valueIndex,
|
|
4434
5223
|
mark: "bar",
|
|
4435
5224
|
radius: config?.barCornerRadius ?? 2,
|
|
4436
|
-
colorProp:
|
|
5225
|
+
colorProp: chunkKXYSO6GC_cjs.seriesValueColorProp(mark.series.id, mark.valueIndex),
|
|
4437
5226
|
hasColorOverride: mark.series.colors?.[mark.valueIndex] != null
|
|
4438
5227
|
},
|
|
4439
5228
|
style: { fill: fill2, stroke, strokeWidth, innerShadow: shadow }
|
|
@@ -4463,7 +5252,7 @@ function pushBar(context, rows, layers, series, seriesIndex, valueIndex, value,
|
|
|
4463
5252
|
layers.tracks.push(...createBarTrackNodes(context, mark.id, mark.trackFrame, "horizontal"));
|
|
4464
5253
|
}
|
|
4465
5254
|
layers.bars.push(...barNodes(context, mark));
|
|
4466
|
-
const glow =
|
|
5255
|
+
const glow = chunkKXYSO6GC_cjs.finite(chart.config?.barGlow, 0);
|
|
4467
5256
|
if (glow > 0 && mark.frame.width > 0) {
|
|
4468
5257
|
layers.glows.push(
|
|
4469
5258
|
createBarGlowNode(context, `chart-bar-glow-${chart.id}-${mark.id}`, mark.path, mark.color, glow, mark.bounds)
|
|
@@ -4472,7 +5261,7 @@ function pushBar(context, rows, layers, series, seriesIndex, valueIndex, value,
|
|
|
4472
5261
|
layers.labels.push(...labelNodes2(context, mark, highest));
|
|
4473
5262
|
}
|
|
4474
5263
|
function renderHorizontalBars(context) {
|
|
4475
|
-
const rows =
|
|
5264
|
+
const rows = chunkKXYSO6GC_cjs.horizontalRows(context.chart, context.plot);
|
|
4476
5265
|
const layers = { tracks: [], bars: [], glows: [], labels: [] };
|
|
4477
5266
|
context.chart.series.forEach((series, seriesIndex) => {
|
|
4478
5267
|
const numeric = series.values.map((value) => typeof value === "number" ? value : value[1]);
|
|
@@ -4487,8 +5276,8 @@ function renderHorizontalBars(context) {
|
|
|
4487
5276
|
// src/renderScene/charts/renderers/bar/stacked.ts
|
|
4488
5277
|
function slotOf(context, mode) {
|
|
4489
5278
|
const { chart, plot } = context;
|
|
4490
|
-
const slotWidth = plot.width /
|
|
4491
|
-
const groupGap = Math.min(Math.max(0,
|
|
5279
|
+
const slotWidth = plot.width / chunkKXYSO6GC_cjs.barCategoryCount(chart);
|
|
5280
|
+
const groupGap = Math.min(Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barGroupGap, 8)), Math.max(0, slotWidth - 1));
|
|
4492
5281
|
return {
|
|
4493
5282
|
slotWidth,
|
|
4494
5283
|
groupGap,
|
|
@@ -4499,19 +5288,19 @@ function slotOf(context, mode) {
|
|
|
4499
5288
|
}
|
|
4500
5289
|
function pathOf(context, x, y, height, slot, radius) {
|
|
4501
5290
|
const { chart, plot } = context;
|
|
4502
|
-
const segments = chart.series.length === 1 ?
|
|
5291
|
+
const segments = chart.series.length === 1 ? chunkKXYSO6GC_cjs.finite(chart.config?.barSegments, 0) : 0;
|
|
4503
5292
|
if (segments > 0) {
|
|
4504
|
-
return
|
|
5293
|
+
return chunkKXYSO6GC_cjs.segmentedBarPath(
|
|
4505
5294
|
{ x, y: plot.y, width: slot.barWidth, height: plot.height },
|
|
4506
5295
|
"vertical",
|
|
4507
5296
|
segments,
|
|
4508
|
-
|
|
5297
|
+
chunkKXYSO6GC_cjs.finite(chart.config?.barSegmentGap, 4),
|
|
4509
5298
|
radius,
|
|
4510
5299
|
height / plot.height,
|
|
4511
5300
|
chart.config?.barSegmentSnap !== false
|
|
4512
5301
|
);
|
|
4513
5302
|
}
|
|
4514
|
-
return
|
|
5303
|
+
return chunkKXYSO6GC_cjs.barPath(x, y, slot.barWidth, height, radius, chart.config?.barRoundedBottom === true);
|
|
4515
5304
|
}
|
|
4516
5305
|
function pushLabel(context, layers, series, seriesIndex, valueIndex, slot, frame) {
|
|
4517
5306
|
const { chart } = context;
|
|
@@ -4533,7 +5322,7 @@ function pushLabel(context, layers, series, seriesIndex, valueIndex, slot, frame
|
|
|
4533
5322
|
}
|
|
4534
5323
|
function markOf2(context, mode, slot, series, seriesIndex, valueIndex) {
|
|
4535
5324
|
const { chart, plot } = context;
|
|
4536
|
-
const segment =
|
|
5325
|
+
const segment = chunkKXYSO6GC_cjs.stackedSegment(chart, mode, valueIndex, seriesIndex, plot.height);
|
|
4537
5326
|
const radius = slot.outerSeriesIndex === null || seriesIndex === slot.outerSeriesIndex ? slot.cornerRadius : 0;
|
|
4538
5327
|
const x = plot.x + valueIndex * slot.slotWidth + slot.groupGap / 2;
|
|
4539
5328
|
const y = plot.y + plot.height - Math.max(segment.pixelStart, segment.pixelEnd);
|
|
@@ -4542,7 +5331,7 @@ function markOf2(context, mode, slot, series, seriesIndex, valueIndex) {
|
|
|
4542
5331
|
series,
|
|
4543
5332
|
valueIndex,
|
|
4544
5333
|
radius,
|
|
4545
|
-
color: series.colors?.[valueIndex] ?? series.color ??
|
|
5334
|
+
color: series.colors?.[valueIndex] ?? series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length],
|
|
4546
5335
|
x,
|
|
4547
5336
|
y,
|
|
4548
5337
|
height,
|
|
@@ -4553,10 +5342,10 @@ function markOf2(context, mode, slot, series, seriesIndex, valueIndex) {
|
|
|
4553
5342
|
function segmentNodes(context, mark) {
|
|
4554
5343
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
4555
5344
|
const { series, valueIndex, path } = mark;
|
|
4556
|
-
const fill2 =
|
|
4557
|
-
const stroke =
|
|
4558
|
-
const strokeWidth =
|
|
4559
|
-
const shadow =
|
|
5345
|
+
const fill2 = chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id);
|
|
5346
|
+
const stroke = chunkKXYSO6GC_cjs.paint(chart.config?.barBorderColor || "#000000", diagnostics, chart.id);
|
|
5347
|
+
const strokeWidth = chunkKXYSO6GC_cjs.finite(chart.config?.barBorderWidth, 0);
|
|
5348
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
4560
5349
|
const nodes = [];
|
|
4561
5350
|
if (shadow) {
|
|
4562
5351
|
const plotClip = `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z`;
|
|
@@ -4588,10 +5377,10 @@ function segmentNodes(context, mark) {
|
|
|
4588
5377
|
valueIndex,
|
|
4589
5378
|
mark: "bar",
|
|
4590
5379
|
radius: mark.radius,
|
|
4591
|
-
colorProp:
|
|
5380
|
+
colorProp: chunkKXYSO6GC_cjs.seriesValueColorProp(series.id, valueIndex),
|
|
4592
5381
|
hasColorOverride: series.colors?.[valueIndex] != null
|
|
4593
5382
|
},
|
|
4594
|
-
prop:
|
|
5383
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(series.id, valueIndex),
|
|
4595
5384
|
style: { fill: fill2, stroke, strokeWidth, innerShadow: shadow }
|
|
4596
5385
|
});
|
|
4597
5386
|
return nodes;
|
|
@@ -4605,7 +5394,7 @@ function pushSegment(context, mode, layers, slot, series, seriesIndex, valueInde
|
|
|
4605
5394
|
layers.bars.push(...segmentNodes(context, mark));
|
|
4606
5395
|
const frame = { x: mark.x, y: mark.y, width: slot.barWidth, height: mark.height };
|
|
4607
5396
|
pushLabel(context, layers, series, seriesIndex, valueIndex, slot, frame);
|
|
4608
|
-
const glow =
|
|
5397
|
+
const glow = chunkKXYSO6GC_cjs.finite(chart.config?.barGlow, 0);
|
|
4609
5398
|
if (glow > 0) {
|
|
4610
5399
|
layers.glows.push(
|
|
4611
5400
|
createBarGlowNode(context, `chart-bar-glow-${chart.id}-${series.id}-${valueIndex}`, mark.path, mark.color, glow)
|
|
@@ -4616,7 +5405,7 @@ function renderStackedBars(context, mode) {
|
|
|
4616
5405
|
const { chart } = context;
|
|
4617
5406
|
const layers = { tracks: [], bars: [], glows: [], labels: [] };
|
|
4618
5407
|
const slot = slotOf(context, mode);
|
|
4619
|
-
const valueCount =
|
|
5408
|
+
const valueCount = chunkKXYSO6GC_cjs.barCategoryCount(chart);
|
|
4620
5409
|
for (let valueIndex = 0; valueIndex < valueCount; valueIndex++) {
|
|
4621
5410
|
chart.series.forEach((series, seriesIndex) => {
|
|
4622
5411
|
pushSegment(context, mode, layers, slot, series, seriesIndex, valueIndex);
|
|
@@ -4631,7 +5420,7 @@ function isSeriesMax2(values, index) {
|
|
|
4631
5420
|
|
|
4632
5421
|
// src/renderScene/charts/renderers/bar.ts
|
|
4633
5422
|
function renderBar(context) {
|
|
4634
|
-
if (
|
|
5423
|
+
if (chunkKXYSO6GC_cjs.isHorizontalBar(context.chart)) {
|
|
4635
5424
|
return renderHorizontalBars(context);
|
|
4636
5425
|
}
|
|
4637
5426
|
if (context.stackedMode) {
|
|
@@ -4646,7 +5435,7 @@ function createBoxplotLayout(context) {
|
|
|
4646
5435
|
const orientation = chart.config?.orientation ?? "vertical";
|
|
4647
5436
|
const boxCount = Math.max(1, chart.series.length);
|
|
4648
5437
|
const slotWidth = (orientation === "horizontal" ? plot.height : plot.width) / boxCount;
|
|
4649
|
-
const borderColor =
|
|
5438
|
+
const borderColor = chunkKXYSO6GC_cjs.representativeColor(chart.config?.barBorderColor, "#000000");
|
|
4650
5439
|
const widthFraction = Math.min(1, Math.max(0.05, chart.config?.boxWidth ?? 0.6));
|
|
4651
5440
|
return {
|
|
4652
5441
|
orientation,
|
|
@@ -4655,15 +5444,15 @@ function createBoxplotLayout(context) {
|
|
|
4655
5444
|
cornerRadius: chart.config?.barCornerRadius ?? 2,
|
|
4656
5445
|
showPoints: chart.config?.showBoxplotPoints ?? true,
|
|
4657
5446
|
borderColor,
|
|
4658
|
-
borderWidth:
|
|
4659
|
-
whiskerWidth: Math.max(0,
|
|
4660
|
-
medianWidth: Math.max(0,
|
|
5447
|
+
borderWidth: chunkKXYSO6GC_cjs.finite(chart.config?.barBorderWidth, 1),
|
|
5448
|
+
whiskerWidth: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.boxWhiskerWidth, 1)),
|
|
5449
|
+
medianWidth: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.boxMedianWidth, 2)),
|
|
4661
5450
|
medianColor: chart.config?.boxMedianColor ?? borderColor,
|
|
4662
5451
|
whiskerColor: chart.config?.boxWhiskerColor,
|
|
4663
|
-
capSize: Math.max(0,
|
|
4664
|
-
pointSize: Math.max(0,
|
|
4665
|
-
pointOpacity: Math.min(1, Math.max(0,
|
|
4666
|
-
jitter: Math.max(0,
|
|
5452
|
+
capSize: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.boxCapSize, 0.4)),
|
|
5453
|
+
pointSize: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.boxPointSize, 3)),
|
|
5454
|
+
pointOpacity: Math.min(1, Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.boxPointOpacity, 0.7))),
|
|
5455
|
+
jitter: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.boxJitter, 1))
|
|
4667
5456
|
};
|
|
4668
5457
|
}
|
|
4669
5458
|
|
|
@@ -4674,7 +5463,7 @@ function boxplotPoint(orientation, center, value) {
|
|
|
4674
5463
|
function createBoxplotGeometry(context, layout, seriesIndex, stats) {
|
|
4675
5464
|
const { chart, plot } = context;
|
|
4676
5465
|
const { orientation } = layout;
|
|
4677
|
-
const valueAt = (value) => orientation === "horizontal" ? plot.x +
|
|
5466
|
+
const valueAt = (value) => orientation === "horizontal" ? plot.x + chunkKXYSO6GC_cjs.mapChartValue(value, chart.axisX, plot.width) : plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(value, chart.axisY, plot.height);
|
|
4678
5467
|
const center = plot[orientation === "horizontal" ? "y" : "x"] + seriesIndex * layout.slotWidth + layout.slotWidth / 2;
|
|
4679
5468
|
return {
|
|
4680
5469
|
center,
|
|
@@ -4689,7 +5478,7 @@ function createBoxplotGeometry(context, layout, seriesIndex, stats) {
|
|
|
4689
5478
|
// src/renderScene/charts/renderers/boxplot/points.ts
|
|
4690
5479
|
function renderSamplePoints(context, layout, mark) {
|
|
4691
5480
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
4692
|
-
const valueAt = (value) => layout.orientation === "horizontal" ? plot.x +
|
|
5481
|
+
const valueAt = (value) => layout.orientation === "horizontal" ? plot.x + chunkKXYSO6GC_cjs.mapChartValue(value, chart.axisX, plot.width) : plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(value, chart.axisY, plot.height);
|
|
4693
5482
|
if (layout.pointSize <= 0) {
|
|
4694
5483
|
return [];
|
|
4695
5484
|
}
|
|
@@ -4705,7 +5494,7 @@ function renderSamplePoints(context, layout, mark) {
|
|
|
4705
5494
|
cy: y,
|
|
4706
5495
|
rx: layout.pointSize,
|
|
4707
5496
|
ry: layout.pointSize,
|
|
4708
|
-
style: { fill:
|
|
5497
|
+
style: { fill: chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id), opacity: layout.pointOpacity }
|
|
4709
5498
|
};
|
|
4710
5499
|
});
|
|
4711
5500
|
}
|
|
@@ -4729,7 +5518,7 @@ function renderBoxAndWhiskers(context, layout, mark) {
|
|
|
4729
5518
|
}
|
|
4730
5519
|
function whiskerColor(layout, mark) {
|
|
4731
5520
|
if (layout.whiskerColor === "series") {
|
|
4732
|
-
return
|
|
5521
|
+
return chunkKXYSO6GC_cjs.representativeColor(mark.color, layout.borderColor);
|
|
4733
5522
|
}
|
|
4734
5523
|
return layout.whiskerColor;
|
|
4735
5524
|
}
|
|
@@ -4811,7 +5600,7 @@ function createBoxNode(context, layout, mark) {
|
|
|
4811
5600
|
height,
|
|
4812
5601
|
rx: layout.cornerRadius,
|
|
4813
5602
|
style: {
|
|
4814
|
-
fill:
|
|
5603
|
+
fill: chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id),
|
|
4815
5604
|
stroke: { kind: "solid", color: layout.borderColor },
|
|
4816
5605
|
strokeWidth: layout.borderWidth
|
|
4817
5606
|
}
|
|
@@ -4820,12 +5609,12 @@ function createBoxNode(context, layout, mark) {
|
|
|
4820
5609
|
|
|
4821
5610
|
// src/renderScene/charts/renderers/boxplot/series.ts
|
|
4822
5611
|
function renderBoxplotSeries(context, layout, series, seriesIndex) {
|
|
4823
|
-
const stats =
|
|
5612
|
+
const stats = chunkKXYSO6GC_cjs.computeBoxplotStats(series.values);
|
|
4824
5613
|
if (!stats) {
|
|
4825
5614
|
return [];
|
|
4826
5615
|
}
|
|
4827
5616
|
const geometry = createBoxplotGeometry(context, layout, seriesIndex, stats);
|
|
4828
|
-
const color = series.color ??
|
|
5617
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
4829
5618
|
const mark = {
|
|
4830
5619
|
id: `${context.chart.id}-${series.id}`,
|
|
4831
5620
|
series,
|
|
@@ -4887,21 +5676,21 @@ function metricComponent(chart, point) {
|
|
|
4887
5676
|
}
|
|
4888
5677
|
function customPointPosition(context, value) {
|
|
4889
5678
|
return {
|
|
4890
|
-
x: context.plot.x +
|
|
4891
|
-
y: context.plot.y + context.plot.height -
|
|
5679
|
+
x: context.plot.x + chunkKXYSO6GC_cjs.mapChartValue(value[0], context.chart.axisX, context.plot.width),
|
|
5680
|
+
y: context.plot.y + context.plot.height - chunkKXYSO6GC_cjs.mapChartValue(value[1], context.chart.axisY, context.plot.height)
|
|
4892
5681
|
};
|
|
4893
5682
|
}
|
|
4894
5683
|
function customSeriesStyle(context, series, seriesIndex) {
|
|
4895
|
-
const color = series.color ??
|
|
5684
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
4896
5685
|
return {
|
|
4897
|
-
fill:
|
|
5686
|
+
fill: chunkKXYSO6GC_cjs.paint(color, context.diagnostics, context.chart.id),
|
|
4898
5687
|
stroke: series.stroke ? { kind: "solid", color: series.stroke } : void 0,
|
|
4899
|
-
strokeWidth: series.stroke ?
|
|
5688
|
+
strokeWidth: series.stroke ? chunkKXYSO6GC_cjs.finite(series.strokeWidth, 1) : void 0
|
|
4900
5689
|
};
|
|
4901
5690
|
}
|
|
4902
5691
|
function createCustomSymbolMark(context, mark) {
|
|
4903
5692
|
const symbol = mark.series.symbol;
|
|
4904
|
-
const size =
|
|
5693
|
+
const size = chunkKXYSO6GC_cjs.finite(mark.series.size, 3);
|
|
4905
5694
|
const scale = symbol?.normalized ? size * 2 : 1;
|
|
4906
5695
|
const offset = symbol?.normalized ? 0.5 : 0;
|
|
4907
5696
|
const points = (symbol?.points ?? []).map(([x, y]) => ({
|
|
@@ -4913,12 +5702,12 @@ function createCustomSymbolMark(context, mark) {
|
|
|
4913
5702
|
id: customMarkId(context.chart, mark.series, mark.valueIndex),
|
|
4914
5703
|
order: context.nextOrder(),
|
|
4915
5704
|
bounds: context.bounds,
|
|
4916
|
-
d:
|
|
5705
|
+
d: chunkKXYSO6GC_cjs.freeformPathData({ points, tension: chunkKXYSO6GC_cjs.finite(symbol?.tension, 0), closed: true }),
|
|
4917
5706
|
style: mark.style
|
|
4918
5707
|
};
|
|
4919
5708
|
}
|
|
4920
5709
|
function createCustomPointMark(context, mark) {
|
|
4921
|
-
const radius =
|
|
5710
|
+
const radius = chunkKXYSO6GC_cjs.finite(mark.series.size, 3);
|
|
4922
5711
|
return {
|
|
4923
5712
|
type: "ellipse",
|
|
4924
5713
|
id: customMarkId(context.chart, mark.series, mark.valueIndex),
|
|
@@ -4942,7 +5731,7 @@ function renderConnectedPairs(context) {
|
|
|
4942
5731
|
const zones = chart.config?.zones ?? [];
|
|
4943
5732
|
const betterColor = zones[0]?.color ?? "#10b981";
|
|
4944
5733
|
const worseColor = zones[1]?.color ?? "#ec4899";
|
|
4945
|
-
const tieColor = zones[2]?.color ??
|
|
5734
|
+
const tieColor = zones[2]?.color ?? chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL;
|
|
4946
5735
|
const reverse = Boolean(chart.config?.reverseComparison);
|
|
4947
5736
|
const count = Math.min(beforeValues.length, afterValues.length);
|
|
4948
5737
|
const categories = chart.config?.categories ?? [];
|
|
@@ -4957,7 +5746,7 @@ function renderConnectedPairs(context) {
|
|
|
4957
5746
|
const better = reverse ? afterMetric < beforeMetric : afterMetric > beforeMetric;
|
|
4958
5747
|
const worse = reverse ? afterMetric > beforeMetric : afterMetric < beforeMetric;
|
|
4959
5748
|
const comparisonColor = better ? betterColor : worse ? worseColor : tieColor;
|
|
4960
|
-
const radius =
|
|
5749
|
+
const radius = chunkKXYSO6GC_cjs.finite(afterSeries.size, 3);
|
|
4961
5750
|
nodes.push(createConnectorLine(context, index, beforePoint, afterPoint, comparisonColor));
|
|
4962
5751
|
nodes.push(
|
|
4963
5752
|
createCustomPointMark(context, {
|
|
@@ -4965,9 +5754,9 @@ function renderConnectedPairs(context) {
|
|
|
4965
5754
|
valueIndex: index,
|
|
4966
5755
|
point: beforePoint,
|
|
4967
5756
|
style: {
|
|
4968
|
-
fill:
|
|
5757
|
+
fill: chunkKXYSO6GC_cjs.paint(chart.config?.customBeforeFill ?? chart.gridColor ?? "#e2e8f0", context.diagnostics, chart.id),
|
|
4969
5758
|
stroke: { kind: "solid", color: chart.config?.customBeforeStroke ?? HOLLOW_POINT_STROKE },
|
|
4970
|
-
strokeWidth:
|
|
5759
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.config?.customBeforeStrokeWidth, 1.5)
|
|
4971
5760
|
}
|
|
4972
5761
|
})
|
|
4973
5762
|
);
|
|
@@ -4977,7 +5766,7 @@ function renderConnectedPairs(context) {
|
|
|
4977
5766
|
valueIndex: index,
|
|
4978
5767
|
point: afterPoint,
|
|
4979
5768
|
style: {
|
|
4980
|
-
fill:
|
|
5769
|
+
fill: chunkKXYSO6GC_cjs.paint(comparisonColor, context.diagnostics, chart.id),
|
|
4981
5770
|
stroke: void 0,
|
|
4982
5771
|
strokeWidth: void 0
|
|
4983
5772
|
}
|
|
@@ -5004,7 +5793,7 @@ function createConnectorLine(context, index, from, to, color) {
|
|
|
5004
5793
|
style: {
|
|
5005
5794
|
fill: { kind: "none" },
|
|
5006
5795
|
stroke: { kind: "solid", color },
|
|
5007
|
-
strokeWidth:
|
|
5796
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.config?.customConnectorWidth, 2),
|
|
5008
5797
|
opacity: chart.config?.customConnectorOpacity,
|
|
5009
5798
|
dash: connectorDash(chart.config?.customConnectorDash)
|
|
5010
5799
|
}
|
|
@@ -5025,7 +5814,7 @@ function createConnectorLabel(context, index, beforePoint, afterPoint, radius, t
|
|
|
5025
5814
|
height: 16
|
|
5026
5815
|
};
|
|
5027
5816
|
return {
|
|
5028
|
-
...
|
|
5817
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
5029
5818
|
id: `chart-custom-label-${chart.id}-${index}`,
|
|
5030
5819
|
order: nextOrder(),
|
|
5031
5820
|
bounds,
|
|
@@ -5034,7 +5823,7 @@ function createConnectorLabel(context, index, beforePoint, afterPoint, radius, t
|
|
|
5034
5823
|
chart,
|
|
5035
5824
|
align: horizontal ? "left" : "center"
|
|
5036
5825
|
}),
|
|
5037
|
-
fontSize: Math.max(6,
|
|
5826
|
+
fontSize: Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.customLabelSize, Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12)) - 2)),
|
|
5038
5827
|
...chart.config?.customLabelColor ? { color: chart.config.customLabelColor } : {}
|
|
5039
5828
|
};
|
|
5040
5829
|
}
|
|
@@ -5046,8 +5835,8 @@ function classifyFieldData(context) {
|
|
|
5046
5835
|
const vectorSeries = chart.series.filter((series) => tupleSize(series.values[0]) === 4);
|
|
5047
5836
|
const scalarSamples = scalarSeries.flatMap(
|
|
5048
5837
|
(series) => series.values.map(([x, y, value]) => ({
|
|
5049
|
-
x:
|
|
5050
|
-
y: plot.height -
|
|
5838
|
+
x: chunkKXYSO6GC_cjs.mapChartValue(x, chart.axisX, plot.width),
|
|
5839
|
+
y: plot.height - chunkKXYSO6GC_cjs.mapChartValue(y, chart.axisY, plot.height),
|
|
5051
5840
|
value
|
|
5052
5841
|
}))
|
|
5053
5842
|
);
|
|
@@ -5111,20 +5900,20 @@ function createLegendLabels(context, minimum, maximum, geometry) {
|
|
|
5111
5900
|
const { chart, bounds, nextOrder } = context;
|
|
5112
5901
|
const y = geometry.y + geometry.height + 3;
|
|
5113
5902
|
return [
|
|
5114
|
-
|
|
5903
|
+
chunkKXYSO6GC_cjs.chartText({
|
|
5115
5904
|
id: `chart-field-colorbar-min-${chart.id}`,
|
|
5116
5905
|
order: nextOrder(),
|
|
5117
5906
|
bounds,
|
|
5118
5907
|
frame: { x: geometry.x, y, width: 80, height: 16 },
|
|
5119
|
-
text:
|
|
5908
|
+
text: chunkKXYSO6GC_cjs.formatFieldValue(minimum),
|
|
5120
5909
|
chart
|
|
5121
5910
|
}),
|
|
5122
|
-
|
|
5911
|
+
chunkKXYSO6GC_cjs.chartText({
|
|
5123
5912
|
id: `chart-field-colorbar-max-${chart.id}`,
|
|
5124
5913
|
order: nextOrder(),
|
|
5125
5914
|
bounds,
|
|
5126
5915
|
frame: { x: geometry.x + geometry.width - 80, y, width: 80, height: 16 },
|
|
5127
|
-
text:
|
|
5916
|
+
text: chunkKXYSO6GC_cjs.formatFieldValue(maximum),
|
|
5128
5917
|
chart,
|
|
5129
5918
|
align: "right"
|
|
5130
5919
|
})
|
|
@@ -5137,7 +5926,7 @@ function colorAtRamp(ramp, value) {
|
|
|
5137
5926
|
if (!ramp?.stops.length) {
|
|
5138
5927
|
return RAMP_FALLBACK_COLOR;
|
|
5139
5928
|
}
|
|
5140
|
-
return
|
|
5929
|
+
return chunkKXYSO6GC_cjs.interpolateHexColorStops(ramp.stops, value);
|
|
5141
5930
|
}
|
|
5142
5931
|
|
|
5143
5932
|
// src/renderScene/charts/field/isolines.ts
|
|
@@ -5347,7 +6136,7 @@ function createIsoline(context, grid, threshold, thresholdIndex) {
|
|
|
5347
6136
|
}
|
|
5348
6137
|
const chains = stitchIsolineSegments(segments);
|
|
5349
6138
|
const path = chains.map(
|
|
5350
|
-
(chain) =>
|
|
6139
|
+
(chain) => chunkKXYSO6GC_cjs.linePathData(
|
|
5351
6140
|
chain.map(([x, y]) => ({ x: plot.x + x, y: plot.y + y })),
|
|
5352
6141
|
ISOLINE_TENSION
|
|
5353
6142
|
)
|
|
@@ -5371,7 +6160,7 @@ function createIsoline(context, grid, threshold, thresholdIndex) {
|
|
|
5371
6160
|
function renderVectorField(context, seriesList) {
|
|
5372
6161
|
const nodes = [];
|
|
5373
6162
|
seriesList.forEach((series, seriesIndex) => {
|
|
5374
|
-
const color = series.color ??
|
|
6163
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
5375
6164
|
series.values.forEach((vector, vectorIndex) => {
|
|
5376
6165
|
nodes.push(createVectorNode(context, series.id, vector, vectorIndex, color));
|
|
5377
6166
|
});
|
|
@@ -5381,10 +6170,10 @@ function renderVectorField(context, seriesList) {
|
|
|
5381
6170
|
function createVectorNode(context, seriesId, vector, vectorIndex, color) {
|
|
5382
6171
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
5383
6172
|
const [x, y, angle, magnitude] = vector;
|
|
5384
|
-
const startX = plot.x +
|
|
5385
|
-
const startY = plot.y + plot.height -
|
|
5386
|
-
const endX = plot.x +
|
|
5387
|
-
const endY = plot.y + plot.height -
|
|
6173
|
+
const startX = plot.x + chunkKXYSO6GC_cjs.mapChartValue(x, chart.axisX, plot.width);
|
|
6174
|
+
const startY = plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(y, chart.axisY, plot.height);
|
|
6175
|
+
const endX = plot.x + chunkKXYSO6GC_cjs.mapChartValue(x + Math.cos(angle) * magnitude, chart.axisX, plot.width);
|
|
6176
|
+
const endY = plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(y + Math.sin(angle) * magnitude, chart.axisY, plot.height);
|
|
5388
6177
|
return {
|
|
5389
6178
|
type: "path",
|
|
5390
6179
|
id: `chart-field-vector-${chart.id}-${seriesId}-${vectorIndex}`,
|
|
@@ -5394,7 +6183,7 @@ function createVectorNode(context, seriesId, vector, vectorIndex, color) {
|
|
|
5394
6183
|
markerEnd: "filled_arrow",
|
|
5395
6184
|
style: {
|
|
5396
6185
|
fill: { kind: "none" },
|
|
5397
|
-
stroke:
|
|
6186
|
+
stroke: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id),
|
|
5398
6187
|
strokeWidth: 2
|
|
5399
6188
|
}
|
|
5400
6189
|
};
|
|
@@ -5441,7 +6230,7 @@ function createHeatmapCell(layout, series, rowIndex, columnIndex) {
|
|
|
5441
6230
|
};
|
|
5442
6231
|
}
|
|
5443
6232
|
function colorForValue(value, layout) {
|
|
5444
|
-
return
|
|
6233
|
+
return chunkKXYSO6GC_cjs.zoneColorAtValue(value, layout.bands, layout.zones);
|
|
5445
6234
|
}
|
|
5446
6235
|
function renderHeatmapCell(context, layout, cell) {
|
|
5447
6236
|
const background = createCellBackground(context, layout, cell);
|
|
@@ -5456,7 +6245,7 @@ function createCellBackground(context, layout, cell) {
|
|
|
5456
6245
|
const style = {
|
|
5457
6246
|
fill: { kind: "solid", color: cell.color },
|
|
5458
6247
|
stroke: { kind: "solid", color: chart.config?.cellStrokeColor ?? chart.gridColor ?? "#e2e8f0" },
|
|
5459
|
-
strokeWidth:
|
|
6248
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.config?.cellStrokeWidth, chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1))
|
|
5460
6249
|
};
|
|
5461
6250
|
if (chart.config?.cellShape === "circle") {
|
|
5462
6251
|
return {
|
|
@@ -5483,9 +6272,9 @@ function createCellBackground(context, layout, cell) {
|
|
|
5483
6272
|
}
|
|
5484
6273
|
function createCellValueLabel(context, layout, cell) {
|
|
5485
6274
|
const { chart, bounds, nextOrder } = context;
|
|
5486
|
-
const size = Math.max(6,
|
|
6275
|
+
const size = Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.cellValueSize, layout.fontSize));
|
|
5487
6276
|
return {
|
|
5488
|
-
...
|
|
6277
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
5489
6278
|
id: `chart-heatmap-value-${chart.id}-${cell.seriesId}-${cell.columnIndex}`,
|
|
5490
6279
|
order: nextOrder(),
|
|
5491
6280
|
bounds,
|
|
@@ -5500,7 +6289,7 @@ function createCellValueLabel(context, layout, cell) {
|
|
|
5500
6289
|
align: "center"
|
|
5501
6290
|
}),
|
|
5502
6291
|
...chart.config?.cellValueSize === void 0 ? {} : { fontSize: size },
|
|
5503
|
-
color: chart.config?.cellValueColor ??
|
|
6292
|
+
color: chart.config?.cellValueColor ?? chunkKXYSO6GC_cjs.contrastTextColor(cell.color)
|
|
5504
6293
|
};
|
|
5505
6294
|
}
|
|
5506
6295
|
|
|
@@ -5516,7 +6305,7 @@ function renderRowHeaders(context, layout) {
|
|
|
5516
6305
|
}
|
|
5517
6306
|
function createRowHeader(context, layout, series, rowIndex) {
|
|
5518
6307
|
const { chart, plot, bounds, nextOrder } = context;
|
|
5519
|
-
return
|
|
6308
|
+
return chunkKXYSO6GC_cjs.chartText({
|
|
5520
6309
|
id: `chart-heatmap-row-${chart.id}-${series.id}`,
|
|
5521
6310
|
order: nextOrder(),
|
|
5522
6311
|
bounds,
|
|
@@ -5538,7 +6327,7 @@ function renderColumnHeaders(context, layout) {
|
|
|
5538
6327
|
}
|
|
5539
6328
|
function createColumnHeader(context, layout, label, columnIndex) {
|
|
5540
6329
|
const { chart, plot, bounds, nextOrder } = context;
|
|
5541
|
-
return
|
|
6330
|
+
return chunkKXYSO6GC_cjs.chartText({
|
|
5542
6331
|
id: `chart-heatmap-col-${chart.id}-${columnIndex}`,
|
|
5543
6332
|
order: nextOrder(),
|
|
5544
6333
|
bounds,
|
|
@@ -5562,9 +6351,9 @@ function createHeatmapLayout(context) {
|
|
|
5562
6351
|
return {
|
|
5563
6352
|
rows: chart.series,
|
|
5564
6353
|
columns,
|
|
5565
|
-
bands:
|
|
5566
|
-
zones: chart.config?.zones?.length ? chart.config.zones :
|
|
5567
|
-
fontSize: Math.max(9,
|
|
6354
|
+
bands: chunkKXYSO6GC_cjs.axisBands(chart.axisY),
|
|
6355
|
+
zones: chart.config?.zones?.length ? chart.config.zones : chunkKXYSO6GC_cjs.DEFAULT_HEATMAP_ZONES,
|
|
6356
|
+
fontSize: Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12)),
|
|
5568
6357
|
reservedSpace,
|
|
5569
6358
|
grid: createHeatmapGrid(context, reservedSpace, columns.length)
|
|
5570
6359
|
};
|
|
@@ -5575,9 +6364,9 @@ function heatmapColumns(context) {
|
|
|
5575
6364
|
}
|
|
5576
6365
|
function heatmapReservedSpace(context) {
|
|
5577
6366
|
const { chart } = context;
|
|
5578
|
-
const fontSize = Math.max(9,
|
|
6367
|
+
const fontSize = Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12));
|
|
5579
6368
|
const longestLabel = chart.series.reduce(
|
|
5580
|
-
(max, series) => Math.max(max,
|
|
6369
|
+
(max, series) => Math.max(max, chunkKXYSO6GC_cjs.estimateTextWidth(series.label ?? "", fontSize, false)),
|
|
5581
6370
|
0
|
|
5582
6371
|
);
|
|
5583
6372
|
return {
|
|
@@ -5591,7 +6380,7 @@ function createHeatmapGrid(context, reservedSpace, columnCount) {
|
|
|
5591
6380
|
const width = Math.max(1, context.plot.width - reservedSpace.rowHeaders);
|
|
5592
6381
|
const height = Math.max(1, context.plot.height - reservedSpace.columnHeaders - reservedSpace.legend);
|
|
5593
6382
|
const rowCount = chart.series.length;
|
|
5594
|
-
const cellGap = Math.max(0,
|
|
6383
|
+
const cellGap = Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.cellGap, 0));
|
|
5595
6384
|
let cellWidth = columnCount ? width / columnCount : width;
|
|
5596
6385
|
let cellHeight = rowCount ? height / rowCount : height;
|
|
5597
6386
|
let gridWidth = width;
|
|
@@ -5611,7 +6400,7 @@ function createHeatmapGrid(context, reservedSpace, columnCount) {
|
|
|
5611
6400
|
cellWidth,
|
|
5612
6401
|
cellHeight,
|
|
5613
6402
|
cellGap,
|
|
5614
|
-
cellRadius: Math.max(0,
|
|
6403
|
+
cellRadius: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barCornerRadius, cellGap))
|
|
5615
6404
|
};
|
|
5616
6405
|
}
|
|
5617
6406
|
|
|
@@ -5627,7 +6416,7 @@ function renderHeatmapLegend(context, layout) {
|
|
|
5627
6416
|
const barWidth = layout.grid.width;
|
|
5628
6417
|
const labelHeight = layout.fontSize + 2;
|
|
5629
6418
|
const barY = layout.grid.y + layout.grid.height + 6;
|
|
5630
|
-
const barBounds =
|
|
6419
|
+
const barBounds = chunkKXYSO6GC_cjs.boxBounds({ x: barX, y: barY, width: barWidth, height: BAR_HEIGHT });
|
|
5631
6420
|
return [
|
|
5632
6421
|
createGradientBar(context, layout, barX, barY, barWidth, barBounds),
|
|
5633
6422
|
...createBoundaryTicks(context, layout, barX, barY, barWidth, labelHeight)
|
|
@@ -5644,7 +6433,7 @@ function createGradientBar(context, layout, barX, barY, barWidth, barBounds) {
|
|
|
5644
6433
|
const zones = layout.zones.slice(0, bandCount);
|
|
5645
6434
|
const stops = zones.map((zone, index) => ({
|
|
5646
6435
|
offset: bandRatio(layout, layout.bands[index + 1] ?? layout.bands[layout.bands.length - 1]) * 100,
|
|
5647
|
-
color: zone.color ??
|
|
6436
|
+
color: zone.color ?? chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL
|
|
5648
6437
|
}));
|
|
5649
6438
|
return {
|
|
5650
6439
|
type: "rect",
|
|
@@ -5658,7 +6447,7 @@ function createGradientBar(context, layout, barX, barY, barWidth, barBounds) {
|
|
|
5658
6447
|
rx: 3,
|
|
5659
6448
|
zoneGradient: { axis: "y", min: chart.axisY.min, max: chart.axisY.max },
|
|
5660
6449
|
style: {
|
|
5661
|
-
fill: stops.length ? { kind: "linear-gradient", angle: 0, stops } : { kind: "solid", color:
|
|
6450
|
+
fill: stops.length ? { kind: "linear-gradient", angle: 0, stops } : { kind: "solid", color: chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL },
|
|
5662
6451
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
5663
6452
|
strokeWidth: 1
|
|
5664
6453
|
}
|
|
@@ -5686,12 +6475,12 @@ function createBoundaryTicks(context, layout, barX, barY, barWidth, labelHeight)
|
|
|
5686
6475
|
const isLast = index === layout.bands.length - 1;
|
|
5687
6476
|
const align = isFirst ? "left" : isLast ? "right" : "center";
|
|
5688
6477
|
const frameX = isFirst ? x : isLast ? x - labelWidth : x - labelWidth / 2;
|
|
5689
|
-
const label =
|
|
6478
|
+
const label = chunkKXYSO6GC_cjs.chartText({
|
|
5690
6479
|
id: `chart-heatmap-legend-tick-label-${chart.id}-${index}`,
|
|
5691
6480
|
order: nextOrder(),
|
|
5692
6481
|
bounds,
|
|
5693
6482
|
frame: { x: frameX, y: labelY, width: labelWidth, height: labelHeight },
|
|
5694
|
-
text:
|
|
6483
|
+
text: chunkKXYSO6GC_cjs.formatFieldValue(value),
|
|
5695
6484
|
chart,
|
|
5696
6485
|
align
|
|
5697
6486
|
});
|
|
@@ -6033,22 +6822,22 @@ function renderHexbin(context) {
|
|
|
6033
6822
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
6034
6823
|
const nodes = [];
|
|
6035
6824
|
const config = chart.config;
|
|
6036
|
-
const hexRadius = Math.max(1, config?.hexRadius ??
|
|
6825
|
+
const hexRadius = Math.max(1, config?.hexRadius ?? chunkKXYSO6GC_cjs.DEFAULT_HEX_RADIUS);
|
|
6037
6826
|
const drawRadius = Math.max(0.5, hexRadius - Math.max(0, config?.hexGap ?? 0) * GAP_TO_RADIUS);
|
|
6038
6827
|
const strokeWidth = config?.hexStrokeWidth ?? 0;
|
|
6039
6828
|
const minOpacity = Math.min(1, Math.max(0, config?.hexMinOpacity ?? DEFAULT_MIN_OPACITY));
|
|
6040
|
-
const shadow =
|
|
6829
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
6041
6830
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
6042
6831
|
chart.series.forEach((series, seriesIndex) => {
|
|
6043
6832
|
const explicit = series.values.length > 0 && Array.isArray(series.values[0]);
|
|
6044
6833
|
const pairs = explicit ? series.values : series.values.map((y, i) => [chart.axisX.min + i * chart.axisX.step, y]);
|
|
6045
6834
|
const pixelPoints2 = pairs.map(([vx, vy]) => ({
|
|
6046
|
-
x:
|
|
6047
|
-
y: plot.height -
|
|
6835
|
+
x: chunkKXYSO6GC_cjs.mapChartValue(vx, chart.axisX, plot.width),
|
|
6836
|
+
y: plot.height - chunkKXYSO6GC_cjs.mapChartValue(vy, chart.axisY, plot.height)
|
|
6048
6837
|
}));
|
|
6049
6838
|
const bins = computeHexBins(pixelPoints2, hexRadius);
|
|
6050
6839
|
const maxCount = Math.max(1, ...bins.map((bin) => bin.count));
|
|
6051
|
-
const color = series.color ??
|
|
6840
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
6052
6841
|
const ramp = config?.scale;
|
|
6053
6842
|
bins.forEach((bin, i) => {
|
|
6054
6843
|
const share = bin.count / maxCount;
|
|
@@ -6060,8 +6849,8 @@ function renderHexbin(context) {
|
|
|
6060
6849
|
bounds,
|
|
6061
6850
|
d: hexPath(plot.x + bin.cx, plot.y + bin.cy, drawRadius),
|
|
6062
6851
|
style: {
|
|
6063
|
-
fill:
|
|
6064
|
-
stroke: strokeWidth > 0 ?
|
|
6852
|
+
fill: chunkKXYSO6GC_cjs.paint(fill2, diagnostics, chart.id),
|
|
6853
|
+
stroke: strokeWidth > 0 ? chunkKXYSO6GC_cjs.paint(config?.hexStrokeColor ?? fill2, diagnostics, chart.id) : void 0,
|
|
6065
6854
|
strokeWidth: strokeWidth > 0 ? strokeWidth : void 0,
|
|
6066
6855
|
opacity: ramp ? void 0 : Math.max(minOpacity, share),
|
|
6067
6856
|
shadow,
|
|
@@ -6083,8 +6872,8 @@ function seriesValuePairs(chart, series) {
|
|
|
6083
6872
|
function pixelPoints(context, pairs) {
|
|
6084
6873
|
const { chart, plot } = context;
|
|
6085
6874
|
return pairs.map(([x, y]) => ({
|
|
6086
|
-
x: plot.x +
|
|
6087
|
-
y: plot.y + plot.height -
|
|
6875
|
+
x: plot.x + chunkKXYSO6GC_cjs.mapChartValue(x, chart.axisX, plot.width),
|
|
6876
|
+
y: plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(y, chart.axisY, plot.height)
|
|
6088
6877
|
}));
|
|
6089
6878
|
}
|
|
6090
6879
|
|
|
@@ -6094,7 +6883,7 @@ function createLineAreaFill(context, series, points, color, tension, areaOpacity
|
|
|
6094
6883
|
const baselineY = plot.y + plot.height;
|
|
6095
6884
|
const first = points[0];
|
|
6096
6885
|
const last = points[points.length - 1];
|
|
6097
|
-
const d = `${
|
|
6886
|
+
const d = `${chunkKXYSO6GC_cjs.linePathData(points, tension)} L ${last.x} ${baselineY} L ${first.x} ${baselineY} Z`;
|
|
6098
6887
|
const top = Math.min(...points.map((point) => point.y));
|
|
6099
6888
|
const centerX = (Math.min(...points.map((point) => point.x)) + Math.max(...points.map((point) => point.x))) / 2;
|
|
6100
6889
|
const halfHeight = (baselineY - top) / 2;
|
|
@@ -6116,8 +6905,8 @@ function createLineAreaFill(context, series, points, color, tension, areaOpacity
|
|
|
6116
6905
|
kind: "linear-gradient",
|
|
6117
6906
|
angle: 90,
|
|
6118
6907
|
stops: [
|
|
6119
|
-
{ offset: 0, color:
|
|
6120
|
-
{ offset: 100, color:
|
|
6908
|
+
{ offset: 0, color: chunkKXYSO6GC_cjs.colorWithAlpha(color, areaOpacity) },
|
|
6909
|
+
{ offset: 100, color: chunkKXYSO6GC_cjs.colorWithAlpha(color, 0) }
|
|
6121
6910
|
]
|
|
6122
6911
|
},
|
|
6123
6912
|
stroke: { kind: "none" },
|
|
@@ -6140,7 +6929,7 @@ function guideNode(context, mark) {
|
|
|
6140
6929
|
d: `M ${mark.point.x} ${mark.point.y} V ${plot.y + plot.height}`,
|
|
6141
6930
|
style: {
|
|
6142
6931
|
fill: { kind: "none" },
|
|
6143
|
-
stroke:
|
|
6932
|
+
stroke: chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id),
|
|
6144
6933
|
strokeWidth: 1,
|
|
6145
6934
|
dash: [3, 4],
|
|
6146
6935
|
opacity: 0.55,
|
|
@@ -6161,20 +6950,20 @@ function dotNode(context, mark) {
|
|
|
6161
6950
|
rx: mark.radius,
|
|
6162
6951
|
ry: mark.radius,
|
|
6163
6952
|
style: {
|
|
6164
|
-
fill:
|
|
6953
|
+
fill: chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id),
|
|
6165
6954
|
shadow: glow ? { color: mark.color, opacity: 0.9, blur: glow, dx: 0, dy: 0 } : void 0,
|
|
6166
6955
|
pointerEvents: "none"
|
|
6167
6956
|
}
|
|
6168
6957
|
};
|
|
6169
6958
|
}
|
|
6170
|
-
function
|
|
6959
|
+
function labelNode3(context, mark, value) {
|
|
6171
6960
|
const { chart, bounds, nextOrder } = context;
|
|
6172
6961
|
const config = chart.config;
|
|
6173
6962
|
const fontSize = Math.max(9, chart.fontSize ?? 12);
|
|
6174
6963
|
const text = formatHighlight(config?.highlightLabelFormat, config?.categories?.[mark.index] ?? "", value);
|
|
6175
6964
|
const width = Math.max(48, text.length * fontSize * 0.62);
|
|
6176
6965
|
return {
|
|
6177
|
-
...
|
|
6966
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
6178
6967
|
id: `chart-highlight-label-${mark.key}`,
|
|
6179
6968
|
order: nextOrder(),
|
|
6180
6969
|
bounds,
|
|
@@ -6220,7 +7009,7 @@ function renderLineHighlights(context, series, color) {
|
|
|
6220
7009
|
}
|
|
6221
7010
|
nodes.push(dotNode(context, mark));
|
|
6222
7011
|
if (config?.highlightLabels) {
|
|
6223
|
-
nodes.push(
|
|
7012
|
+
nodes.push(labelNode3(context, mark, pairs[index][1]));
|
|
6224
7013
|
}
|
|
6225
7014
|
}
|
|
6226
7015
|
return nodes;
|
|
@@ -6254,15 +7043,15 @@ function createLineError(context, mark) {
|
|
|
6254
7043
|
return null;
|
|
6255
7044
|
}
|
|
6256
7045
|
const { chart, plot, bounds, nextOrder } = context;
|
|
6257
|
-
const [lower, upper] =
|
|
6258
|
-
return
|
|
7046
|
+
const [lower, upper] = chunkKXYSO6GC_cjs.errorBarRange(mark.value, mark.error);
|
|
7047
|
+
return chunkKXYSO6GC_cjs.createVerticalErrorWhiskerNode({
|
|
6259
7048
|
id: `chart-line-error-${chart.id}-${mark.seriesId}-${mark.valueIndex}`,
|
|
6260
7049
|
order: nextOrder(),
|
|
6261
7050
|
bounds,
|
|
6262
7051
|
geometry: {
|
|
6263
7052
|
centerX: mark.position.x,
|
|
6264
|
-
startY: plot.y + plot.height -
|
|
6265
|
-
endY: plot.y + plot.height -
|
|
7053
|
+
startY: plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(lower, chart.axisY, plot.height),
|
|
7054
|
+
endY: plot.y + plot.height - chunkKXYSO6GC_cjs.mapChartValue(upper, chart.axisY, plot.height)
|
|
6266
7055
|
},
|
|
6267
7056
|
color: mark.color,
|
|
6268
7057
|
valueReference: { seriesId: mark.seriesId, valueIndex: mark.valueIndex }
|
|
@@ -6286,8 +7075,8 @@ function createLinePoint(context, mark) {
|
|
|
6286
7075
|
ry: visible ? radius : 6,
|
|
6287
7076
|
detail: { of: "chartValue", series: mark.seriesId, valueIndex: mark.valueIndex },
|
|
6288
7077
|
style: {
|
|
6289
|
-
fill: visible ?
|
|
6290
|
-
stroke: visible && strokeWidth > 0 ?
|
|
7078
|
+
fill: visible ? chunkKXYSO6GC_cjs.paint(fill2, diagnostics, chart.id) : { kind: "none" },
|
|
7079
|
+
stroke: visible && strokeWidth > 0 ? chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id) : void 0,
|
|
6291
7080
|
strokeWidth: visible && strokeWidth > 0 ? strokeWidth : void 0,
|
|
6292
7081
|
pointerEvents: visible ? void 0 : "all"
|
|
6293
7082
|
}
|
|
@@ -6307,22 +7096,22 @@ function createLinePath(context, series, points, color, tension) {
|
|
|
6307
7096
|
order: nextOrder(),
|
|
6308
7097
|
bounds: gradient ? { minX: plot.x, maxX: plot.x + plot.width, minY: plot.y, maxY: plot.y + plot.height } : bounds,
|
|
6309
7098
|
detail: { of: "chartSeries", series: series.id, lineTension: tension || void 0 },
|
|
6310
|
-
d:
|
|
7099
|
+
d: chunkKXYSO6GC_cjs.linePathData(points, tension),
|
|
6311
7100
|
style: {
|
|
6312
7101
|
fill: { kind: "none" },
|
|
6313
|
-
stroke:
|
|
7102
|
+
stroke: chunkKXYSO6GC_cjs.paint(gradient ?? color, diagnostics, chart.id),
|
|
6314
7103
|
strokeWidth: series.strokeWidth ?? config?.lineWidth ?? 2,
|
|
6315
7104
|
dash: series.dash,
|
|
6316
7105
|
lineCap: config?.lineWidth === void 0 ? void 0 : "round",
|
|
6317
7106
|
lineJoin: "round",
|
|
6318
|
-
shadow: glow ? { color, opacity: 0.9, blur: glow, dx: 0, dy: 0 } :
|
|
7107
|
+
shadow: glow ? { color, opacity: 0.9, blur: glow, dx: 0, dy: 0 } : chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle)
|
|
6319
7108
|
}
|
|
6320
7109
|
};
|
|
6321
7110
|
}
|
|
6322
7111
|
|
|
6323
7112
|
// src/renderScene/charts/renderers/line/series.ts
|
|
6324
7113
|
function seriesColor(series, seriesIndex) {
|
|
6325
|
-
return
|
|
7114
|
+
return chunkKXYSO6GC_cjs.representativeColor(series.color, chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length]);
|
|
6326
7115
|
}
|
|
6327
7116
|
function renderLineSeriesArea(context, series, seriesIndex) {
|
|
6328
7117
|
const areaOpacity = context.chart.config?.areaOpacity;
|
|
@@ -6386,7 +7175,7 @@ function renderGridLines(context, layout) {
|
|
|
6386
7175
|
style: {
|
|
6387
7176
|
fill: { kind: "none" },
|
|
6388
7177
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
6389
|
-
strokeWidth:
|
|
7178
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1)
|
|
6390
7179
|
}
|
|
6391
7180
|
};
|
|
6392
7181
|
});
|
|
@@ -6394,7 +7183,7 @@ function renderGridLines(context, layout) {
|
|
|
6394
7183
|
function renderPercentageLabels(context, layout) {
|
|
6395
7184
|
const { chart, plot, bounds, nextOrder } = context;
|
|
6396
7185
|
return PERCENT_TICKS.map((percent) => ({
|
|
6397
|
-
...
|
|
7186
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
6398
7187
|
id: `chart-mekko-pct-${chart.id}-${percent}`,
|
|
6399
7188
|
order: nextOrder(),
|
|
6400
7189
|
bounds,
|
|
@@ -6426,7 +7215,7 @@ function renderMekkoColumnLabels(context, layout, columnIndex, column) {
|
|
|
6426
7215
|
function createTotalLabel(context, layout, columnIndex, column) {
|
|
6427
7216
|
const { chart, plot, bounds, nextOrder } = context;
|
|
6428
7217
|
return {
|
|
6429
|
-
...
|
|
7218
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
6430
7219
|
id: `chart-mekko-total-${chart.id}-${columnIndex}`,
|
|
6431
7220
|
order: nextOrder(),
|
|
6432
7221
|
bounds,
|
|
@@ -6447,7 +7236,7 @@ function createColumnLabel(context, layout, columnIndex, column) {
|
|
|
6447
7236
|
const { chart, bounds, nextOrder } = context;
|
|
6448
7237
|
const { label, width } = column;
|
|
6449
7238
|
return {
|
|
6450
|
-
...
|
|
7239
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
6451
7240
|
id: `chart-mekko-col-label-${chart.id}-${columnIndex}`,
|
|
6452
7241
|
order: nextOrder(),
|
|
6453
7242
|
bounds,
|
|
@@ -6461,7 +7250,7 @@ function createColumnLabel(context, layout, columnIndex, column) {
|
|
|
6461
7250
|
chart,
|
|
6462
7251
|
align: "center"
|
|
6463
7252
|
}),
|
|
6464
|
-
lines:
|
|
7253
|
+
lines: chunkKXYSO6GC_cjs.wrapText(label, width, layout.smallFontSize),
|
|
6465
7254
|
fontSize: layout.smallFontSize
|
|
6466
7255
|
};
|
|
6467
7256
|
}
|
|
@@ -6471,8 +7260,8 @@ function createMekkoLayout(context) {
|
|
|
6471
7260
|
const labels = mekkoColumnLabels(context);
|
|
6472
7261
|
const labelGutterWidth = context.showLabels ? 30 : 0;
|
|
6473
7262
|
const grid = createMekkoGrid(context, labelGutterWidth);
|
|
6474
|
-
const fontSize = Math.max(9,
|
|
6475
|
-
const columnGap = Math.max(0,
|
|
7263
|
+
const fontSize = Math.max(9, chunkKXYSO6GC_cjs.finite(context.chart.fontSize, 12));
|
|
7264
|
+
const columnGap = Math.max(0, chunkKXYSO6GC_cjs.finite(context.chart.config?.mekkoColumnGap, 4));
|
|
6476
7265
|
const smallFontSize = Math.max(8, fontSize - 1);
|
|
6477
7266
|
return {
|
|
6478
7267
|
columns: createMekkoColumns(context, grid, labels, columnGap),
|
|
@@ -6480,8 +7269,8 @@ function createMekkoLayout(context) {
|
|
|
6480
7269
|
smallFontSize,
|
|
6481
7270
|
labelGutterWidth,
|
|
6482
7271
|
columnGap,
|
|
6483
|
-
labelSize: Math.max(6,
|
|
6484
|
-
valueSize: Math.max(6,
|
|
7272
|
+
labelSize: Math.max(6, chunkKXYSO6GC_cjs.finite(context.chart.config?.mekkoLabelSize, smallFontSize)),
|
|
7273
|
+
valueSize: Math.max(6, chunkKXYSO6GC_cjs.finite(context.chart.config?.mekkoValueSize, smallFontSize)),
|
|
6485
7274
|
grid
|
|
6486
7275
|
};
|
|
6487
7276
|
}
|
|
@@ -6538,12 +7327,12 @@ function createColumnBackdrop(context, layout, columnIndex) {
|
|
|
6538
7327
|
id: `chart-mekko-column-backdrop-${chart.id}-${columnIndex}`,
|
|
6539
7328
|
order: nextOrder(),
|
|
6540
7329
|
bounds,
|
|
6541
|
-
d:
|
|
6542
|
-
style: { fill:
|
|
7330
|
+
d: chunkKXYSO6GC_cjs.barShapePath(column.x, layout.grid.y, column.width, layout.grid.height, cornerRadius),
|
|
7331
|
+
style: { fill: chunkKXYSO6GC_cjs.paint(chart.gridColor ?? "#e2e8f0", diagnostics, chart.id), opacity: BACKDROP_OPACITY }
|
|
6543
7332
|
};
|
|
6544
7333
|
}
|
|
6545
7334
|
function mekkoCornerRadius(context) {
|
|
6546
|
-
return Math.max(0,
|
|
7335
|
+
return Math.max(0, chunkKXYSO6GC_cjs.finite(context.chart.config?.barCornerRadius, 2));
|
|
6547
7336
|
}
|
|
6548
7337
|
function calculateColumnSegments(seriesList, layout, columnIndex) {
|
|
6549
7338
|
const segments = [];
|
|
@@ -6554,7 +7343,7 @@ function calculateColumnSegments(seriesList, layout, columnIndex) {
|
|
|
6554
7343
|
const height = (column.total > 0 ? value / column.total : 0) * column.height;
|
|
6555
7344
|
const y = column.y + cumulativeHeight;
|
|
6556
7345
|
cumulativeHeight += height;
|
|
6557
|
-
const color = series.color ??
|
|
7346
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
6558
7347
|
segments.push({
|
|
6559
7348
|
columnIndex,
|
|
6560
7349
|
seriesId: series.id,
|
|
@@ -6577,12 +7366,12 @@ function renderSegment(context, layout, segment, nextColor) {
|
|
|
6577
7366
|
}
|
|
6578
7367
|
function createSegmentNode(context, segment, nextColor) {
|
|
6579
7368
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
6580
|
-
const shadow =
|
|
7369
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
6581
7370
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
6582
7371
|
const config = chart.config;
|
|
6583
7372
|
const radius = segment.isTop || config?.mekkoRoundAll ? mekkoCornerRadius(context) : 0;
|
|
6584
7373
|
const { x, y, width, height } = segment.frame;
|
|
6585
|
-
const segmentGap = Math.max(0,
|
|
7374
|
+
const segmentGap = Math.max(0, chunkKXYSO6GC_cjs.finite(config?.mekkoSegmentGap, 0));
|
|
6586
7375
|
const fallback = "#94a3b8";
|
|
6587
7376
|
const gradientBounds = {
|
|
6588
7377
|
minX: x + width / 2 - height / 2,
|
|
@@ -6594,20 +7383,20 @@ function createSegmentNode(context, segment, nextColor) {
|
|
|
6594
7383
|
kind: "linear-gradient",
|
|
6595
7384
|
angle: 90,
|
|
6596
7385
|
stops: [
|
|
6597
|
-
{ offset: 0, color:
|
|
6598
|
-
{ offset: 100, color:
|
|
7386
|
+
{ offset: 0, color: chunkKXYSO6GC_cjs.representativeColor(segment.color, fallback) },
|
|
7387
|
+
{ offset: 100, color: chunkKXYSO6GC_cjs.representativeColor(nextColor, fallback) }
|
|
6599
7388
|
]
|
|
6600
|
-
} :
|
|
7389
|
+
} : chunkKXYSO6GC_cjs.paint(segment.color, diagnostics, chart.id);
|
|
6601
7390
|
return {
|
|
6602
7391
|
type: "path",
|
|
6603
7392
|
id: `chart-mekko-seg-${chart.id}-${segment.columnIndex}-${segment.seriesId}`,
|
|
6604
7393
|
order: nextOrder(),
|
|
6605
7394
|
bounds: nextColor ? gradientBounds : bounds,
|
|
6606
|
-
d:
|
|
7395
|
+
d: chunkKXYSO6GC_cjs.barPath(x, y + segmentGap / 2, width, Math.max(0, height - segmentGap), radius, Boolean(config?.mekkoRoundAll)),
|
|
6607
7396
|
style: {
|
|
6608
7397
|
fill: fill2,
|
|
6609
7398
|
stroke: { kind: "solid", color: config?.mekkoSegmentStrokeColor ?? chart.gridColor ?? "#e2e8f0" },
|
|
6610
|
-
strokeWidth:
|
|
7399
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(config?.mekkoSegmentStrokeWidth, chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1)),
|
|
6611
7400
|
shadow,
|
|
6612
7401
|
clip: clipPath ? { type: "path", d: clipPath } : void 0
|
|
6613
7402
|
}
|
|
@@ -6623,17 +7412,17 @@ function createSegmentLabel(context, layout, segment) {
|
|
|
6623
7412
|
const innerHeight = Math.max(1, height - 6);
|
|
6624
7413
|
const lineHeight = layout.labelSize * 1.2;
|
|
6625
7414
|
const valueHeight = layout.valueSize * 1.2;
|
|
6626
|
-
const labelLines =
|
|
6627
|
-
(line) =>
|
|
7415
|
+
const labelLines = chunkKXYSO6GC_cjs.wrapText(segment.seriesLabel, innerWidth, layout.labelSize).map(
|
|
7416
|
+
(line) => chunkKXYSO6GC_cjs.ellipsizeToWidth(line, innerWidth, layout.labelSize, true)
|
|
6628
7417
|
);
|
|
6629
7418
|
if (labelLines.length * lineHeight + valueHeight > innerHeight) {
|
|
6630
7419
|
return [];
|
|
6631
7420
|
}
|
|
6632
|
-
const textColor = chart.config?.mekkoTextColor ??
|
|
7421
|
+
const textColor = chart.config?.mekkoTextColor ?? chunkKXYSO6GC_cjs.contrastTextColor(chunkKXYSO6GC_cjs.representativeColor(segment.color, "#ffffff"));
|
|
6633
7422
|
const columnTotal = layout.columns[segment.columnIndex]?.total ?? 0;
|
|
6634
7423
|
const valueText = chart.config?.mekkoValueFormat === "percent" ? `${columnTotal > 0 ? Math.round(segment.value / columnTotal * 100) : 0}%` : String(segment.value);
|
|
6635
7424
|
const label = {
|
|
6636
|
-
...
|
|
7425
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
6637
7426
|
id: `chart-mekko-seg-label-${chart.id}-${segment.columnIndex}-${segment.seriesId}`,
|
|
6638
7427
|
order: nextOrder(),
|
|
6639
7428
|
bounds,
|
|
@@ -6647,7 +7436,7 @@ function createSegmentLabel(context, layout, segment) {
|
|
|
6647
7436
|
color: textColor
|
|
6648
7437
|
};
|
|
6649
7438
|
const valueNode = {
|
|
6650
|
-
...
|
|
7439
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
6651
7440
|
id: `chart-mekko-seg-value-${chart.id}-${segment.columnIndex}-${segment.seriesId}`,
|
|
6652
7441
|
order: nextOrder(),
|
|
6653
7442
|
bounds,
|
|
@@ -6680,7 +7469,7 @@ function renderMekko(context) {
|
|
|
6680
7469
|
|
|
6681
7470
|
// src/renderScene/charts/renderers/pie/center.ts
|
|
6682
7471
|
function fill(template, chart) {
|
|
6683
|
-
const values = chart.series.map((series) => Math.max(0,
|
|
7472
|
+
const values = chart.series.map((series) => Math.max(0, chunkKXYSO6GC_cjs.finite(series.values[0], 0)));
|
|
6684
7473
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
6685
7474
|
const first = values[0] ?? 0;
|
|
6686
7475
|
return template.replace(/\{total\}/g, String(Math.round(total * 100) / 100)).replace(/\{percent\}/g, String(total > 0 ? Math.round(first / total * 100) : 0)).replace(/\{label\}/g, chart.series[0]?.label ?? "");
|
|
@@ -6692,7 +7481,7 @@ function renderPieCenter(context, geometry) {
|
|
|
6692
7481
|
return [];
|
|
6693
7482
|
}
|
|
6694
7483
|
const lines = fill(template, chart).split(/\\n|\n/);
|
|
6695
|
-
const fontSize =
|
|
7484
|
+
const fontSize = chunkKXYSO6GC_cjs.finite(chart.config?.pieCenterSize, Math.max(14, Math.min(40, geometry.outerRadius * 0.3)));
|
|
6696
7485
|
const lineHeight = fontSize * 1.2;
|
|
6697
7486
|
const width = Math.max(40, (geometry.innerRadius > 0 ? geometry.innerRadius : geometry.outerRadius * 0.6) * 2);
|
|
6698
7487
|
const text = {
|
|
@@ -6705,7 +7494,7 @@ function renderPieCenter(context, geometry) {
|
|
|
6705
7494
|
width,
|
|
6706
7495
|
height: lineHeight * lines.length,
|
|
6707
7496
|
lines,
|
|
6708
|
-
fontFamily: chart.fontFamily ??
|
|
7497
|
+
fontFamily: chart.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
6709
7498
|
fontSize,
|
|
6710
7499
|
fontWeight: "bold",
|
|
6711
7500
|
align: "center",
|
|
@@ -6725,14 +7514,14 @@ var radians = (degrees) => degrees * Math.PI / 180;
|
|
|
6725
7514
|
function renderPieSlices(context, geometry) {
|
|
6726
7515
|
const config = context.chart.config;
|
|
6727
7516
|
const marks = createPieSliceMarks(context.chart.series, geometry.total, {
|
|
6728
|
-
start: TOP + radians(
|
|
6729
|
-
sweep: Math.min(FULL, Math.max(radians(1), radians(
|
|
6730
|
-
explode: Math.max(0,
|
|
7517
|
+
start: TOP + radians(chunkKXYSO6GC_cjs.finite(config?.pieStartAngle, 0)),
|
|
7518
|
+
sweep: Math.min(FULL, Math.max(radians(1), radians(chunkKXYSO6GC_cjs.finite(config?.pieSweep, 360)))),
|
|
7519
|
+
explode: Math.max(0, chunkKXYSO6GC_cjs.finite(config?.pieExplode, 0))
|
|
6731
7520
|
});
|
|
6732
7521
|
const gapPx = config?.pieSliceGap ?? 0;
|
|
6733
7522
|
return [
|
|
6734
7523
|
...marks.flatMap((mark) => createSliceNodes(context, shiftGeometry(geometry, mark), mark, gapPx)),
|
|
6735
|
-
...
|
|
7524
|
+
...chunkKXYSO6GC_cjs.renderPieLabels(
|
|
6736
7525
|
context,
|
|
6737
7526
|
geometry,
|
|
6738
7527
|
marks.map((mark) => ({
|
|
@@ -6764,20 +7553,20 @@ function createPieSliceMarks(seriesList, total, layout) {
|
|
|
6764
7553
|
const marks = [];
|
|
6765
7554
|
let angle = layout.start;
|
|
6766
7555
|
seriesList.forEach((series, seriesIndex) => {
|
|
6767
|
-
const value = Math.max(0,
|
|
7556
|
+
const value = Math.max(0, chunkKXYSO6GC_cjs.finite(series.values[0], 0));
|
|
6768
7557
|
const sweep = value / total * layout.sweep;
|
|
6769
7558
|
marks.push({
|
|
6770
7559
|
seriesId: series.id,
|
|
6771
7560
|
label: series.label,
|
|
6772
|
-
color: series.color ??
|
|
7561
|
+
color: series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length],
|
|
6773
7562
|
stroke: series.stroke,
|
|
6774
7563
|
strokeWidth: series.strokeWidth,
|
|
6775
7564
|
value,
|
|
6776
7565
|
share: value / total,
|
|
6777
7566
|
angles: { start: angle, end: angle + Math.min(sweep, layout.sweep >= FULL ? MAXIMUM_SWEEP : layout.sweep) },
|
|
6778
|
-
explode: Math.max(0,
|
|
6779
|
-
labelOffsetX:
|
|
6780
|
-
labelOffsetY:
|
|
7567
|
+
explode: Math.max(0, chunkKXYSO6GC_cjs.finite(series.offset, layout.explode)),
|
|
7568
|
+
labelOffsetX: chunkKXYSO6GC_cjs.finite(series.labelOffsetX, 0),
|
|
7569
|
+
labelOffsetY: chunkKXYSO6GC_cjs.finite(series.labelOffsetY, 0)
|
|
6781
7570
|
});
|
|
6782
7571
|
angle += sweep;
|
|
6783
7572
|
});
|
|
@@ -6800,14 +7589,14 @@ function pieOuterShadow(shadow, gapPx) {
|
|
|
6800
7589
|
function sliceCornerRadius(geometry, mark, gapPx) {
|
|
6801
7590
|
const halfGap = Math.max(0, gapPx) / 2;
|
|
6802
7591
|
const rawSweep = mark.angles.end - mark.angles.start;
|
|
6803
|
-
const usesInnerArc =
|
|
6804
|
-
const gapSweep = 2 *
|
|
7592
|
+
const usesInnerArc = chunkKXYSO6GC_cjs.pieUsesInnerArc(geometry, mark.angles, gapPx);
|
|
7593
|
+
const gapSweep = 2 * chunkKXYSO6GC_cjs.gapInsetAngle(halfGap, geometry.outerRadius);
|
|
6805
7594
|
const availableSweep = Math.max(0, rawSweep - gapSweep);
|
|
6806
7595
|
return Math.min(
|
|
6807
7596
|
geometry.cornerRadius,
|
|
6808
|
-
usesInnerArc ?
|
|
7597
|
+
usesInnerArc ? chunkKXYSO6GC_cjs.maxPieCornerRadius(geometry.outerRadius, geometry.innerRadius, availableSweep) : chunkKXYSO6GC_cjs.maxApexCornerRadius(
|
|
6809
7598
|
geometry.outerRadius,
|
|
6810
|
-
|
|
7599
|
+
chunkKXYSO6GC_cjs.pieApexRadius(halfGap, rawSweep, geometry.outerRadius),
|
|
6811
7600
|
availableSweep
|
|
6812
7601
|
)
|
|
6813
7602
|
);
|
|
@@ -6820,14 +7609,14 @@ function sliceStroke(context, mark) {
|
|
|
6820
7609
|
}
|
|
6821
7610
|
return {
|
|
6822
7611
|
stroke: { kind: "solid", color: strokeColor },
|
|
6823
|
-
strokeWidth:
|
|
7612
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(mark.strokeWidth, chunkKXYSO6GC_cjs.finite(config?.pieStrokeWidth, 1))
|
|
6824
7613
|
};
|
|
6825
7614
|
}
|
|
6826
7615
|
function createSliceNodes(context, geometry, mark, gapPx) {
|
|
6827
7616
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
6828
|
-
const fill2 =
|
|
6829
|
-
const slicePath =
|
|
6830
|
-
const shadow =
|
|
7617
|
+
const fill2 = chunkKXYSO6GC_cjs.paint(mark.color, diagnostics, chart.id);
|
|
7618
|
+
const slicePath = chunkKXYSO6GC_cjs.createPieSlicePath(geometry, mark.angles, sliceCornerRadius(geometry, mark, gapPx), gapPx);
|
|
7619
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
6831
7620
|
const strokeStyle = sliceStroke(context, mark);
|
|
6832
7621
|
const glow = chart.config?.pieGlow;
|
|
6833
7622
|
const shadowCaster = shadow ? {
|
|
@@ -6858,12 +7647,12 @@ function createSliceNodes(context, geometry, mark, gapPx) {
|
|
|
6858
7647
|
pieEnd: mark.angles.end,
|
|
6859
7648
|
pieValue: mark.value
|
|
6860
7649
|
},
|
|
6861
|
-
prop:
|
|
7650
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(mark.seriesId, 0),
|
|
6862
7651
|
style: {
|
|
6863
7652
|
fill: fill2,
|
|
6864
7653
|
...strokeStyle,
|
|
6865
7654
|
innerShadow: shadow,
|
|
6866
|
-
shadow: glow ? { color:
|
|
7655
|
+
shadow: glow ? { color: chunkKXYSO6GC_cjs.representativeColor(mark.color, "#ffffff"), opacity: 0.85, blur: glow, dx: 0, dy: 0 } : void 0
|
|
6867
7656
|
}
|
|
6868
7657
|
};
|
|
6869
7658
|
return shadowCaster ? [shadowCaster, slice] : [slice];
|
|
@@ -6871,7 +7660,7 @@ function createSliceNodes(context, geometry, mark, gapPx) {
|
|
|
6871
7660
|
|
|
6872
7661
|
// src/renderScene/charts/renderers/pie.ts
|
|
6873
7662
|
function renderPie(context) {
|
|
6874
|
-
const geometry =
|
|
7663
|
+
const geometry = chunkKXYSO6GC_cjs.createPieGeometry(context);
|
|
6875
7664
|
return [...renderPieSlices(context, geometry), ...renderPieCenter(context, geometry)];
|
|
6876
7665
|
}
|
|
6877
7666
|
|
|
@@ -6888,18 +7677,18 @@ var OUTSIDE_FALLBACK_COLOR = "#334155";
|
|
|
6888
7677
|
function layoutOf(context) {
|
|
6889
7678
|
const { chart, plot } = context;
|
|
6890
7679
|
const maxRadius = Math.max(1, Math.min(plot.width, plot.height) / 2 - 4);
|
|
6891
|
-
const axisMin =
|
|
7680
|
+
const axisMin = chunkKXYSO6GC_cjs.finite(chart.axisY.min, 0);
|
|
6892
7681
|
return {
|
|
6893
7682
|
centerX: plot.x + plot.width / 2,
|
|
6894
7683
|
centerY: plot.y + plot.height / 2,
|
|
6895
7684
|
maxRadius,
|
|
6896
|
-
innerRadius: Math.max(0, Math.min(
|
|
6897
|
-
cornerRadius: Math.max(0,
|
|
6898
|
-
gapPx: Math.max(0,
|
|
7685
|
+
innerRadius: Math.max(0, Math.min(chunkKXYSO6GC_cjs.finite(chart.config?.innerRadius, 0), maxRadius - 1)),
|
|
7686
|
+
cornerRadius: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.pieCornerRadius, 0)),
|
|
7687
|
+
gapPx: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.pieSliceGap, 0)),
|
|
6899
7688
|
axisMin,
|
|
6900
|
-
range:
|
|
7689
|
+
range: chunkKXYSO6GC_cjs.finite(chart.axisY.max, 100) - axisMin,
|
|
6901
7690
|
sweep: chart.series.length > 0 ? Math.PI * 2 / chart.series.length : 0,
|
|
6902
|
-
start: TOP2 +
|
|
7691
|
+
start: TOP2 + chunkKXYSO6GC_cjs.finite(chart.config?.pieStartAngle, 0) * Math.PI / 180
|
|
6903
7692
|
};
|
|
6904
7693
|
}
|
|
6905
7694
|
function clampedCorner(layout, outerRadius, angles) {
|
|
@@ -6907,19 +7696,19 @@ function clampedCorner(layout, outerRadius, angles) {
|
|
|
6907
7696
|
const geometry = { centerX, centerY, outerRadius, innerRadius };
|
|
6908
7697
|
const halfGap = Math.max(0, gapPx) / 2;
|
|
6909
7698
|
const rawSweep = angles.end - angles.start;
|
|
6910
|
-
const availableSweep = Math.max(0, rawSweep - 2 *
|
|
6911
|
-
if (
|
|
6912
|
-
return Math.min(cornerRadius,
|
|
7699
|
+
const availableSweep = Math.max(0, rawSweep - 2 * chunkKXYSO6GC_cjs.gapInsetAngle(halfGap, outerRadius));
|
|
7700
|
+
if (chunkKXYSO6GC_cjs.pieUsesInnerArc(geometry, angles, gapPx)) {
|
|
7701
|
+
return Math.min(cornerRadius, chunkKXYSO6GC_cjs.maxPieCornerRadius(outerRadius, innerRadius, availableSweep));
|
|
6913
7702
|
}
|
|
6914
|
-
const apexRadius =
|
|
6915
|
-
return Math.min(cornerRadius,
|
|
7703
|
+
const apexRadius = chunkKXYSO6GC_cjs.pieApexRadius(halfGap, rawSweep, outerRadius);
|
|
7704
|
+
return Math.min(cornerRadius, chunkKXYSO6GC_cjs.maxApexCornerRadius(outerRadius, apexRadius, availableSweep));
|
|
6916
7705
|
}
|
|
6917
7706
|
function wedgeNodes(context, layout, series, angles, outerRadius, value, rawColor) {
|
|
6918
7707
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
6919
7708
|
const { centerX, centerY, innerRadius, maxRadius, gapPx } = layout;
|
|
6920
|
-
const color =
|
|
6921
|
-
const shadow =
|
|
6922
|
-
const trackPath =
|
|
7709
|
+
const color = chunkKXYSO6GC_cjs.paint(rawColor, diagnostics, chart.id);
|
|
7710
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
7711
|
+
const trackPath = chunkKXYSO6GC_cjs.createPieSlicePath(
|
|
6923
7712
|
{ centerX, centerY, outerRadius: maxRadius, innerRadius },
|
|
6924
7713
|
angles,
|
|
6925
7714
|
clampedCorner(layout, maxRadius, angles),
|
|
@@ -6932,12 +7721,12 @@ function wedgeNodes(context, layout, series, angles, outerRadius, value, rawColo
|
|
|
6932
7721
|
bounds,
|
|
6933
7722
|
d: trackPath,
|
|
6934
7723
|
style: {
|
|
6935
|
-
fill:
|
|
7724
|
+
fill: chunkKXYSO6GC_cjs.paint(chart.gridColor ?? TRACK_COLOR_FALLBACK, diagnostics, chart.id),
|
|
6936
7725
|
opacity: chart.config?.polarTrackOpacity,
|
|
6937
7726
|
...trackStroke(context)
|
|
6938
7727
|
}
|
|
6939
7728
|
};
|
|
6940
|
-
const wedgePath =
|
|
7729
|
+
const wedgePath = chunkKXYSO6GC_cjs.createPieSlicePath(
|
|
6941
7730
|
{ centerX, centerY, outerRadius, innerRadius },
|
|
6942
7731
|
angles,
|
|
6943
7732
|
clampedCorner(layout, outerRadius, angles),
|
|
@@ -6966,7 +7755,7 @@ function wedgeNodes(context, layout, series, angles, outerRadius, value, rawColo
|
|
|
6966
7755
|
pieEnd: angles.end,
|
|
6967
7756
|
pieValue: value
|
|
6968
7757
|
},
|
|
6969
|
-
prop:
|
|
7758
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(series.id, 0),
|
|
6970
7759
|
style: { fill: color, innerShadow: shadow, ...wedgeStroke(context) }
|
|
6971
7760
|
};
|
|
6972
7761
|
return shadowCaster ? [track, shadowCaster, wedge] : [track, wedge];
|
|
@@ -6979,7 +7768,7 @@ function trackStroke(context) {
|
|
|
6979
7768
|
const dash = (config.polarTrackDash ?? "").split(/[ ,]+/).map(Number).filter((part) => Number.isFinite(part) && part > 0);
|
|
6980
7769
|
return {
|
|
6981
7770
|
stroke: { kind: "solid", color: config.polarTrackStroke },
|
|
6982
|
-
strokeWidth:
|
|
7771
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(config.polarTrackStrokeWidth, 1),
|
|
6983
7772
|
dash: dash.length > 0 ? dash : void 0
|
|
6984
7773
|
};
|
|
6985
7774
|
}
|
|
@@ -6990,7 +7779,7 @@ function wedgeStroke(context) {
|
|
|
6990
7779
|
}
|
|
6991
7780
|
return {
|
|
6992
7781
|
stroke: { kind: "solid", color: config.pieStroke },
|
|
6993
|
-
strokeWidth:
|
|
7782
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(config.pieStrokeWidth, 1)
|
|
6994
7783
|
};
|
|
6995
7784
|
}
|
|
6996
7785
|
function ringNodes(context, layout) {
|
|
@@ -6998,7 +7787,7 @@ function ringNodes(context, layout) {
|
|
|
6998
7787
|
if (!chart.config?.polarRings || layout.range <= 0) {
|
|
6999
7788
|
return [];
|
|
7000
7789
|
}
|
|
7001
|
-
return
|
|
7790
|
+
return chunkKXYSO6GC_cjs.chartTicks(chart.axisY).filter((tick) => tick > layout.axisMin && tick < layout.axisMin + layout.range).map((tick) => {
|
|
7002
7791
|
const radius = layout.innerRadius + (layout.maxRadius - layout.innerRadius) * (tick - layout.axisMin) / layout.range;
|
|
7003
7792
|
return {
|
|
7004
7793
|
type: "ellipse",
|
|
@@ -7012,7 +7801,7 @@ function ringNodes(context, layout) {
|
|
|
7012
7801
|
style: {
|
|
7013
7802
|
fill: { kind: "none" },
|
|
7014
7803
|
stroke: { kind: "solid", color: chart.textColor ?? "#334155" },
|
|
7015
|
-
strokeWidth:
|
|
7804
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1),
|
|
7016
7805
|
opacity: 0.25
|
|
7017
7806
|
}
|
|
7018
7807
|
};
|
|
@@ -7024,10 +7813,10 @@ function renderPolarArea(context) {
|
|
|
7024
7813
|
const showLabels = context.showLabels && sweep >= MIN_LABEL_SWEEP;
|
|
7025
7814
|
const wedges = context.chart.series.flatMap((series, index) => {
|
|
7026
7815
|
const angles = { start: start + index * sweep, end: start + (index + 1) * sweep };
|
|
7027
|
-
const value = Math.max(0,
|
|
7816
|
+
const value = Math.max(0, chunkKXYSO6GC_cjs.finite(series.values[0], 0));
|
|
7028
7817
|
const fraction = range > 0 ? Math.min(1, Math.max(0, (value - axisMin) / range)) : 0;
|
|
7029
7818
|
const outerRadius = Math.max(innerRadius + 1, innerRadius + (maxRadius - innerRadius) * fraction);
|
|
7030
|
-
const rawColor = series.color ??
|
|
7819
|
+
const rawColor = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[index % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
7031
7820
|
const nodes = wedgeNodes(context, layout, series, angles, outerRadius, value, rawColor);
|
|
7032
7821
|
if (!showLabels) {
|
|
7033
7822
|
return nodes;
|
|
@@ -7038,10 +7827,10 @@ function renderPolarArea(context) {
|
|
|
7038
7827
|
return [...wedges, ...ringNodes(context, layout)];
|
|
7039
7828
|
}
|
|
7040
7829
|
function labelSizes(chart) {
|
|
7041
|
-
const base = Math.max(9,
|
|
7830
|
+
const base = Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12));
|
|
7042
7831
|
return {
|
|
7043
|
-
nameSize: Math.max(6,
|
|
7044
|
-
valueSize: Math.max(6,
|
|
7832
|
+
nameSize: Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.polarNameSize, base)),
|
|
7833
|
+
valueSize: Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.polarValueSize, base))
|
|
7045
7834
|
};
|
|
7046
7835
|
}
|
|
7047
7836
|
function labelPlacement2(context, geometry, angles, series, fillColor) {
|
|
@@ -7049,8 +7838,8 @@ function labelPlacement2(context, geometry, angles, series, fillColor) {
|
|
|
7049
7838
|
const { nameSize, valueSize } = labelSizes(context.chart);
|
|
7050
7839
|
const lineHeight = (nameSize + valueSize) * 1.2 / 2;
|
|
7051
7840
|
const ringThickness = geometry.outerRadius - geometry.innerRadius;
|
|
7052
|
-
const labelOffsetX =
|
|
7053
|
-
const labelOffsetY =
|
|
7841
|
+
const labelOffsetX = chunkKXYSO6GC_cjs.finite(series.labelOffsetX, 0);
|
|
7842
|
+
const labelOffsetY = chunkKXYSO6GC_cjs.finite(series.labelOffsetY, 0);
|
|
7054
7843
|
const hasManualOffset = labelOffsetX !== 0 || labelOffsetY !== 0;
|
|
7055
7844
|
const tooThin = ringThickness < lineHeight * 2 + 6;
|
|
7056
7845
|
const chordWidth = 2 * geometry.outerRadius * Math.sin(Math.abs(angles.end - angles.start) / 2);
|
|
@@ -7060,11 +7849,11 @@ function labelPlacement2(context, geometry, angles, series, fillColor) {
|
|
|
7060
7849
|
return void 0;
|
|
7061
7850
|
}
|
|
7062
7851
|
const outside = hasManualOffset || !fitsInline;
|
|
7063
|
-
const tickStart =
|
|
7064
|
-
const point = outside ? hasManualOffset ? addOffset(
|
|
7065
|
-
const color = outside ? outsideLabels && context.chart.textColor ? context.chart.textColor :
|
|
7066
|
-
|
|
7067
|
-
|
|
7852
|
+
const tickStart = chunkKXYSO6GC_cjs.pieArcPoint(geometry, mid, geometry.outerRadius + LEADER_INSET);
|
|
7853
|
+
const point = outside ? hasManualOffset ? addOffset(chunkKXYSO6GC_cjs.pieArcPoint(geometry, mid, geometry.outerRadius), labelOffsetX, labelOffsetY) : chunkKXYSO6GC_cjs.pieArcPoint(geometry, mid, geometry.outerRadius + OUTSIDE_GAP) : chunkKXYSO6GC_cjs.pieArcPoint(geometry, mid, geometry.innerRadius + ringThickness * LABEL_RADIUS_FRACTION);
|
|
7854
|
+
const color = outside ? outsideLabels && context.chart.textColor ? context.chart.textColor : chunkKXYSO6GC_cjs.sameHueTint(chunkKXYSO6GC_cjs.representativeColor(fillColor, OUTSIDE_FALLBACK_COLOR), OUTSIDE_TINT_LIGHTNESS) ?? OUTSIDE_FALLBACK_COLOR : chunkKXYSO6GC_cjs.sameHueContrastColor(
|
|
7855
|
+
chunkKXYSO6GC_cjs.representativeColor(fillColor, "#0f172a"),
|
|
7856
|
+
chunkKXYSO6GC_cjs.contrastTextColor(chunkKXYSO6GC_cjs.representativeColor(fillColor, "#0f172a"))
|
|
7068
7857
|
);
|
|
7069
7858
|
return { point, color, outside, mid, tickStart };
|
|
7070
7859
|
}
|
|
@@ -7077,7 +7866,7 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
7077
7866
|
const { point, color, outside, mid, tickStart } = placement;
|
|
7078
7867
|
const { nameSize, valueSize } = labelSizes(chart);
|
|
7079
7868
|
const lineHeight = Math.max(nameSize, valueSize) * 1.2;
|
|
7080
|
-
const tickEnd = outside ?
|
|
7869
|
+
const tickEnd = outside ? chunkKXYSO6GC_cjs.clipSegmentToRect(tickStart, point, LABEL_WIDTH / 2, lineHeight) : tickStart;
|
|
7081
7870
|
const tick = {
|
|
7082
7871
|
type: "path",
|
|
7083
7872
|
id: `chart-polar-area-label-tick-${chart.id}-${series.id}`,
|
|
@@ -7099,7 +7888,7 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
7099
7888
|
bounds,
|
|
7100
7889
|
x: point.x - LABEL_WIDTH / 2,
|
|
7101
7890
|
width: LABEL_WIDTH,
|
|
7102
|
-
fontFamily: chart.fontFamily ??
|
|
7891
|
+
fontFamily: chart.fontFamily ?? chunkKXYSO6GC_cjs.DEFAULT_FONT,
|
|
7103
7892
|
align: "center",
|
|
7104
7893
|
verticalAlign: "middle",
|
|
7105
7894
|
lineHeight: 1.2,
|
|
@@ -7122,7 +7911,7 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
7122
7911
|
lines: [series.label],
|
|
7123
7912
|
fontWeight: valueFirst ? "normal" : "bold",
|
|
7124
7913
|
detail,
|
|
7125
|
-
prop:
|
|
7914
|
+
prop: chunkKXYSO6GC_cjs.seriesLabelProp(series.id)
|
|
7126
7915
|
};
|
|
7127
7916
|
const valueText = {
|
|
7128
7917
|
type: "text",
|
|
@@ -7132,10 +7921,10 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
7132
7921
|
y: valueY,
|
|
7133
7922
|
height: valueSize * 1.2,
|
|
7134
7923
|
fontSize: valueSize,
|
|
7135
|
-
lines: [
|
|
7924
|
+
lines: [chunkKXYSO6GC_cjs.formatFieldValue(value)],
|
|
7136
7925
|
fontWeight: valueFirst ? "bold" : "normal",
|
|
7137
7926
|
detail,
|
|
7138
|
-
prop:
|
|
7927
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(series.id, 0),
|
|
7139
7928
|
propKind: "value"
|
|
7140
7929
|
};
|
|
7141
7930
|
return [tick, nameText, valueText];
|
|
@@ -7153,10 +7942,10 @@ function radarFrameFor(context) {
|
|
|
7153
7942
|
return {
|
|
7154
7943
|
centerX: plot.x + plot.width / 2,
|
|
7155
7944
|
centerY: plot.y + plot.height / 2,
|
|
7156
|
-
radius:
|
|
7945
|
+
radius: chunkKXYSO6GC_cjs.radarRadius(plot.width, plot.height, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12), context.showLabels),
|
|
7157
7946
|
min: chart.axisY.min,
|
|
7158
7947
|
max: chart.axisY.max,
|
|
7159
|
-
count:
|
|
7948
|
+
count: chunkKXYSO6GC_cjs.radarCategoryCount(configuredCount, dataCount),
|
|
7160
7949
|
curved: chart.chartType === "radial",
|
|
7161
7950
|
tension: chart.config?.radarTension
|
|
7162
7951
|
};
|
|
@@ -7166,7 +7955,7 @@ function createRadarGeometry(context) {
|
|
|
7166
7955
|
const configuredCategories = chart.config?.categories?.filter(Boolean) ?? [];
|
|
7167
7956
|
const frame = radarFrameFor(context);
|
|
7168
7957
|
const categories = createCategories(configuredCategories, frame.count);
|
|
7169
|
-
const pointAt = (pointRadius, pointIndex) =>
|
|
7958
|
+
const pointAt = (pointRadius, pointIndex) => chunkKXYSO6GC_cjs.radarPointAt(frame, pointIndex, pointRadius);
|
|
7170
7959
|
return {
|
|
7171
7960
|
circular: frame.curved,
|
|
7172
7961
|
areaOpacity: Math.max(0, Math.min(1, chart.config?.areaOpacity ?? 0.16)),
|
|
@@ -7178,9 +7967,9 @@ function createRadarGeometry(context) {
|
|
|
7178
7967
|
centerX: frame.centerX,
|
|
7179
7968
|
centerY: frame.centerY,
|
|
7180
7969
|
radius: frame.radius,
|
|
7181
|
-
radiusForValue: (value) =>
|
|
7970
|
+
radiusForValue: (value) => chunkKXYSO6GC_cjs.radarRadiusForValue(frame, value),
|
|
7182
7971
|
pointAt,
|
|
7183
|
-
polygonPath: (pointRadius) =>
|
|
7972
|
+
polygonPath: (pointRadius) => chunkKXYSO6GC_cjs.radarSeriesPath(
|
|
7184
7973
|
categories.map((_, index) => pointAt(pointRadius, index)),
|
|
7185
7974
|
false
|
|
7186
7975
|
)
|
|
@@ -7201,7 +7990,7 @@ function renderRadarGrid(context, geometry) {
|
|
|
7201
7990
|
return [...renderRings(context, geometry), ...geometry.showSpokes ? renderSpokes(context, geometry) : []];
|
|
7202
7991
|
}
|
|
7203
7992
|
function renderRings(context, geometry) {
|
|
7204
|
-
return
|
|
7993
|
+
return chunkKXYSO6GC_cjs.chartTicks(context.chart.axisY).filter((tick) => tick > context.chart.axisY.min).map((tick) => createRingNode(context, geometry, tick));
|
|
7205
7994
|
}
|
|
7206
7995
|
function createRingNode(context, geometry, tick) {
|
|
7207
7996
|
const { chart, bounds, nextOrder } = context;
|
|
@@ -7209,7 +7998,7 @@ function createRingNode(context, geometry, tick) {
|
|
|
7209
7998
|
const style = {
|
|
7210
7999
|
fill: { kind: "none" },
|
|
7211
8000
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
7212
|
-
strokeWidth:
|
|
8001
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1)
|
|
7213
8002
|
};
|
|
7214
8003
|
if (geometry.circular) {
|
|
7215
8004
|
return {
|
|
@@ -7246,7 +8035,7 @@ function renderSpokes(context, geometry) {
|
|
|
7246
8035
|
style: {
|
|
7247
8036
|
fill: { kind: "none" },
|
|
7248
8037
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
7249
|
-
strokeWidth:
|
|
8038
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1)
|
|
7250
8039
|
}
|
|
7251
8040
|
};
|
|
7252
8041
|
});
|
|
@@ -7266,7 +8055,7 @@ function createCategoryLabel(context, geometry, category, categoryIndex) {
|
|
|
7266
8055
|
const labelPoint = geometry.pointAt(geometry.radius + 10, categoryIndex);
|
|
7267
8056
|
const horizontalOffset = labelPoint.x - geometry.centerX;
|
|
7268
8057
|
const width = Math.max(64, Math.min(120, plot.width / 3));
|
|
7269
|
-
return
|
|
8058
|
+
return chunkKXYSO6GC_cjs.chartText({
|
|
7270
8059
|
id: `chart-radar-label-${chart.id}-${categoryIndex}`,
|
|
7271
8060
|
order: nextOrder(),
|
|
7272
8061
|
bounds,
|
|
@@ -7304,9 +8093,9 @@ function renderRadarSeries(context, geometry) {
|
|
|
7304
8093
|
return nodes;
|
|
7305
8094
|
}
|
|
7306
8095
|
function renderSeries(context, geometry, series, seriesIndex) {
|
|
7307
|
-
const color = series.color ??
|
|
8096
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
7308
8097
|
const points = seriesPoints(series, context, geometry);
|
|
7309
|
-
const path =
|
|
8098
|
+
const path = chunkKXYSO6GC_cjs.radarSeriesPath(points, geometry.circular, geometry.tension);
|
|
7310
8099
|
return [
|
|
7311
8100
|
createSeriesFill(context, geometry, series, path, color),
|
|
7312
8101
|
...geometry.strokeWidth > 0 ? [createSeriesStroke(context, geometry, series, path, color)] : [],
|
|
@@ -7329,7 +8118,7 @@ function createSeriesFill(context, geometry, series, path, color) {
|
|
|
7329
8118
|
d: path,
|
|
7330
8119
|
detail: { of: "chartSeries", series: series.id },
|
|
7331
8120
|
style: {
|
|
7332
|
-
fill:
|
|
8121
|
+
fill: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id),
|
|
7333
8122
|
stroke: { kind: "none" },
|
|
7334
8123
|
opacity: Math.max(0, Math.min(1, series.opacity ?? geometry.areaOpacity))
|
|
7335
8124
|
}
|
|
@@ -7346,10 +8135,10 @@ function createSeriesStroke(context, geometry, series, path, color) {
|
|
|
7346
8135
|
detail: { of: "chartSeries", series: series.id },
|
|
7347
8136
|
style: {
|
|
7348
8137
|
fill: { kind: "none" },
|
|
7349
|
-
stroke:
|
|
8138
|
+
stroke: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id),
|
|
7350
8139
|
strokeWidth: geometry.strokeWidth,
|
|
7351
8140
|
lineJoin: "round",
|
|
7352
|
-
shadow:
|
|
8141
|
+
shadow: chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle)
|
|
7353
8142
|
}
|
|
7354
8143
|
};
|
|
7355
8144
|
}
|
|
@@ -7365,8 +8154,8 @@ function createSeriesPoints(context, geometry, series, points, color) {
|
|
|
7365
8154
|
rx: geometry.pointSize,
|
|
7366
8155
|
ry: geometry.pointSize,
|
|
7367
8156
|
detail: { of: "chartValue", series: series.id, valueIndex: pointIndex, mark: "radar-vertex" },
|
|
7368
|
-
prop:
|
|
7369
|
-
style: { fill:
|
|
8157
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(series.id, pointIndex),
|
|
8158
|
+
style: { fill: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id) }
|
|
7370
8159
|
}));
|
|
7371
8160
|
}
|
|
7372
8161
|
|
|
@@ -7420,25 +8209,25 @@ function ringProgressPath(cx, cy, r, sweep, from) {
|
|
|
7420
8209
|
}
|
|
7421
8210
|
function layoutOf2(context) {
|
|
7422
8211
|
const { chart, plot } = context;
|
|
7423
|
-
const axisMin =
|
|
8212
|
+
const axisMin = chunkKXYSO6GC_cjs.finite(chart.axisY.min, 0);
|
|
7424
8213
|
return {
|
|
7425
8214
|
centerX: plot.x + plot.width / 2,
|
|
7426
8215
|
centerY: plot.y + plot.height / 2,
|
|
7427
8216
|
outerRadius: Math.max(1, Math.min(plot.width, plot.height) / 2 - 4),
|
|
7428
|
-
ringThickness: Math.max(1,
|
|
7429
|
-
ringGap: Math.max(0,
|
|
8217
|
+
ringThickness: Math.max(1, chunkKXYSO6GC_cjs.finite(chart.config?.ringThickness, DEFAULT_RING_THICKNESS)),
|
|
8218
|
+
ringGap: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.ringGap, DEFAULT_RING_GAP)),
|
|
7430
8219
|
axisMin,
|
|
7431
|
-
range:
|
|
7432
|
-
start: TOP3 +
|
|
7433
|
-
total: Math.min(360, Math.max(1,
|
|
7434
|
-
trackOpacity: Math.min(1, Math.max(0,
|
|
8220
|
+
range: chunkKXYSO6GC_cjs.finite(chart.axisY.max, 100) - axisMin,
|
|
8221
|
+
start: TOP3 + chunkKXYSO6GC_cjs.finite(chart.config?.ringStartAngle, 0) * Math.PI / 180,
|
|
8222
|
+
total: Math.min(360, Math.max(1, chunkKXYSO6GC_cjs.finite(chart.config?.ringSweep, 360))) * Math.PI / 180,
|
|
8223
|
+
trackOpacity: Math.min(1, Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.ringTrackOpacity, TRACK_OPACITY))),
|
|
7435
8224
|
cap: chart.config?.ringCap ?? "round"
|
|
7436
8225
|
};
|
|
7437
8226
|
}
|
|
7438
8227
|
function ringEndShadows(context, layout, series, radius, sweep, color) {
|
|
7439
8228
|
const { chart, bounds, nextOrder } = context;
|
|
7440
8229
|
const { centerX, centerY, ringThickness, start } = layout;
|
|
7441
|
-
const shadow =
|
|
8230
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
7442
8231
|
const isFullCircle = sweep >= Math.PI * 2 - FULL_SWEEP_EPSILON;
|
|
7443
8232
|
if (!shadow || isFullCircle) {
|
|
7444
8233
|
return [];
|
|
@@ -7476,8 +8265,8 @@ function ringNodes2(context, layout, series, index) {
|
|
|
7476
8265
|
if (radius <= ringThickness / 2) {
|
|
7477
8266
|
return [];
|
|
7478
8267
|
}
|
|
7479
|
-
const color =
|
|
7480
|
-
const value = Math.max(0,
|
|
8268
|
+
const color = chunkKXYSO6GC_cjs.paint(series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[index % chunkKXYSO6GC_cjs.CHART_COLORS.length], diagnostics, chart.id);
|
|
8269
|
+
const value = Math.max(0, chunkKXYSO6GC_cjs.finite(series.values[0], 0));
|
|
7481
8270
|
const fraction = range > 0 ? Math.min(1, Math.max(0, (value - axisMin) / range)) : 0;
|
|
7482
8271
|
const trackStyle = {
|
|
7483
8272
|
fill: { kind: "none" },
|
|
@@ -7515,7 +8304,7 @@ function ringNodes2(context, layout, series, index) {
|
|
|
7515
8304
|
bounds,
|
|
7516
8305
|
d: ringProgressPath(centerX, centerY, radius, sweep, start),
|
|
7517
8306
|
detail: { of: "chartValue", series: series.id, valueIndex: 0, mark: "radial-bar-ring" },
|
|
7518
|
-
prop:
|
|
8307
|
+
prop: chunkKXYSO6GC_cjs.seriesValueProp(series.id, 0),
|
|
7519
8308
|
style: { fill: { kind: "none" }, stroke: color, strokeWidth: ringThickness, lineCap: cap }
|
|
7520
8309
|
};
|
|
7521
8310
|
return [track, ...casters, progress];
|
|
@@ -7527,7 +8316,7 @@ function renderRadialBar(context) {
|
|
|
7527
8316
|
|
|
7528
8317
|
// src/renderScene/charts/renderers/sankey/links.ts
|
|
7529
8318
|
function renderSankeyLinks(context, data) {
|
|
7530
|
-
const shadow =
|
|
8319
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(context.chart.shadowStyle);
|
|
7531
8320
|
const gradient = Boolean(context.chart.config?.linkGradient);
|
|
7532
8321
|
const { plot } = context;
|
|
7533
8322
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
@@ -7548,8 +8337,8 @@ function createSankeyLinkRibbon(context, data, link, linkIndex, gradient) {
|
|
|
7548
8337
|
bottom: data.baseY + link.targetY1
|
|
7549
8338
|
};
|
|
7550
8339
|
const config = context.chart.config;
|
|
7551
|
-
const fromColor = link.color || data.nodeColors.get(link.source) ||
|
|
7552
|
-
const toColor = data.nodeColors.get(link.target) ||
|
|
8340
|
+
const fromColor = link.color || data.nodeColors.get(link.source) || chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL;
|
|
8341
|
+
const toColor = data.nodeColors.get(link.target) || chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL;
|
|
7553
8342
|
const fill2 = gradient ? {
|
|
7554
8343
|
kind: "linear-gradient",
|
|
7555
8344
|
angle: 0,
|
|
@@ -7564,9 +8353,9 @@ function createSankeyLinkRibbon(context, data, link, linkIndex, gradient) {
|
|
|
7564
8353
|
toId: link.target,
|
|
7565
8354
|
source,
|
|
7566
8355
|
target,
|
|
7567
|
-
controlX: source.x + (target.x - source.x) * Math.min(1, Math.max(0,
|
|
8356
|
+
controlX: source.x + (target.x - source.x) * Math.min(1, Math.max(0, chunkKXYSO6GC_cjs.finite(config?.sankeyLinkCurve, 0.5))),
|
|
7568
8357
|
fill: fill2,
|
|
7569
|
-
opacity: Math.min(1, Math.max(0,
|
|
8358
|
+
opacity: Math.min(1, Math.max(0, chunkKXYSO6GC_cjs.finite(config?.sankeyLinkOpacity, link.color ? 0.85 : 0.45)))
|
|
7570
8359
|
};
|
|
7571
8360
|
}
|
|
7572
8361
|
function createSankeyRibbonNode(context, ribbon, shadow, clipPath, gradient) {
|
|
@@ -7607,7 +8396,7 @@ function sankeyRibbonPath(ribbon) {
|
|
|
7607
8396
|
var OUTSIDE_LABEL_LIGHTNESS_ON_LIGHT_BG = 0.3;
|
|
7608
8397
|
var OUTSIDE_LABEL_LIGHTNESS_ON_DARK_BG = 0.78;
|
|
7609
8398
|
function renderSankeyNodes(context, data) {
|
|
7610
|
-
const cornerRadius = Math.max(0,
|
|
8399
|
+
const cornerRadius = Math.max(0, chunkKXYSO6GC_cjs.finite(context.chart.config?.barCornerRadius, 0));
|
|
7611
8400
|
const nodes = [];
|
|
7612
8401
|
data.nodes.forEach((node) => {
|
|
7613
8402
|
nodes.push(createNodeRect(context, data, node, cornerRadius));
|
|
@@ -7623,8 +8412,8 @@ function createNodeRect(context, data, node, cornerRadius) {
|
|
|
7623
8412
|
const x = data.baseX + node.x;
|
|
7624
8413
|
const y = data.baseY + node.y;
|
|
7625
8414
|
const style = {
|
|
7626
|
-
fill: { kind: "solid", color: node.color ||
|
|
7627
|
-
shadow:
|
|
8415
|
+
fill: { kind: "solid", color: node.color || chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL },
|
|
8416
|
+
shadow: chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle)
|
|
7628
8417
|
};
|
|
7629
8418
|
const isFirstColumn = node.column === 0;
|
|
7630
8419
|
const isLastColumn = node.column === data.columnCount - 1;
|
|
@@ -7650,7 +8439,7 @@ function createNodeRect(context, data, node, cornerRadius) {
|
|
|
7650
8439
|
id: `chart-sankey-node-${chart.id}-${node.id}`,
|
|
7651
8440
|
order: nextOrder(),
|
|
7652
8441
|
bounds,
|
|
7653
|
-
d:
|
|
8442
|
+
d: chunkKXYSO6GC_cjs.leftRoundedRectPath(x, y, node.width, node.height, cornerRadius),
|
|
7654
8443
|
style,
|
|
7655
8444
|
detail
|
|
7656
8445
|
};
|
|
@@ -7661,7 +8450,7 @@ function createNodeRect(context, data, node, cornerRadius) {
|
|
|
7661
8450
|
id: `chart-sankey-node-${chart.id}-${node.id}`,
|
|
7662
8451
|
order: nextOrder(),
|
|
7663
8452
|
bounds,
|
|
7664
|
-
d:
|
|
8453
|
+
d: chunkKXYSO6GC_cjs.rightRoundedRectPath(x, y, node.width, node.height, cornerRadius),
|
|
7665
8454
|
style,
|
|
7666
8455
|
detail
|
|
7667
8456
|
};
|
|
@@ -7687,9 +8476,9 @@ function createNodeLabel(context, data, node) {
|
|
|
7687
8476
|
return void 0;
|
|
7688
8477
|
}
|
|
7689
8478
|
const fallback = chart.textColor ?? "#0f172a";
|
|
7690
|
-
const defaultColor = position === "inside" ?
|
|
8479
|
+
const defaultColor = position === "inside" ? chunkKXYSO6GC_cjs.contrastTextColor(node.color) : chunkKXYSO6GC_cjs.sameHueTint(
|
|
7691
8480
|
node.color,
|
|
7692
|
-
|
|
8481
|
+
chunkKXYSO6GC_cjs.isLightColor(fallback) ? OUTSIDE_LABEL_LIGHTNESS_ON_DARK_BG : OUTSIDE_LABEL_LIGHTNESS_ON_LIGHT_BG
|
|
7693
8482
|
) ?? fallback;
|
|
7694
8483
|
const color = chart.config?.labelColor ?? defaultColor;
|
|
7695
8484
|
return { ...label, color, detail: { of: "chartSeries", series: node.id, mark: "sankey-node-label" } };
|
|
@@ -7701,7 +8490,7 @@ function createOutsideLabel(context, data, node) {
|
|
|
7701
8490
|
const y = data.baseY + node.y;
|
|
7702
8491
|
const labelX2 = isLastColumn ? x - data.labelGutter + 8 : x + node.width + 6;
|
|
7703
8492
|
return {
|
|
7704
|
-
...
|
|
8493
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
7705
8494
|
id: `chart-sankey-label-${chart.id}-${node.id}`,
|
|
7706
8495
|
order: nextOrder(),
|
|
7707
8496
|
bounds,
|
|
@@ -7726,11 +8515,11 @@ function createInsideLabel(context, data, node, orientation) {
|
|
|
7726
8515
|
if (orientation === "vertical") {
|
|
7727
8516
|
const thickness = fontSize * 1.4;
|
|
7728
8517
|
const width = Math.max(1, node.height - 8);
|
|
7729
|
-
if (
|
|
8518
|
+
if (chunkKXYSO6GC_cjs.estimateTextWidth(node.label, fontSize, false) > width) {
|
|
7730
8519
|
return void 0;
|
|
7731
8520
|
}
|
|
7732
8521
|
return {
|
|
7733
|
-
...
|
|
8522
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
7734
8523
|
id,
|
|
7735
8524
|
order: nextOrder(),
|
|
7736
8525
|
bounds,
|
|
@@ -7747,7 +8536,7 @@ function createInsideLabel(context, data, node, orientation) {
|
|
|
7747
8536
|
};
|
|
7748
8537
|
}
|
|
7749
8538
|
return {
|
|
7750
|
-
...
|
|
8539
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
7751
8540
|
id,
|
|
7752
8541
|
order: nextOrder(),
|
|
7753
8542
|
bounds,
|
|
@@ -7768,18 +8557,18 @@ function createSankeyRenderData(context) {
|
|
|
7768
8557
|
const labelGutter = showLabels ? 92 : 0;
|
|
7769
8558
|
const availableWidth = Math.max(1, plot.width - labelGutter * 2);
|
|
7770
8559
|
const layout = layoutSankey(createNodeInputs(context), createLinkInputs(context), availableWidth, plot.height, {
|
|
7771
|
-
nodeWidth: Math.max(1,
|
|
7772
|
-
nodeGap: Math.max(0,
|
|
8560
|
+
nodeWidth: Math.max(1, chunkKXYSO6GC_cjs.finite(chart.config?.sankeyNodeWidth, 18)),
|
|
8561
|
+
nodeGap: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.sankeyNodeGap, 8))
|
|
7773
8562
|
});
|
|
7774
8563
|
return {
|
|
7775
8564
|
...layout,
|
|
7776
8565
|
baseX: plot.x + labelGutter,
|
|
7777
8566
|
baseY: plot.y,
|
|
7778
8567
|
labelGutter,
|
|
7779
|
-
fontSize: Math.max(9,
|
|
7780
|
-
labelSize: Math.max(6,
|
|
8568
|
+
fontSize: Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12)),
|
|
8569
|
+
labelSize: Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.sankeyLabelSize, Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12)) - 2)),
|
|
7781
8570
|
columnCount: Math.max(1, ...layout.nodes.map((node) => node.column + 1)),
|
|
7782
|
-
nodeColors: new Map(layout.nodes.map((node) => [node.id, node.color ||
|
|
8571
|
+
nodeColors: new Map(layout.nodes.map((node) => [node.id, node.color || chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL]))
|
|
7783
8572
|
};
|
|
7784
8573
|
}
|
|
7785
8574
|
function createNodeInputs(context) {
|
|
@@ -7801,7 +8590,7 @@ function createLinkInputs(context) {
|
|
|
7801
8590
|
source: series.source,
|
|
7802
8591
|
target: series.target,
|
|
7803
8592
|
value: series.values[0] ?? 0,
|
|
7804
|
-
color: series.color ?
|
|
8593
|
+
color: series.color ? chunkKXYSO6GC_cjs.representativeColor(series.color, chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL) : void 0
|
|
7805
8594
|
});
|
|
7806
8595
|
});
|
|
7807
8596
|
return inputs;
|
|
@@ -7820,9 +8609,9 @@ function renderSankey(context) {
|
|
|
7820
8609
|
var DEFAULT_POINT_SIZE = 4;
|
|
7821
8610
|
function renderScatter(context) {
|
|
7822
8611
|
const nodes = [];
|
|
7823
|
-
const shadow =
|
|
8612
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(context.chart.shadowStyle);
|
|
7824
8613
|
context.chart.series.forEach((series, seriesIndex) => {
|
|
7825
|
-
const color = series.color ??
|
|
8614
|
+
const color = series.color ?? chunkKXYSO6GC_cjs.CHART_COLORS[seriesIndex % chunkKXYSO6GC_cjs.CHART_COLORS.length];
|
|
7826
8615
|
const points = pixelPoints(context, seriesValuePairs(context.chart, series));
|
|
7827
8616
|
points.forEach((point, pointIndex) => {
|
|
7828
8617
|
nodes.push(createScatterPoint(context, series, point, pointIndex, color, shadow));
|
|
@@ -7846,8 +8635,8 @@ function createScatterPoint(context, series, point, pointIndex, color, shadow) {
|
|
|
7846
8635
|
ry: radius,
|
|
7847
8636
|
detail: { of: "chartValue", series: series.id, valueIndex: pointIndex },
|
|
7848
8637
|
style: {
|
|
7849
|
-
fill:
|
|
7850
|
-
stroke: strokeWidth > 0 ?
|
|
8638
|
+
fill: chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id),
|
|
8639
|
+
stroke: strokeWidth > 0 ? chunkKXYSO6GC_cjs.paint(config?.pointStrokeColor ?? color, diagnostics, chart.id) : void 0,
|
|
7851
8640
|
strokeWidth: strokeWidth > 0 ? strokeWidth : void 0,
|
|
7852
8641
|
opacity: config?.pointOpacity,
|
|
7853
8642
|
shadow
|
|
@@ -7858,14 +8647,14 @@ function createScatterPoint(context, series, point, pointIndex, color, shadow) {
|
|
|
7858
8647
|
// src/renderScene/charts/renderers/treemap/layout.ts
|
|
7859
8648
|
function createTreemapLayout(context) {
|
|
7860
8649
|
const { chart, plot, showLegend } = context;
|
|
7861
|
-
const fontSize = Math.max(9,
|
|
8650
|
+
const fontSize = Math.max(9, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12));
|
|
7862
8651
|
const legendPosition = chart.legendPosition === "left" ? "left" : chart.legendPosition === "right" ? "right" : "bottom";
|
|
7863
8652
|
const legendHeight = showLegend && legendPosition === "bottom" ? 48 : 0;
|
|
7864
|
-
const cellGap = Math.max(0,
|
|
8653
|
+
const cellGap = Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.cellGap, 0));
|
|
7865
8654
|
return {
|
|
7866
8655
|
leaves: chart.series,
|
|
7867
|
-
bands:
|
|
7868
|
-
zones: chart.config?.zones?.length ? chart.config.zones :
|
|
8656
|
+
bands: chunkKXYSO6GC_cjs.axisBands(chart.axisY),
|
|
8657
|
+
zones: chart.config?.zones?.length ? chart.config.zones : chunkKXYSO6GC_cjs.DEFAULT_HEATMAP_ZONES,
|
|
7869
8658
|
fontSize,
|
|
7870
8659
|
smallFontSize: Math.max(8, fontSize - 1),
|
|
7871
8660
|
legendPosition,
|
|
@@ -7873,23 +8662,23 @@ function createTreemapLayout(context) {
|
|
|
7873
8662
|
gridWidth: Math.max(1, plot.width),
|
|
7874
8663
|
gridHeight: Math.max(1, plot.height - legendHeight),
|
|
7875
8664
|
cellGap,
|
|
7876
|
-
cellRadius: Math.max(0,
|
|
7877
|
-
headerHeight: Math.max(0,
|
|
7878
|
-
labelSize: Math.max(6,
|
|
7879
|
-
valueSize: Math.max(6,
|
|
7880
|
-
labelPadding: Math.max(0,
|
|
8665
|
+
cellRadius: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.barCornerRadius, cellGap)),
|
|
8666
|
+
headerHeight: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.headerHeight, 20)),
|
|
8667
|
+
labelSize: Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.tileLabelSize, Math.max(8, fontSize - 1))),
|
|
8668
|
+
valueSize: Math.max(6, chunkKXYSO6GC_cjs.finite(chart.config?.tileValueSize, Math.max(8, fontSize - 1))),
|
|
8669
|
+
labelPadding: Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.tileLabelPadding, 4))
|
|
7881
8670
|
};
|
|
7882
8671
|
}
|
|
7883
8672
|
function treemapLeafValue(leaf) {
|
|
7884
8673
|
return leaf.values[0] ?? 0;
|
|
7885
8674
|
}
|
|
7886
8675
|
function treemapLeafColor(leaf, layout) {
|
|
7887
|
-
return leaf.color ??
|
|
8676
|
+
return leaf.color ?? chunkKXYSO6GC_cjs.zoneColorAtValue(treemapLeafValue(leaf), layout.bands, layout.zones);
|
|
7888
8677
|
}
|
|
7889
8678
|
|
|
7890
8679
|
// src/renderScene/charts/renderers/treemap/legend.ts
|
|
7891
8680
|
var BAR_THICKNESS = 10;
|
|
7892
|
-
var
|
|
8681
|
+
var TICK_LENGTH2 = 4;
|
|
7893
8682
|
var ROW_GAP2 = 2;
|
|
7894
8683
|
var CHART_GAP = 16;
|
|
7895
8684
|
var LABEL_SIZE = 34;
|
|
@@ -7909,7 +8698,7 @@ function bandStops(layout) {
|
|
|
7909
8698
|
const zones = layout.zones.slice(0, bandCount);
|
|
7910
8699
|
return zones.map((zone, index) => ({
|
|
7911
8700
|
offset: bandRatio2(layout, layout.bands[index + 1] ?? layout.bands[layout.bands.length - 1]) * 100,
|
|
7912
|
-
color: zone.color ??
|
|
8701
|
+
color: zone.color ?? chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL
|
|
7913
8702
|
}));
|
|
7914
8703
|
}
|
|
7915
8704
|
function renderBottomLegend(context, layout) {
|
|
@@ -7918,7 +8707,7 @@ function renderBottomLegend(context, layout) {
|
|
|
7918
8707
|
const barWidth = layout.gridWidth;
|
|
7919
8708
|
const labelHeight = layout.fontSize + 2;
|
|
7920
8709
|
const barY = plot.y + layout.gridHeight + CHART_GAP;
|
|
7921
|
-
const barBounds =
|
|
8710
|
+
const barBounds = chunkKXYSO6GC_cjs.boxBounds({ x: barX, y: barY, width: barWidth, height: BAR_THICKNESS });
|
|
7922
8711
|
const stops = bandStops(layout);
|
|
7923
8712
|
const bar = {
|
|
7924
8713
|
type: "rect",
|
|
@@ -7932,19 +8721,19 @@ function renderBottomLegend(context, layout) {
|
|
|
7932
8721
|
rx: 3,
|
|
7933
8722
|
zoneGradient: { axis: "y", min: chart.axisY.min, max: chart.axisY.max },
|
|
7934
8723
|
style: {
|
|
7935
|
-
fill: stops.length ? { kind: "linear-gradient", angle: 0, stops } : { kind: "solid", color:
|
|
8724
|
+
fill: stops.length ? { kind: "linear-gradient", angle: 0, stops } : { kind: "solid", color: chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL },
|
|
7936
8725
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
7937
8726
|
strokeWidth: 1
|
|
7938
8727
|
}
|
|
7939
8728
|
};
|
|
7940
|
-
const
|
|
8729
|
+
const ticks2 = layout.bands.flatMap((value, index) => {
|
|
7941
8730
|
const x = barX + bandRatio2(layout, value) * barWidth;
|
|
7942
8731
|
const tick = {
|
|
7943
8732
|
type: "path",
|
|
7944
8733
|
id: `chart-treemap-legend-tick-${chart.id}-${index}`,
|
|
7945
8734
|
order: nextOrder(),
|
|
7946
8735
|
bounds,
|
|
7947
|
-
d: `M ${x} ${barY + BAR_THICKNESS} L ${x} ${barY + BAR_THICKNESS +
|
|
8736
|
+
d: `M ${x} ${barY + BAR_THICKNESS} L ${x} ${barY + BAR_THICKNESS + TICK_LENGTH2}`,
|
|
7948
8737
|
style: {
|
|
7949
8738
|
fill: { kind: "none" },
|
|
7950
8739
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
@@ -7955,18 +8744,18 @@ function renderBottomLegend(context, layout) {
|
|
|
7955
8744
|
const isLast = index === layout.bands.length - 1;
|
|
7956
8745
|
const align = isFirst ? "left" : isLast ? "right" : "center";
|
|
7957
8746
|
const frameX = isFirst ? x : isLast ? x - LABEL_SIZE : x - LABEL_SIZE / 2;
|
|
7958
|
-
const label =
|
|
8747
|
+
const label = chunkKXYSO6GC_cjs.chartText({
|
|
7959
8748
|
id: `chart-treemap-legend-tick-label-${chart.id}-${index}`,
|
|
7960
8749
|
order: nextOrder(),
|
|
7961
8750
|
bounds,
|
|
7962
|
-
frame: { x: frameX, y: barY + BAR_THICKNESS +
|
|
7963
|
-
text:
|
|
8751
|
+
frame: { x: frameX, y: barY + BAR_THICKNESS + TICK_LENGTH2 + ROW_GAP2, width: LABEL_SIZE, height: labelHeight },
|
|
8752
|
+
text: chunkKXYSO6GC_cjs.formatFieldValue(value),
|
|
7964
8753
|
chart,
|
|
7965
8754
|
align
|
|
7966
8755
|
});
|
|
7967
8756
|
return [tick, label];
|
|
7968
8757
|
});
|
|
7969
|
-
return [bar, ...
|
|
8758
|
+
return [bar, ...ticks2];
|
|
7970
8759
|
}
|
|
7971
8760
|
function renderSideLegend(context, layout) {
|
|
7972
8761
|
const { chart, plot, bounds, nextOrder } = context;
|
|
@@ -7974,7 +8763,7 @@ function renderSideLegend(context, layout) {
|
|
|
7974
8763
|
const barTop = plot.y;
|
|
7975
8764
|
const barHeight = layout.gridHeight;
|
|
7976
8765
|
const barX = side === "left" ? plot.x - CHART_GAP - BAR_THICKNESS : plot.x + layout.gridWidth + CHART_GAP;
|
|
7977
|
-
const barBounds =
|
|
8766
|
+
const barBounds = chunkKXYSO6GC_cjs.boxBounds({ x: barX, y: barTop, width: BAR_THICKNESS, height: barHeight });
|
|
7978
8767
|
const stops = bandStops(layout);
|
|
7979
8768
|
const bar = {
|
|
7980
8769
|
type: "rect",
|
|
@@ -7988,15 +8777,15 @@ function renderSideLegend(context, layout) {
|
|
|
7988
8777
|
rx: 3,
|
|
7989
8778
|
zoneGradient: { axis: "y", min: chart.axisY.min, max: chart.axisY.max },
|
|
7990
8779
|
style: {
|
|
7991
|
-
fill: stops.length ? { kind: "linear-gradient", angle: 270, stops } : { kind: "solid", color:
|
|
8780
|
+
fill: stops.length ? { kind: "linear-gradient", angle: 270, stops } : { kind: "solid", color: chunkKXYSO6GC_cjs.DEFAULT_ZONE_FILL },
|
|
7992
8781
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
7993
8782
|
strokeWidth: 1
|
|
7994
8783
|
}
|
|
7995
8784
|
};
|
|
7996
8785
|
const tickX = side === "left" ? barX : barX + BAR_THICKNESS;
|
|
7997
|
-
const tickEndX = side === "left" ? tickX -
|
|
8786
|
+
const tickEndX = side === "left" ? tickX - TICK_LENGTH2 : tickX + TICK_LENGTH2;
|
|
7998
8787
|
const labelX2 = side === "left" ? tickEndX - ROW_GAP2 - LABEL_SIZE : tickEndX + ROW_GAP2;
|
|
7999
|
-
const
|
|
8788
|
+
const ticks2 = layout.bands.flatMap((value, index) => {
|
|
8000
8789
|
const y = barTop + (1 - bandRatio2(layout, value)) * barHeight;
|
|
8001
8790
|
const tick = {
|
|
8002
8791
|
type: "path",
|
|
@@ -8010,18 +8799,18 @@ function renderSideLegend(context, layout) {
|
|
|
8010
8799
|
strokeWidth: 1
|
|
8011
8800
|
}
|
|
8012
8801
|
};
|
|
8013
|
-
const label =
|
|
8802
|
+
const label = chunkKXYSO6GC_cjs.chartText({
|
|
8014
8803
|
id: `chart-treemap-legend-tick-label-${chart.id}-${index}`,
|
|
8015
8804
|
order: nextOrder(),
|
|
8016
8805
|
bounds,
|
|
8017
8806
|
frame: { x: labelX2, y: y - layout.fontSize / 2, width: LABEL_SIZE, height: layout.fontSize + 2 },
|
|
8018
|
-
text:
|
|
8807
|
+
text: chunkKXYSO6GC_cjs.formatFieldValue(value),
|
|
8019
8808
|
chart,
|
|
8020
8809
|
align: side === "left" ? "right" : "left"
|
|
8021
8810
|
});
|
|
8022
8811
|
return [tick, label];
|
|
8023
8812
|
});
|
|
8024
|
-
return [bar, ...
|
|
8813
|
+
return [bar, ...ticks2];
|
|
8025
8814
|
}
|
|
8026
8815
|
|
|
8027
8816
|
// src/renderScene/charts/renderers/treemap/tiles.ts
|
|
@@ -8103,7 +8892,7 @@ function renderTreemapHeader(context, layout, header, index) {
|
|
|
8103
8892
|
};
|
|
8104
8893
|
const smallFontSize = Math.max(8, Math.max(9, chart.fontSize ?? 12) - 1);
|
|
8105
8894
|
const label = {
|
|
8106
|
-
...
|
|
8895
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
8107
8896
|
id: `chart-treemap-header-label-${chart.id}-${index}`,
|
|
8108
8897
|
order: nextOrder(),
|
|
8109
8898
|
bounds,
|
|
@@ -8118,7 +8907,7 @@ function renderTreemapHeader(context, layout, header, index) {
|
|
|
8118
8907
|
align: "center"
|
|
8119
8908
|
}),
|
|
8120
8909
|
fontSize: smallFontSize,
|
|
8121
|
-
color:
|
|
8910
|
+
color: chunkKXYSO6GC_cjs.contrastTextColor(fill2)
|
|
8122
8911
|
};
|
|
8123
8912
|
return [background, label];
|
|
8124
8913
|
}
|
|
@@ -8134,7 +8923,7 @@ function renderTile(context, layout, tile, nextTile) {
|
|
|
8134
8923
|
function createTileNode(context, layout, tile, color, nextColor) {
|
|
8135
8924
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
8136
8925
|
const gap = layout.cellGap;
|
|
8137
|
-
const shadow =
|
|
8926
|
+
const shadow = chunkKXYSO6GC_cjs.resolveChartShadow(chart.shadowStyle);
|
|
8138
8927
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
8139
8928
|
const tileX = plot.x + tile.x + gap / 2;
|
|
8140
8929
|
const tileY = plot.y + tile.y + gap / 2;
|
|
@@ -8151,10 +8940,10 @@ function createTileNode(context, layout, tile, color, nextColor) {
|
|
|
8151
8940
|
kind: "linear-gradient",
|
|
8152
8941
|
angle: 0,
|
|
8153
8942
|
stops: [
|
|
8154
|
-
{ offset: 0, color:
|
|
8155
|
-
{ offset: 100, color:
|
|
8943
|
+
{ offset: 0, color: chunkKXYSO6GC_cjs.representativeColor(color, fallback) },
|
|
8944
|
+
{ offset: 100, color: chunkKXYSO6GC_cjs.representativeColor(nextColor, fallback) }
|
|
8156
8945
|
]
|
|
8157
|
-
} :
|
|
8946
|
+
} : chunkKXYSO6GC_cjs.paint(color, diagnostics, chart.id);
|
|
8158
8947
|
return {
|
|
8159
8948
|
type: "rect",
|
|
8160
8949
|
id: `chart-treemap-tile-${chart.id}-${tile.item.leaf.id}`,
|
|
@@ -8168,7 +8957,7 @@ function createTileNode(context, layout, tile, color, nextColor) {
|
|
|
8168
8957
|
style: {
|
|
8169
8958
|
fill: fill2,
|
|
8170
8959
|
stroke: { kind: "solid", color: chart.config?.tileStrokeColor ?? chart.gridColor ?? "#e2e8f0" },
|
|
8171
|
-
strokeWidth:
|
|
8960
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.config?.tileStrokeWidth, chunkKXYSO6GC_cjs.finite(chart.gridWidth, 1)),
|
|
8172
8961
|
shadow,
|
|
8173
8962
|
clip: clipPath ? { type: "path", d: clipPath } : void 0
|
|
8174
8963
|
}
|
|
@@ -8183,12 +8972,12 @@ function createTileLabel(context, layout, tile, color) {
|
|
|
8183
8972
|
const height = Math.max(1, tile.height - gap - pad * 1.5);
|
|
8184
8973
|
const x = plot.x + tile.x + gap / 2 + pad;
|
|
8185
8974
|
const y = plot.y + tile.y + gap / 2 + pad * 0.75;
|
|
8186
|
-
const textColor = chart.config?.tileTextColor ??
|
|
8975
|
+
const textColor = chart.config?.tileTextColor ?? chunkKXYSO6GC_cjs.contrastTextColor(chunkKXYSO6GC_cjs.representativeColor(color, "#ffffff"));
|
|
8187
8976
|
const lineHeight = layout.labelSize * 1.2;
|
|
8188
8977
|
const maxLines = Math.max(1, Math.floor(height / lineHeight));
|
|
8189
|
-
const labelLines =
|
|
8978
|
+
const labelLines = chunkKXYSO6GC_cjs.wrapText(leaf.label, width, layout.labelSize).slice(0, maxLines).map((line) => chunkKXYSO6GC_cjs.ellipsizeToWidth(line, width, layout.labelSize, true));
|
|
8190
8979
|
const label = {
|
|
8191
|
-
...
|
|
8980
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
8192
8981
|
id: `chart-treemap-label-${chart.id}-${leaf.id}`,
|
|
8193
8982
|
order: nextOrder(),
|
|
8194
8983
|
bounds,
|
|
@@ -8202,12 +8991,12 @@ function createTileLabel(context, layout, tile, color) {
|
|
|
8202
8991
|
color: textColor
|
|
8203
8992
|
};
|
|
8204
8993
|
const valueText = String(value);
|
|
8205
|
-
const valueFits = labelLines.length * lineHeight + layout.valueSize * 1.2 <= height + 2 &&
|
|
8994
|
+
const valueFits = labelLines.length * lineHeight + layout.valueSize * 1.2 <= height + 2 && chunkKXYSO6GC_cjs.estimateTextWidth(valueText, layout.valueSize, false) <= width;
|
|
8206
8995
|
if (chart.config?.showTileValues === false || !valueFits) {
|
|
8207
8996
|
return [label];
|
|
8208
8997
|
}
|
|
8209
8998
|
const valueNode = {
|
|
8210
|
-
...
|
|
8999
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
8211
9000
|
id: `chart-treemap-value-${chart.id}-${leaf.id}`,
|
|
8212
9001
|
order: nextOrder(),
|
|
8213
9002
|
bounds,
|
|
@@ -8284,7 +9073,7 @@ function buildCartesianChart(foundation) {
|
|
|
8284
9073
|
|
|
8285
9074
|
// src/renderScene/charts/chartFrame.ts
|
|
8286
9075
|
function scaleDetail(chart, plot) {
|
|
8287
|
-
const horizontal =
|
|
9076
|
+
const horizontal = chunkKXYSO6GC_cjs.isHorizontalBar(chart);
|
|
8288
9077
|
const range = horizontal ? `${plot.x},${plot.width}` : `${plot.y},${plot.height}`;
|
|
8289
9078
|
return {
|
|
8290
9079
|
of: "chartScale",
|
|
@@ -8292,7 +9081,7 @@ function scaleDetail(chart, plot) {
|
|
|
8292
9081
|
};
|
|
8293
9082
|
}
|
|
8294
9083
|
function pieDetail(chart, plot) {
|
|
8295
|
-
const { outerRadius, innerRadius, cornerRadius } =
|
|
9084
|
+
const { outerRadius, innerRadius, cornerRadius } = chunkKXYSO6GC_cjs.resolvePieRadii(
|
|
8296
9085
|
plot.width,
|
|
8297
9086
|
plot.height,
|
|
8298
9087
|
chart.config?.innerRadius,
|
|
@@ -8305,8 +9094,8 @@ function pieDetail(chart, plot) {
|
|
|
8305
9094
|
}
|
|
8306
9095
|
function polarAreaDetail(chart, plot) {
|
|
8307
9096
|
const maxRadius = Math.max(1, Math.min(plot.width, plot.height) / 2 - 4);
|
|
8308
|
-
const innerRadius = Math.max(0, Math.min(
|
|
8309
|
-
const cornerRadius = Math.max(0,
|
|
9097
|
+
const innerRadius = Math.max(0, Math.min(chunkKXYSO6GC_cjs.finite(chart.config?.innerRadius, 0), maxRadius - 1));
|
|
9098
|
+
const cornerRadius = Math.max(0, chunkKXYSO6GC_cjs.finite(chart.config?.pieCornerRadius, 0));
|
|
8310
9099
|
return {
|
|
8311
9100
|
of: "pieGeometry",
|
|
8312
9101
|
pieGeometry: `${plot.x + plot.width / 2},${plot.y + plot.height / 2},${maxRadius},${innerRadius},${cornerRadius}`
|
|
@@ -8315,8 +9104,8 @@ function polarAreaDetail(chart, plot) {
|
|
|
8315
9104
|
function radarDetail(chart, plot) {
|
|
8316
9105
|
const configuredCount = (chart.config?.categories?.filter(Boolean) ?? []).length;
|
|
8317
9106
|
const dataCount = Math.max(0, ...chart.series.map((series) => series.values.length));
|
|
8318
|
-
const count =
|
|
8319
|
-
const radius =
|
|
9107
|
+
const count = chunkKXYSO6GC_cjs.radarCategoryCount(configuredCount, dataCount);
|
|
9108
|
+
const radius = chunkKXYSO6GC_cjs.radarRadius(plot.width, plot.height, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12), chart.showAxisLabels !== false);
|
|
8320
9109
|
const centerX = plot.x + plot.width / 2;
|
|
8321
9110
|
const centerY = plot.y + plot.height / 2;
|
|
8322
9111
|
const curved = chart.chartType === "radial" ? 1 : 0;
|
|
@@ -8350,9 +9139,9 @@ function buildChartFrame(chart, bounds, plot, order) {
|
|
|
8350
9139
|
height: chart.height,
|
|
8351
9140
|
rx: chart.cornerRadius ?? 12,
|
|
8352
9141
|
style: {
|
|
8353
|
-
fill:
|
|
9142
|
+
fill: chunkKXYSO6GC_cjs.paint(chart.fillColor ?? "#ffffff", [], chart.id),
|
|
8354
9143
|
stroke: { kind: "solid", color: chart.strokeColor ?? "#475569" },
|
|
8355
|
-
strokeWidth:
|
|
9144
|
+
strokeWidth: chunkKXYSO6GC_cjs.finite(chart.strokeWidth, 1)
|
|
8356
9145
|
}
|
|
8357
9146
|
};
|
|
8358
9147
|
const detail = frameDetail(chart, plot);
|
|
@@ -8412,7 +9201,7 @@ function buildChartTitle(chart, bounds, plot, renderOrder) {
|
|
|
8412
9201
|
}
|
|
8413
9202
|
return [
|
|
8414
9203
|
{
|
|
8415
|
-
...
|
|
9204
|
+
...chunkKXYSO6GC_cjs.chartText({
|
|
8416
9205
|
id: `chart-title-${chart.id}`,
|
|
8417
9206
|
order: renderOrder.next(),
|
|
8418
9207
|
bounds,
|
|
@@ -8422,8 +9211,8 @@ function buildChartTitle(chart, bounds, plot, renderOrder) {
|
|
|
8422
9211
|
}),
|
|
8423
9212
|
...chart.titleColor ? { color: chart.titleColor } : {},
|
|
8424
9213
|
fontWeight: chart.titleWeight ?? "bold",
|
|
8425
|
-
fontSize:
|
|
8426
|
-
prop:
|
|
9214
|
+
fontSize: chunkKXYSO6GC_cjs.finite(chart.titleSize, Math.max(10, chunkKXYSO6GC_cjs.finite(chart.fontSize, 12)) + 2),
|
|
9215
|
+
prop: chunkKXYSO6GC_cjs.CHART_TITLE_PROP
|
|
8427
9216
|
}
|
|
8428
9217
|
];
|
|
8429
9218
|
}
|
|
@@ -8476,14 +9265,14 @@ function buildChart(chart, index, diagnostics) {
|
|
|
8476
9265
|
// src/renderScene/charts/artifacts.ts
|
|
8477
9266
|
function buildCharts(charts, diagnostics) {
|
|
8478
9267
|
return charts.flatMap(
|
|
8479
|
-
(chart, index) =>
|
|
9268
|
+
(chart, index) => chunkKXYSO6GC_cjs.tag(buildChart(chart, index, diagnostics), "chart", chart.id, chart.chartType, chart.title ?? "Chart")
|
|
8480
9269
|
);
|
|
8481
9270
|
}
|
|
8482
9271
|
|
|
8483
9272
|
// src/renderScene/scene/build.ts
|
|
8484
9273
|
function sceneBounds(nodes) {
|
|
8485
9274
|
if (!nodes.length) {
|
|
8486
|
-
return
|
|
9275
|
+
return chunkKXYSO6GC_cjs.EMPTY_BOUNDS;
|
|
8487
9276
|
}
|
|
8488
9277
|
return {
|
|
8489
9278
|
minX: Math.min(...nodes.map((n) => n.bounds.minX)),
|
|
@@ -8497,8 +9286,8 @@ function stackingOf(input) {
|
|
|
8497
9286
|
const add = (role, objects, legacyBase) => {
|
|
8498
9287
|
objects.forEach((object, index) => {
|
|
8499
9288
|
stacking.set(`${role}:${object.id}`, {
|
|
8500
|
-
rank:
|
|
8501
|
-
sequence:
|
|
9289
|
+
rank: chunkKXYSO6GC_cjs.stackRank(object),
|
|
9290
|
+
sequence: chunkKXYSO6GC_cjs.stackSequence(object, legacyBase + index)
|
|
8502
9291
|
});
|
|
8503
9292
|
});
|
|
8504
9293
|
};
|
|
@@ -8514,6 +9303,7 @@ function stackingOf(input) {
|
|
|
8514
9303
|
);
|
|
8515
9304
|
add("chart", input.charts ?? [], 2e4);
|
|
8516
9305
|
add("path", input.paths ?? [], 3e4);
|
|
9306
|
+
add("dimension", input.dimensions ?? [], 31e3);
|
|
8517
9307
|
return stacking;
|
|
8518
9308
|
}
|
|
8519
9309
|
function stampStacking(nodes, input) {
|
|
@@ -8534,7 +9324,8 @@ function buildRenderScene(input, options = {}) {
|
|
|
8534
9324
|
...buildLinks(input.links, measureText),
|
|
8535
9325
|
...buildShapes(input.shapes, diagnostics, measureText),
|
|
8536
9326
|
...buildComponents(input.components ?? input.widgets ?? []),
|
|
8537
|
-
...buildIsometricObjects(input.isometricObjects ?? [])
|
|
9327
|
+
...buildIsometricObjects(input.isometricObjects ?? []),
|
|
9328
|
+
...buildDimensions(input.dimensions ?? [])
|
|
8538
9329
|
];
|
|
8539
9330
|
stampStacking(nodes, input);
|
|
8540
9331
|
nodes.sort(
|
|
@@ -8844,6 +9635,12 @@ function addStrokeAttrs(attrs, style) {
|
|
|
8844
9635
|
if (style.pointerEvents) {
|
|
8845
9636
|
attrs.push(`pointer-events="${style.pointerEvents}"`);
|
|
8846
9637
|
}
|
|
9638
|
+
if (style.transition && style.transition > 0) {
|
|
9639
|
+
const time = `${num(style.transition)}ms ease`;
|
|
9640
|
+
attrs.push(
|
|
9641
|
+
`style="transition: x ${time}, y ${time}, width ${time}, height ${time}, cx ${time}, cy ${time}, rx ${time}, ry ${time}, fill ${time}, stroke ${time}, stroke-width ${time}, stroke-dasharray ${time}, opacity ${time}"`
|
|
9642
|
+
);
|
|
9643
|
+
}
|
|
8847
9644
|
}
|
|
8848
9645
|
function elementSize(node) {
|
|
8849
9646
|
const shape = node;
|
|
@@ -8974,31 +9771,31 @@ function chartSeriesAttrs(detail) {
|
|
|
8974
9771
|
];
|
|
8975
9772
|
}
|
|
8976
9773
|
function frameBoundaryAttrs(detail) {
|
|
8977
|
-
return [`${
|
|
9774
|
+
return [`${chunkKXYSO6GC_cjs.CORNER_RADIUS_ATTR}="${num(detail.cornerRadius)}"`, `${chunkKXYSO6GC_cjs.SQUARE_CORNER_ATTR}="${detail.squareCorner}"`];
|
|
8978
9775
|
}
|
|
8979
9776
|
function declaredBoundsAttr(bounds) {
|
|
8980
|
-
return `${
|
|
9777
|
+
return `${chunkKXYSO6GC_cjs.SYMBOL_BOUNDS_ATTR}="${num(bounds.x)},${num(bounds.y)},${num(bounds.width)},${num(bounds.height)}"`;
|
|
8981
9778
|
}
|
|
8982
9779
|
function symbolGeometryAttrs(detail) {
|
|
8983
9780
|
return [
|
|
8984
|
-
`${
|
|
8985
|
-
`${
|
|
9781
|
+
`${chunkKXYSO6GC_cjs.SYMBOL_POINTS_ATTR}="${xml(JSON.stringify(detail.points))}"`,
|
|
9782
|
+
`${chunkKXYSO6GC_cjs.SYMBOL_TENSION_ATTR}="${num(detail.tension)}"`,
|
|
8986
9783
|
declaredBoundsAttr(detail.declaredBounds)
|
|
8987
9784
|
];
|
|
8988
9785
|
}
|
|
8989
9786
|
function pathGeometryAttrs(detail) {
|
|
8990
9787
|
return [
|
|
8991
|
-
`${
|
|
8992
|
-
`${
|
|
8993
|
-
`${
|
|
9788
|
+
`${chunkKXYSO6GC_cjs.PATH_POINTS_ATTR}="${xml(JSON.stringify(detail.points))}"`,
|
|
9789
|
+
`${chunkKXYSO6GC_cjs.PATH_TENSION_ATTR}="${num(detail.tension)}"`,
|
|
9790
|
+
`${chunkKXYSO6GC_cjs.PATH_CLOSED_ATTR}="${detail.closed}"`
|
|
8994
9791
|
];
|
|
8995
9792
|
}
|
|
8996
9793
|
function isometricGeometryAttrs(detail) {
|
|
8997
9794
|
return [
|
|
8998
|
-
`${
|
|
8999
|
-
`${
|
|
9795
|
+
`${chunkKXYSO6GC_cjs.ISOMETRIC_SIZE_ATTR}="${num(detail.width)},${num(detail.height)},${num(detail.depth)}"`,
|
|
9796
|
+
`${chunkKXYSO6GC_cjs.CORNER_RADIUS_ATTR}="${num(detail.cornerRadius)}"`,
|
|
9000
9797
|
declaredBoundsAttr(detail.bounds),
|
|
9001
|
-
`${
|
|
9798
|
+
`${chunkKXYSO6GC_cjs.ISOMETRIC_LABEL_OFFSET_ATTR}="${num(detail.labelOffsetX)},${num(detail.labelOffsetY)}"`
|
|
9002
9799
|
];
|
|
9003
9800
|
}
|
|
9004
9801
|
function linkDetailAttrs(detail) {
|
|
@@ -9093,8 +9890,9 @@ function lineOffset(index, linePx) {
|
|
|
9093
9890
|
function shaderSurfaceSvg(node, defs) {
|
|
9094
9891
|
const rotation = transform(node.rotation, { x: node.x + node.width / 2, y: node.y + node.height / 2 });
|
|
9095
9892
|
const parameters = xml(JSON.stringify(node.shader.parameters));
|
|
9893
|
+
const surfacePadding = node.shader.surfacePadding ?? 0;
|
|
9096
9894
|
const fillColor = node.fillColor ? ` data-sf-shader-fill="${xml(node.fillColor)}"` : "";
|
|
9097
|
-
return `<foreignObject id="${defs.elementId(node.id)}"${contractAttrs(node)} data-sf-shader="${xml(node.shader.program)}" data-sf-shader-name="${xml(node.shader.name)}" data-sf-shader-params="${parameters}" data-sf-shader-mask="${node.mask}"${fillColor} x="${num(node.x)}" y="${num(node.y)}" width="${num(node.width)}" height="${num(node.height)}"${rotation} pointer-events="${node.shader.program === "ruler" || node.identity?.role === "widget" ? "all" : "none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`;
|
|
9895
|
+
return `<foreignObject id="${defs.elementId(node.id)}"${contractAttrs(node)} data-sf-shader="${xml(node.shader.program)}" data-sf-shader-name="${xml(node.shader.name)}" data-sf-shader-params="${parameters}" data-sf-shader-mask="${node.mask}" data-sf-shader-padding="${num(surfacePadding)}"${fillColor} x="${num(node.x)}" y="${num(node.y)}" width="${num(node.width)}" height="${num(node.height)}"${rotation} pointer-events="${node.shader.program === "ruler" || node.identity?.role === "widget" ? "all" : "none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`;
|
|
9098
9896
|
}
|
|
9099
9897
|
function rollingDigitSvg(character, node) {
|
|
9100
9898
|
const style = node.componentStyle;
|
|
@@ -9144,7 +9942,7 @@ function renderSvgDocument(scene, options = {}) {
|
|
|
9144
9942
|
const nodes = options.linkHitAreas ? withLinkHitAreas(scene.nodes) : scene.nodes;
|
|
9145
9943
|
const body = nodes.map((node) => nodeSvg(node, defs)).join("\n ");
|
|
9146
9944
|
const declaration = options.includeXmlDeclaration === false ? "" : '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
9147
|
-
const svg = `${declaration}<svg xmlns="http://www.w3.org/2000/svg" width="${num(width)}px" height="${num(height)}px" viewBox="${viewBox}" role="img" data-sf-contract="${
|
|
9945
|
+
const svg = `${declaration}<svg xmlns="http://www.w3.org/2000/svg" width="${num(width)}px" height="${num(height)}px" viewBox="${viewBox}" role="img" data-sf-contract="${chunkKXYSO6GC_cjs.DOM_CONTRACT_VERSION}">
|
|
9148
9946
|
<defs>${defs.entries.join("")}</defs>
|
|
9149
9947
|
${body}
|
|
9150
9948
|
</svg>`;
|
|
@@ -9164,9 +9962,9 @@ function renderCanvas(input, options = {}) {
|
|
|
9164
9962
|
}
|
|
9165
9963
|
var SCENE_CACHE_LIMIT = 50;
|
|
9166
9964
|
var sceneCache = /* @__PURE__ */ new Map();
|
|
9167
|
-
var cachedForRegistry =
|
|
9965
|
+
var cachedForRegistry = chunkKXYSO6GC_cjs.componentRegistryVersion();
|
|
9168
9966
|
function cachedRenderScene(source) {
|
|
9169
|
-
const registry =
|
|
9967
|
+
const registry = chunkKXYSO6GC_cjs.componentRegistryVersion();
|
|
9170
9968
|
if (registry !== cachedForRegistry) {
|
|
9171
9969
|
sceneCache.clear();
|
|
9172
9970
|
cachedForRegistry = registry;
|
|
@@ -9198,7 +9996,7 @@ function render(source, options = {}) {
|
|
|
9198
9996
|
var SCENE_ORDER_BASE = 1e4;
|
|
9199
9997
|
function defineComponent(definition) {
|
|
9200
9998
|
const { scene, ...descriptor } = definition;
|
|
9201
|
-
const unregisterDescriptor =
|
|
9999
|
+
const unregisterDescriptor = chunkKXYSO6GC_cjs.registerComponentDescriptor(descriptor);
|
|
9202
10000
|
const unregisterBuilder = registerComponentBuilder(
|
|
9203
10001
|
descriptor.type,
|
|
9204
10002
|
(component, index) => scene(component, { order: SCENE_ORDER_BASE + index })
|
|
@@ -9216,5 +10014,6 @@ exports.defineComponent = defineComponent;
|
|
|
9216
10014
|
exports.render = render;
|
|
9217
10015
|
exports.renderCanvas = renderCanvas;
|
|
9218
10016
|
exports.sflToRenderInput = sflToRenderInput;
|
|
9219
|
-
|
|
9220
|
-
//# sourceMappingURL=chunk-
|
|
10017
|
+
exports.sliderReach = sliderReach;
|
|
10018
|
+
//# sourceMappingURL=chunk-A73UJ5AQ.cjs.map
|
|
10019
|
+
//# sourceMappingURL=chunk-A73UJ5AQ.cjs.map
|