stickyflow 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/dist/{chunk-KFJIFHXG.js → chunk-65IVT4GK.js} +475 -199
- package/dist/chunk-65IVT4GK.js.map +1 -0
- package/dist/{chunk-6JKNT2YC.js → chunk-BYMIYXP5.js} +17 -7
- package/dist/chunk-BYMIYXP5.js.map +1 -0
- package/dist/{chunk-N6WVHOUQ.js → chunk-CSXQD3ON.js} +28 -15
- package/dist/chunk-CSXQD3ON.js.map +1 -0
- package/dist/{chunk-YM3XFBI4.cjs → chunk-CXL254BT.cjs} +17 -6
- package/dist/chunk-CXL254BT.cjs.map +1 -0
- package/dist/{chunk-S5BVAAEF.cjs → chunk-DDCTNLLD.cjs} +989 -713
- package/dist/chunk-DDCTNLLD.cjs.map +1 -0
- package/dist/{chunk-34PK7HEU.cjs → chunk-HFOGKSNU.cjs} +18 -18
- package/dist/{chunk-34PK7HEU.cjs.map → chunk-HFOGKSNU.cjs.map} +1 -1
- package/dist/{chunk-IIOJFR73.cjs → chunk-UXDWH2JC.cjs} +56 -43
- package/dist/chunk-UXDWH2JC.cjs.map +1 -0
- package/dist/{chunk-6LQJUAD4.js → chunk-XEN5QIIJ.js} +6 -6
- package/dist/{chunk-6LQJUAD4.js.map → chunk-XEN5QIIJ.js.map} +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/interaction/index.cjs +780 -382
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +12 -3
- package/dist/interaction/index.d.ts +12 -3
- package/dist/interaction/index.js +562 -165
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-r1GYvjNm.d.cts → render-C5X74hds.d.cts} +75 -4
- package/dist/{render-r1GYvjNm.d.ts → render-C5X74hds.d.ts} +75 -4
- package/dist/{runtimeTypes-ByiafBwg.d.ts → runtimeTypes-D8hPZ62T.d.ts} +1 -1
- package/dist/{runtimeTypes-DwLeD-em.d.cts → runtimeTypes-yTSAvtCn.d.cts} +1 -1
- package/dist/stickyflow-diagram.global.js +37 -35
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-T7W2yTQF.d.cts → types-BDKDf4zr.d.cts} +1 -1
- package/dist/{types-ndGA1kbl.d.ts → types-CdgGdtoD.d.ts} +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +4 -4
- package/dist/viewer/index.d.ts +4 -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-6JKNT2YC.js.map +0 -1
- package/dist/chunk-IIOJFR73.cjs.map +0 -1
- package/dist/chunk-KFJIFHXG.js.map +0 -1
- package/dist/chunk-N6WVHOUQ.js.map +0 -1
- package/dist/chunk-S5BVAAEF.cjs.map +0 -1
- package/dist/chunk-YM3XFBI4.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isIsometricObject, sflToCanvasState, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, isometricFaces, roundedPolygonPath, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, DEFAULT_FONT, personLabelArea, wrapText, heuristicRichMeasure, isometricBounds, deriveFaceFills, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricTopFaceCenter, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, ISOMETRIC_SIZE_ATTR, CORNER_RADIUS_ATTR, ISOMETRIC_LABEL_OFFSET_ATTR, PATH_POINTS_ATTR, PATH_TENSION_ATTR, PATH_CLOSED_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, SQUARE_CORNER_ATTR, resolvePieRadii, radarCategoryCount, radarRadius, createPieGeometry, DEFAULT_HEX_RADIUS, DEFAULT_HEATMAP_ZONES, axisBands, DEFAULT_ZONE_FILL, representativeColor, computeBoxplotStats, barCategoryCount, ruleAtProp, ruleTextProp, seriesLabelProp, axisLabelProp, seriesColorProp, seriesValueProp, radarSeriesPath, radarRadiusForValue, createPieSlicePath, clipSegmentToRect, formatFieldValue, renderPieLabels, contrastTextColor, sameHueTint, isLightColor, barShapePath, linePathData, colorWithAlpha, estimateTextWidth, segmentedBarPath, roundedBarPath, radarPointAt, gapInsetAngle, pieUsesInnerArc, maxPieCornerRadius, pieApexRadius, maxApexCornerRadius, pieArcPoint, sameHueContrastColor, zoneColorAtValue, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize,
|
|
1
|
+
import { isIsometricObject, sflToCanvasState, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, isometricFaces, roundedPolygonPath, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, DEFAULT_FONT, personLabelArea, wrapText, heuristicRichMeasure, isometricBounds, deriveFaceFills, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricTopFaceCenter, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, ISOMETRIC_SIZE_ATTR, CORNER_RADIUS_ATTR, ISOMETRIC_LABEL_OFFSET_ATTR, PATH_POINTS_ATTR, PATH_TENSION_ATTR, PATH_CLOSED_ATTR, SYMBOL_BOUNDS_ATTR, SYMBOL_POINTS_ATTR, SYMBOL_TENSION_ATTR, SQUARE_CORNER_ATTR, resolvePieRadii, radarCategoryCount, radarRadius, createPieGeometry, DEFAULT_HEX_RADIUS, DEFAULT_HEATMAP_ZONES, axisBands, DEFAULT_ZONE_FILL, representativeColor, computeBoxplotStats, barCategoryCount, ruleAtProp, ruleTextProp, seriesLabelProp, axisLabelProp, seriesColorProp, seriesValueProp, radarSeriesPath, radarRadiusForValue, createPieSlicePath, clipSegmentToRect, formatFieldValue, renderPieLabels, interpolateHexColorStops, contrastTextColor, sameHueTint, isLightColor, barShapePath, linePathData, colorWithAlpha, estimateTextWidth, segmentedBarPath, roundedBarPath, radarPointAt, gapInsetAngle, pieUsesInnerArc, maxPieCornerRadius, pieApexRadius, maxApexCornerRadius, pieArcPoint, sameHueContrastColor, zoneColorAtValue, ellipsizeToWidth, barPath, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize, CATEGORY_LABEL_ROW, BAR_LABEL, pillPath } from './chunk-BYMIYXP5.js';
|
|
2
2
|
|
|
3
3
|
// src/renderInput/styleDecoding/colorToken.ts
|
|
4
4
|
var COLOR_TOKEN_PATTERN = String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;
|
|
@@ -339,17 +339,31 @@ function lineConfig(source, p) {
|
|
|
339
339
|
highlightLabelFormat: p.highlightLabelFormat
|
|
340
340
|
};
|
|
341
341
|
}
|
|
342
|
-
function scatterConfig(source) {
|
|
343
|
-
return {
|
|
342
|
+
function scatterConfig(source, p) {
|
|
343
|
+
return {
|
|
344
|
+
categories: source?.categories,
|
|
345
|
+
pointSize: numOf(p.pointSize),
|
|
346
|
+
pointOpacity: numOf(p.pointOpacity),
|
|
347
|
+
pointStrokeWidth: numOf(p.pointStrokeWidth),
|
|
348
|
+
pointStrokeColor: p.pointStrokeColor
|
|
349
|
+
};
|
|
344
350
|
}
|
|
345
|
-
function boxplotConfig(source) {
|
|
351
|
+
function boxplotConfig(source, p) {
|
|
346
352
|
return {
|
|
347
353
|
boxWidth: source?.boxWidth,
|
|
348
354
|
orientation: source?.orientation,
|
|
349
355
|
barCornerRadius: source?.barCornerRadius,
|
|
350
356
|
showBoxplotPoints: source?.showBoxplotPoints,
|
|
351
357
|
barBorderColor: source?.barBorderColor,
|
|
352
|
-
barBorderWidth: source?.barBorderWidth
|
|
358
|
+
barBorderWidth: source?.barBorderWidth,
|
|
359
|
+
boxWhiskerWidth: numOf(p.boxWhiskerWidth),
|
|
360
|
+
boxMedianWidth: numOf(p.boxMedianWidth),
|
|
361
|
+
boxMedianColor: p.boxMedianColor,
|
|
362
|
+
boxWhiskerColor: p.boxWhiskerColor,
|
|
363
|
+
boxCapSize: numOf(p.boxCapSize),
|
|
364
|
+
boxPointSize: numOf(p.boxPointSize),
|
|
365
|
+
boxPointOpacity: numOf(p.boxPointOpacity),
|
|
366
|
+
boxJitter: numOf(p.boxJitter)
|
|
353
367
|
};
|
|
354
368
|
}
|
|
355
369
|
function fieldConfig(source) {
|
|
@@ -360,26 +374,48 @@ function fieldConfig(source) {
|
|
|
360
374
|
isolines: source?.isolines
|
|
361
375
|
};
|
|
362
376
|
}
|
|
363
|
-
function heatmapConfig(source) {
|
|
377
|
+
function heatmapConfig(source, p) {
|
|
364
378
|
return {
|
|
365
379
|
categories: source?.categories,
|
|
366
380
|
zones: source?.zones,
|
|
367
381
|
cellGap: source?.cellGap,
|
|
368
382
|
showValues: source?.showValues,
|
|
369
383
|
squareCells: source?.squareCells,
|
|
370
|
-
barCornerRadius: source?.barCornerRadius
|
|
384
|
+
barCornerRadius: source?.barCornerRadius,
|
|
385
|
+
cellShape: p.cellShape === "circle" ? "circle" : p.cellShape === "square" ? "square" : void 0,
|
|
386
|
+
cellStrokeColor: p.cellStrokeColor,
|
|
387
|
+
cellStrokeWidth: numOf(p.cellStrokeWidth),
|
|
388
|
+
cellValueSize: numOf(p.cellValueSize),
|
|
389
|
+
cellValueColor: p.cellValueColor
|
|
371
390
|
};
|
|
372
391
|
}
|
|
373
|
-
function hexbinConfig(source) {
|
|
374
|
-
return {
|
|
392
|
+
function hexbinConfig(source, p) {
|
|
393
|
+
return {
|
|
394
|
+
hexRadius: source?.hexRadius,
|
|
395
|
+
scale: decodeRamp(source?.scale),
|
|
396
|
+
hexGap: numOf(p.hexGap),
|
|
397
|
+
hexStrokeWidth: numOf(p.hexStrokeWidth),
|
|
398
|
+
hexStrokeColor: p.hexStrokeColor,
|
|
399
|
+
hexMinOpacity: numOf(p.hexMinOpacity)
|
|
400
|
+
};
|
|
375
401
|
}
|
|
376
|
-
function mekkoConfig(source) {
|
|
402
|
+
function mekkoConfig(source, p) {
|
|
377
403
|
return {
|
|
378
404
|
categories: source?.categories,
|
|
379
405
|
barCornerRadius: source?.barCornerRadius,
|
|
380
406
|
mekkoVaryHeight: source?.mekkoVaryHeight,
|
|
381
407
|
tileGradient: source?.tileGradient,
|
|
382
|
-
showColumnBackdrop: source?.showColumnBackdrop
|
|
408
|
+
showColumnBackdrop: source?.showColumnBackdrop,
|
|
409
|
+
mekkoColumnGap: numOf(p.mekkoColumnGap),
|
|
410
|
+
mekkoSegmentGap: numOf(p.mekkoSegmentGap),
|
|
411
|
+
mekkoRoundAll: p.mekkoRoundAll === void 0 ? void 0 : String(p.mekkoRoundAll) !== "false",
|
|
412
|
+
mekkoSegmentStrokeColor: p.mekkoSegmentStrokeColor,
|
|
413
|
+
mekkoSegmentStrokeWidth: numOf(p.mekkoSegmentStrokeWidth),
|
|
414
|
+
mekkoLabelSize: numOf(p.mekkoLabelSize),
|
|
415
|
+
mekkoValueSize: numOf(p.mekkoValueSize),
|
|
416
|
+
mekkoTextColor: p.mekkoTextColor,
|
|
417
|
+
showMekkoTotals: p.showMekkoTotals === void 0 ? void 0 : String(p.showMekkoTotals) !== "false",
|
|
418
|
+
mekkoValueFormat: p.mekkoValueFormat === "percent" ? "percent" : p.mekkoValueFormat === "value" ? "value" : void 0
|
|
383
419
|
};
|
|
384
420
|
}
|
|
385
421
|
function pieConfig(source, p) {
|
|
@@ -401,57 +437,104 @@ function pieConfig(source, p) {
|
|
|
401
437
|
pieCenterColor: p.pieCenterColor
|
|
402
438
|
};
|
|
403
439
|
}
|
|
404
|
-
function polarAreaConfig(source) {
|
|
440
|
+
function polarAreaConfig(source, p) {
|
|
405
441
|
return {
|
|
406
442
|
innerRadius: source?.innerRadius,
|
|
407
443
|
pieCornerRadius: source?.pieCornerRadius,
|
|
408
|
-
pieSliceGap: source?.pieSliceGap
|
|
444
|
+
pieSliceGap: source?.pieSliceGap,
|
|
445
|
+
pieStartAngle: numOf(p.pieStartAngle),
|
|
446
|
+
pieStroke: p.pieStroke,
|
|
447
|
+
pieStrokeWidth: numOf(p.pieStrokeWidth),
|
|
448
|
+
polarTrackOpacity: numOf(p.polarTrackOpacity),
|
|
449
|
+
polarRings: p.polarRings === void 0 ? void 0 : String(p.polarRings) !== "false",
|
|
450
|
+
polarTrackStroke: p.polarTrackStroke,
|
|
451
|
+
polarTrackStrokeWidth: numOf(p.polarTrackStrokeWidth),
|
|
452
|
+
polarTrackDash: p.polarTrackDash,
|
|
453
|
+
polarValueSize: numOf(p.polarValueSize),
|
|
454
|
+
polarNameSize: numOf(p.polarNameSize),
|
|
455
|
+
polarValueFirst: p.polarValueFirst === void 0 ? void 0 : String(p.polarValueFirst) !== "false",
|
|
456
|
+
polarOutsideLabels: p.polarOutsideLabels === void 0 ? void 0 : String(p.polarOutsideLabels) !== "false"
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function radarStyle(p) {
|
|
460
|
+
return {
|
|
461
|
+
radarStrokeWidth: numOf(p.radarStrokeWidth),
|
|
462
|
+
radarPointSize: numOf(p.radarPointSize),
|
|
463
|
+
radarTension: numOf(p.radarTension),
|
|
464
|
+
radarSpokes: p.radarSpokes === void 0 ? void 0 : String(p.radarSpokes) !== "false"
|
|
409
465
|
};
|
|
410
466
|
}
|
|
411
|
-
function radarConfig(source) {
|
|
467
|
+
function radarConfig(source, p) {
|
|
412
468
|
return {
|
|
413
469
|
categories: source?.categories,
|
|
414
|
-
areaOpacity: source?.areaOpacity
|
|
470
|
+
areaOpacity: source?.areaOpacity,
|
|
471
|
+
...radarStyle(p)
|
|
415
472
|
};
|
|
416
473
|
}
|
|
417
|
-
function radialConfig(source) {
|
|
474
|
+
function radialConfig(source, p) {
|
|
418
475
|
return {
|
|
419
476
|
categories: source?.categories,
|
|
420
|
-
areaOpacity: source?.areaOpacity
|
|
477
|
+
areaOpacity: source?.areaOpacity,
|
|
478
|
+
...radarStyle(p)
|
|
421
479
|
};
|
|
422
480
|
}
|
|
423
|
-
function radialBarConfig(source) {
|
|
481
|
+
function radialBarConfig(source, p) {
|
|
424
482
|
return {
|
|
425
483
|
ringThickness: source?.ringThickness,
|
|
426
|
-
ringGap: source?.ringGap
|
|
484
|
+
ringGap: source?.ringGap,
|
|
485
|
+
ringTrackOpacity: numOf(p.ringTrackOpacity),
|
|
486
|
+
ringCap: p.ringCap === "butt" ? "butt" : p.ringCap === "round" ? "round" : void 0,
|
|
487
|
+
ringStartAngle: numOf(p.ringStartAngle),
|
|
488
|
+
ringSweep: numOf(p.ringSweep)
|
|
427
489
|
};
|
|
428
490
|
}
|
|
429
|
-
function sankeyConfig(source) {
|
|
491
|
+
function sankeyConfig(source, p) {
|
|
430
492
|
return {
|
|
431
493
|
zones: source?.zones,
|
|
432
494
|
barCornerRadius: source?.barCornerRadius,
|
|
433
495
|
labelPosition: source?.labelPosition,
|
|
434
496
|
labelOrientation: source?.labelOrientation,
|
|
435
497
|
labelColor: source?.labelColor,
|
|
436
|
-
linkGradient: source?.linkGradient
|
|
498
|
+
linkGradient: source?.linkGradient,
|
|
499
|
+
sankeyNodeWidth: numOf(p.sankeyNodeWidth),
|
|
500
|
+
sankeyNodeGap: numOf(p.sankeyNodeGap),
|
|
501
|
+
sankeyLinkOpacity: numOf(p.sankeyLinkOpacity),
|
|
502
|
+
sankeyLinkCurve: numOf(p.sankeyLinkCurve),
|
|
503
|
+
sankeyLabelSize: numOf(p.sankeyLabelSize)
|
|
437
504
|
};
|
|
438
505
|
}
|
|
439
|
-
function treemapConfig(source) {
|
|
506
|
+
function treemapConfig(source, p) {
|
|
440
507
|
return {
|
|
441
508
|
zones: source?.zones,
|
|
442
509
|
cellGap: source?.cellGap,
|
|
443
510
|
barCornerRadius: source?.barCornerRadius,
|
|
444
511
|
headerColor: source?.headerColor,
|
|
445
|
-
tileGradient: source?.tileGradient
|
|
512
|
+
tileGradient: source?.tileGradient,
|
|
513
|
+
tileStrokeColor: p.tileStrokeColor,
|
|
514
|
+
tileStrokeWidth: numOf(p.tileStrokeWidth),
|
|
515
|
+
tileLabelSize: numOf(p.tileLabelSize),
|
|
516
|
+
tileValueSize: numOf(p.tileValueSize),
|
|
517
|
+
tileTextColor: p.tileTextColor,
|
|
518
|
+
tileLabelPadding: numOf(p.tileLabelPadding),
|
|
519
|
+
showTileValues: p.showTileValues === void 0 ? void 0 : String(p.showTileValues) !== "false",
|
|
520
|
+
headerHeight: numOf(p.headerHeight)
|
|
446
521
|
};
|
|
447
522
|
}
|
|
448
|
-
function customConfig(source) {
|
|
523
|
+
function customConfig(source, p) {
|
|
449
524
|
return {
|
|
450
525
|
categories: source?.categories,
|
|
451
526
|
zones: source?.zones,
|
|
452
527
|
orientation: source?.orientation,
|
|
453
528
|
connectPoints: source?.connectPoints,
|
|
454
|
-
reverseComparison: source?.reverseComparison
|
|
529
|
+
reverseComparison: source?.reverseComparison,
|
|
530
|
+
customConnectorWidth: numOf(p.customConnectorWidth),
|
|
531
|
+
customConnectorOpacity: numOf(p.customConnectorOpacity),
|
|
532
|
+
customConnectorDash: p.customConnectorDash,
|
|
533
|
+
customBeforeFill: p.customBeforeFill,
|
|
534
|
+
customBeforeStroke: p.customBeforeStroke,
|
|
535
|
+
customBeforeStrokeWidth: numOf(p.customBeforeStrokeWidth),
|
|
536
|
+
customLabelSize: numOf(p.customLabelSize),
|
|
537
|
+
customLabelColor: p.customLabelColor
|
|
455
538
|
};
|
|
456
539
|
}
|
|
457
540
|
|
|
@@ -467,33 +550,33 @@ function chartObject(e) {
|
|
|
467
550
|
case "line":
|
|
468
551
|
return typedChart(base, chartType, lineConfig(source, p));
|
|
469
552
|
case "scatter":
|
|
470
|
-
return typedChart(base, chartType, scatterConfig(source));
|
|
553
|
+
return typedChart(base, chartType, scatterConfig(source, p));
|
|
471
554
|
case "boxplot":
|
|
472
|
-
return typedChart(base, chartType, boxplotConfig(source));
|
|
555
|
+
return typedChart(base, chartType, boxplotConfig(source, p));
|
|
473
556
|
case "field":
|
|
474
557
|
return typedChart(base, chartType, fieldConfig(source));
|
|
475
558
|
case "heatmap":
|
|
476
|
-
return typedChart(base, chartType, heatmapConfig(source));
|
|
559
|
+
return typedChart(base, chartType, heatmapConfig(source, p));
|
|
477
560
|
case "hexbin":
|
|
478
|
-
return typedChart(base, chartType, hexbinConfig(source));
|
|
561
|
+
return typedChart(base, chartType, hexbinConfig(source, p));
|
|
479
562
|
case "mekko":
|
|
480
|
-
return typedChart(base, chartType, mekkoConfig(source));
|
|
563
|
+
return typedChart(base, chartType, mekkoConfig(source, p));
|
|
481
564
|
case "pie":
|
|
482
565
|
return typedChart(base, chartType, pieConfig(source, p));
|
|
483
566
|
case "polarArea":
|
|
484
|
-
return typedChart(base, chartType, polarAreaConfig(source));
|
|
567
|
+
return typedChart(base, chartType, polarAreaConfig(source, p));
|
|
485
568
|
case "radar":
|
|
486
|
-
return typedChart(base, chartType, radarConfig(source));
|
|
569
|
+
return typedChart(base, chartType, radarConfig(source, p));
|
|
487
570
|
case "radial":
|
|
488
|
-
return typedChart(base, chartType, radialConfig(source));
|
|
571
|
+
return typedChart(base, chartType, radialConfig(source, p));
|
|
489
572
|
case "radialBar":
|
|
490
|
-
return typedChart(base, chartType, radialBarConfig(source));
|
|
573
|
+
return typedChart(base, chartType, radialBarConfig(source, p));
|
|
491
574
|
case "sankey":
|
|
492
|
-
return typedChart(base, chartType, sankeyConfig(source));
|
|
575
|
+
return typedChart(base, chartType, sankeyConfig(source, p));
|
|
493
576
|
case "treemap":
|
|
494
|
-
return typedChart(base, chartType, treemapConfig(source));
|
|
577
|
+
return typedChart(base, chartType, treemapConfig(source, p));
|
|
495
578
|
case "custom":
|
|
496
|
-
return typedChart(base, chartType, customConfig(source));
|
|
579
|
+
return typedChart(base, chartType, customConfig(source, p));
|
|
497
580
|
}
|
|
498
581
|
}
|
|
499
582
|
function typedChart(base, chartType, config) {
|
|
@@ -723,6 +806,10 @@ function variant(value) {
|
|
|
723
806
|
function motion(value) {
|
|
724
807
|
return value === "roll" || value === "fade" ? value : void 0;
|
|
725
808
|
}
|
|
809
|
+
function positiveNumber(value) {
|
|
810
|
+
const number = Number(value);
|
|
811
|
+
return value !== void 0 && Number.isFinite(number) && number > 0 ? number : void 0;
|
|
812
|
+
}
|
|
726
813
|
function fontWeight(value) {
|
|
727
814
|
return value && FONT_WEIGHT.test(value) ? value : void 0;
|
|
728
815
|
}
|
|
@@ -792,7 +879,7 @@ var RULER_NUMBERS = [
|
|
|
792
879
|
];
|
|
793
880
|
var RULER_COLORS = ["color", "accent", "glow"];
|
|
794
881
|
var RULER_DEFAULTS = { color: "#8f95c4", accent: "#d9f270", glow: "#3ddc84" };
|
|
795
|
-
var RULER_OPTIONAL_COLORS = ["core"];
|
|
882
|
+
var RULER_OPTIONAL_COLORS = ["core", "peak"];
|
|
796
883
|
function rulerObject(canvasObject) {
|
|
797
884
|
const properties = canvasObject.props;
|
|
798
885
|
const parameters = {};
|
|
@@ -871,7 +958,8 @@ function widgetObject(canvasObject) {
|
|
|
871
958
|
fontFamily: fontFamily(properties.fontFamily),
|
|
872
959
|
variant: variant(properties.variant),
|
|
873
960
|
motion: motion(properties.motion),
|
|
874
|
-
fontWeight: fontWeight(properties.fontWeight)
|
|
961
|
+
fontWeight: fontWeight(properties.fontWeight),
|
|
962
|
+
fontSize: positiveNumber(properties.fontSize)
|
|
875
963
|
}
|
|
876
964
|
};
|
|
877
965
|
}
|
|
@@ -2443,7 +2531,8 @@ var DEFAULT_ROLLING_NUMBER_STYLE = {
|
|
|
2443
2531
|
fontFamily: "'Roboto Mono', 'SFMono-Regular', Consolas, monospace",
|
|
2444
2532
|
variant: "flip",
|
|
2445
2533
|
motion: "roll",
|
|
2446
|
-
fontWeight: "300"
|
|
2534
|
+
fontWeight: "300",
|
|
2535
|
+
fontSize: 0
|
|
2447
2536
|
};
|
|
2448
2537
|
function resolveRollingNumberStyle(style) {
|
|
2449
2538
|
return {
|
|
@@ -2454,7 +2543,8 @@ function resolveRollingNumberStyle(style) {
|
|
|
2454
2543
|
fontFamily: style.fontFamily ?? DEFAULT_ROLLING_NUMBER_STYLE.fontFamily,
|
|
2455
2544
|
variant: style.variant ?? DEFAULT_ROLLING_NUMBER_STYLE.variant,
|
|
2456
2545
|
motion: style.motion ?? DEFAULT_ROLLING_NUMBER_STYLE.motion,
|
|
2457
|
-
fontWeight: style.fontWeight ?? DEFAULT_ROLLING_NUMBER_STYLE.fontWeight
|
|
2546
|
+
fontWeight: style.fontWeight ?? DEFAULT_ROLLING_NUMBER_STYLE.fontWeight,
|
|
2547
|
+
fontSize: style.fontSize ?? DEFAULT_ROLLING_NUMBER_STYLE.fontSize
|
|
2458
2548
|
};
|
|
2459
2549
|
}
|
|
2460
2550
|
|
|
@@ -4205,6 +4295,7 @@ function createBoxplotLayout(context) {
|
|
|
4205
4295
|
const orientation = chart.config?.orientation ?? "vertical";
|
|
4206
4296
|
const boxCount = Math.max(1, chart.series.length);
|
|
4207
4297
|
const slotWidth = (orientation === "horizontal" ? plot.height : plot.width) / boxCount;
|
|
4298
|
+
const borderColor = representativeColor(chart.config?.barBorderColor, "#000000");
|
|
4208
4299
|
const widthFraction = Math.min(1, Math.max(0.05, chart.config?.boxWidth ?? 0.6));
|
|
4209
4300
|
return {
|
|
4210
4301
|
orientation,
|
|
@@ -4212,8 +4303,16 @@ function createBoxplotLayout(context) {
|
|
|
4212
4303
|
boxWidth: Math.max(4, slotWidth * widthFraction),
|
|
4213
4304
|
cornerRadius: chart.config?.barCornerRadius ?? 2,
|
|
4214
4305
|
showPoints: chart.config?.showBoxplotPoints ?? true,
|
|
4215
|
-
borderColor
|
|
4216
|
-
borderWidth: finite(chart.config?.barBorderWidth, 1)
|
|
4306
|
+
borderColor,
|
|
4307
|
+
borderWidth: finite(chart.config?.barBorderWidth, 1),
|
|
4308
|
+
whiskerWidth: Math.max(0, finite(chart.config?.boxWhiskerWidth, 1)),
|
|
4309
|
+
medianWidth: Math.max(0, finite(chart.config?.boxMedianWidth, 2)),
|
|
4310
|
+
medianColor: chart.config?.boxMedianColor ?? borderColor,
|
|
4311
|
+
whiskerColor: chart.config?.boxWhiskerColor,
|
|
4312
|
+
capSize: Math.max(0, finite(chart.config?.boxCapSize, 0.4)),
|
|
4313
|
+
pointSize: Math.max(0, finite(chart.config?.boxPointSize, 3)),
|
|
4314
|
+
pointOpacity: Math.min(1, Math.max(0, finite(chart.config?.boxPointOpacity, 0.7))),
|
|
4315
|
+
jitter: Math.max(0, finite(chart.config?.boxJitter, 1))
|
|
4217
4316
|
};
|
|
4218
4317
|
}
|
|
4219
4318
|
|
|
@@ -4240,8 +4339,11 @@ function createBoxplotGeometry(context, layout, seriesIndex, stats) {
|
|
|
4240
4339
|
function renderSamplePoints(context, layout, mark) {
|
|
4241
4340
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
4242
4341
|
const valueAt = (value) => layout.orientation === "horizontal" ? plot.x + mapChartValue(value, chart.axisX, plot.width) : plot.y + plot.height - mapChartValue(value, chart.axisY, plot.height);
|
|
4342
|
+
if (layout.pointSize <= 0) {
|
|
4343
|
+
return [];
|
|
4344
|
+
}
|
|
4243
4345
|
return mark.series.values.map((value, pointIndex) => {
|
|
4244
|
-
const center = mark.geometry.center + jitter(mark.seriesIndex * 1e4 + pointIndex) * layout.boxWidth;
|
|
4346
|
+
const center = mark.geometry.center + jitter(mark.seriesIndex * 1e4 + pointIndex) * layout.jitter * layout.boxWidth;
|
|
4245
4347
|
const { x, y } = boxplotPoint(layout.orientation, center, valueAt(value));
|
|
4246
4348
|
return {
|
|
4247
4349
|
type: "ellipse",
|
|
@@ -4250,9 +4352,9 @@ function renderSamplePoints(context, layout, mark) {
|
|
|
4250
4352
|
bounds,
|
|
4251
4353
|
cx: x,
|
|
4252
4354
|
cy: y,
|
|
4253
|
-
rx:
|
|
4254
|
-
ry:
|
|
4255
|
-
style: { fill: paint(mark.color, diagnostics, chart.id), opacity:
|
|
4355
|
+
rx: layout.pointSize,
|
|
4356
|
+
ry: layout.pointSize,
|
|
4357
|
+
style: { fill: paint(mark.color, diagnostics, chart.id), opacity: layout.pointOpacity }
|
|
4256
4358
|
};
|
|
4257
4359
|
});
|
|
4258
4360
|
}
|
|
@@ -4263,22 +4365,30 @@ function jitter(seed) {
|
|
|
4263
4365
|
|
|
4264
4366
|
// src/renderScene/charts/renderers/boxplot/shapes.ts
|
|
4265
4367
|
function renderBoxAndWhiskers(context, layout, mark) {
|
|
4368
|
+
const whiskers = layout.whiskerWidth > 0 ? [lowerWhisker(layout, mark), upperWhisker(layout, mark)] : [];
|
|
4369
|
+
const caps = layout.whiskerWidth > 0 && layout.capSize > 0 ? [lowerWhiskerCap(layout, mark), upperWhiskerCap(layout, mark)] : [];
|
|
4370
|
+
const median = layout.medianWidth > 0 ? [medianLine(layout, mark)] : [];
|
|
4266
4371
|
return [
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
createBoxBorderLine(context, layout, upperWhiskerCap(layout, mark)),
|
|
4372
|
+
...[...whiskers, ...caps].map(
|
|
4373
|
+
(line) => createBoxBorderLine(context, layout, { ...line, color: whiskerColor(layout, mark) })
|
|
4374
|
+
),
|
|
4271
4375
|
createBoxNode(context, layout, mark),
|
|
4272
|
-
createBoxBorderLine(context, layout,
|
|
4376
|
+
...median.map((line) => createBoxBorderLine(context, layout, line))
|
|
4273
4377
|
];
|
|
4274
4378
|
}
|
|
4379
|
+
function whiskerColor(layout, mark) {
|
|
4380
|
+
if (layout.whiskerColor === "series") {
|
|
4381
|
+
return representativeColor(mark.color, layout.borderColor);
|
|
4382
|
+
}
|
|
4383
|
+
return layout.whiskerColor;
|
|
4384
|
+
}
|
|
4275
4385
|
function lowerWhisker(layout, mark) {
|
|
4276
4386
|
const { center, min, q1 } = mark.geometry;
|
|
4277
4387
|
return {
|
|
4278
4388
|
id: `chart-box-whisker-lo-${mark.id}`,
|
|
4279
4389
|
from: boxplotPoint(layout.orientation, center, min),
|
|
4280
4390
|
to: boxplotPoint(layout.orientation, center, q1),
|
|
4281
|
-
strokeWidth:
|
|
4391
|
+
strokeWidth: layout.whiskerWidth
|
|
4282
4392
|
};
|
|
4283
4393
|
}
|
|
4284
4394
|
function upperWhisker(layout, mark) {
|
|
@@ -4287,7 +4397,7 @@ function upperWhisker(layout, mark) {
|
|
|
4287
4397
|
id: `chart-box-whisker-hi-${mark.id}`,
|
|
4288
4398
|
from: boxplotPoint(layout.orientation, center, q3),
|
|
4289
4399
|
to: boxplotPoint(layout.orientation, center, max),
|
|
4290
|
-
strokeWidth:
|
|
4400
|
+
strokeWidth: layout.whiskerWidth
|
|
4291
4401
|
};
|
|
4292
4402
|
}
|
|
4293
4403
|
function lowerWhiskerCap(layout, mark) {
|
|
@@ -4297,12 +4407,12 @@ function upperWhiskerCap(layout, mark) {
|
|
|
4297
4407
|
return whiskerCap(`chart-box-cap-hi-${mark.id}`, layout, mark.geometry.center, mark.geometry.max);
|
|
4298
4408
|
}
|
|
4299
4409
|
function whiskerCap(id, layout, center, value) {
|
|
4300
|
-
const capHalf = layout.boxWidth *
|
|
4410
|
+
const capHalf = layout.boxWidth * layout.capSize / 2;
|
|
4301
4411
|
return {
|
|
4302
4412
|
id,
|
|
4303
4413
|
from: boxplotPoint(layout.orientation, center - capHalf, value),
|
|
4304
4414
|
to: boxplotPoint(layout.orientation, center + capHalf, value),
|
|
4305
|
-
strokeWidth:
|
|
4415
|
+
strokeWidth: layout.whiskerWidth
|
|
4306
4416
|
};
|
|
4307
4417
|
}
|
|
4308
4418
|
function medianLine(layout, mark) {
|
|
@@ -4311,7 +4421,8 @@ function medianLine(layout, mark) {
|
|
|
4311
4421
|
id: `chart-box-median-${mark.id}`,
|
|
4312
4422
|
from: boxplotPoint(layout.orientation, mark.geometry.center - half, mark.geometry.median),
|
|
4313
4423
|
to: boxplotPoint(layout.orientation, mark.geometry.center + half, mark.geometry.median),
|
|
4314
|
-
strokeWidth:
|
|
4424
|
+
strokeWidth: layout.medianWidth,
|
|
4425
|
+
color: layout.medianColor
|
|
4315
4426
|
};
|
|
4316
4427
|
}
|
|
4317
4428
|
function createBoxBorderLine(context, layout, line) {
|
|
@@ -4323,7 +4434,7 @@ function createBoxBorderLine(context, layout, line) {
|
|
|
4323
4434
|
d: `M ${line.from.x} ${line.from.y} L ${line.to.x} ${line.to.y}`,
|
|
4324
4435
|
style: {
|
|
4325
4436
|
fill: { kind: "none" },
|
|
4326
|
-
stroke: { kind: "solid", color: layout.borderColor },
|
|
4437
|
+
stroke: { kind: "solid", color: line.color ?? layout.borderColor },
|
|
4327
4438
|
strokeWidth: line.strokeWidth
|
|
4328
4439
|
}
|
|
4329
4440
|
};
|
|
@@ -4503,9 +4614,9 @@ function renderConnectedPairs(context) {
|
|
|
4503
4614
|
valueIndex: index,
|
|
4504
4615
|
point: beforePoint,
|
|
4505
4616
|
style: {
|
|
4506
|
-
fill: paint(chart.gridColor ?? "#e2e8f0", context.diagnostics, chart.id),
|
|
4507
|
-
stroke: { kind: "solid", color: HOLLOW_POINT_STROKE },
|
|
4508
|
-
strokeWidth: 1.5
|
|
4617
|
+
fill: paint(chart.config?.customBeforeFill ?? chart.gridColor ?? "#e2e8f0", context.diagnostics, chart.id),
|
|
4618
|
+
stroke: { kind: "solid", color: chart.config?.customBeforeStroke ?? HOLLOW_POINT_STROKE },
|
|
4619
|
+
strokeWidth: finite(chart.config?.customBeforeStrokeWidth, 1.5)
|
|
4509
4620
|
}
|
|
4510
4621
|
})
|
|
4511
4622
|
);
|
|
@@ -4527,6 +4638,10 @@ function renderConnectedPairs(context) {
|
|
|
4527
4638
|
}
|
|
4528
4639
|
return nodes;
|
|
4529
4640
|
}
|
|
4641
|
+
function connectorDash(text) {
|
|
4642
|
+
const parts = (text ?? "").split(/[ ,]+/).map(Number).filter((part) => Number.isFinite(part) && part > 0);
|
|
4643
|
+
return parts.length > 0 ? parts : void 0;
|
|
4644
|
+
}
|
|
4530
4645
|
function createConnectorLine(context, index, from, to, color2) {
|
|
4531
4646
|
const { chart } = context;
|
|
4532
4647
|
return {
|
|
@@ -4535,7 +4650,13 @@ function createConnectorLine(context, index, from, to, color2) {
|
|
|
4535
4650
|
order: context.nextOrder(),
|
|
4536
4651
|
bounds: context.bounds,
|
|
4537
4652
|
d: `M ${from.x} ${from.y} L ${to.x} ${to.y}`,
|
|
4538
|
-
style: {
|
|
4653
|
+
style: {
|
|
4654
|
+
fill: { kind: "none" },
|
|
4655
|
+
stroke: { kind: "solid", color: color2 },
|
|
4656
|
+
strokeWidth: finite(chart.config?.customConnectorWidth, 2),
|
|
4657
|
+
opacity: chart.config?.customConnectorOpacity,
|
|
4658
|
+
dash: connectorDash(chart.config?.customConnectorDash)
|
|
4659
|
+
}
|
|
4539
4660
|
};
|
|
4540
4661
|
}
|
|
4541
4662
|
function createConnectorLabel(context, index, beforePoint, afterPoint, radius, text) {
|
|
@@ -4562,7 +4683,8 @@ function createConnectorLabel(context, index, beforePoint, afterPoint, radius, t
|
|
|
4562
4683
|
chart,
|
|
4563
4684
|
align: horizontal ? "left" : "center"
|
|
4564
4685
|
}),
|
|
4565
|
-
fontSize: Math.max(9, finite(chart.fontSize, 12)) - 2
|
|
4686
|
+
fontSize: Math.max(6, finite(chart.config?.customLabelSize, Math.max(9, finite(chart.fontSize, 12)) - 2)),
|
|
4687
|
+
...chart.config?.customLabelColor ? { color: chart.config.customLabelColor } : {}
|
|
4566
4688
|
};
|
|
4567
4689
|
}
|
|
4568
4690
|
|
|
@@ -4979,22 +5101,38 @@ function renderHeatmapCell(context, layout, cell) {
|
|
|
4979
5101
|
}
|
|
4980
5102
|
function createCellBackground(context, layout, cell) {
|
|
4981
5103
|
const { chart, bounds, nextOrder } = context;
|
|
5104
|
+
const id = `chart-heatmap-cell-${chart.id}-${cell.seriesId}-${cell.columnIndex}`;
|
|
5105
|
+
const style = {
|
|
5106
|
+
fill: { kind: "solid", color: cell.color },
|
|
5107
|
+
stroke: { kind: "solid", color: chart.config?.cellStrokeColor ?? chart.gridColor ?? "#e2e8f0" },
|
|
5108
|
+
strokeWidth: finite(chart.config?.cellStrokeWidth, finite(chart.gridWidth, 1))
|
|
5109
|
+
};
|
|
5110
|
+
if (chart.config?.cellShape === "circle") {
|
|
5111
|
+
return {
|
|
5112
|
+
type: "ellipse",
|
|
5113
|
+
id,
|
|
5114
|
+
order: nextOrder(),
|
|
5115
|
+
bounds,
|
|
5116
|
+
cx: cell.frame.x + cell.frame.width / 2,
|
|
5117
|
+
cy: cell.frame.y + cell.frame.height / 2,
|
|
5118
|
+
rx: cell.frame.width / 2,
|
|
5119
|
+
ry: cell.frame.height / 2,
|
|
5120
|
+
style
|
|
5121
|
+
};
|
|
5122
|
+
}
|
|
4982
5123
|
return {
|
|
4983
5124
|
type: "rect",
|
|
4984
|
-
id
|
|
5125
|
+
id,
|
|
4985
5126
|
order: nextOrder(),
|
|
4986
5127
|
bounds,
|
|
4987
5128
|
...cell.frame,
|
|
4988
5129
|
rx: layout.grid.cellRadius,
|
|
4989
|
-
style
|
|
4990
|
-
fill: { kind: "solid", color: cell.color },
|
|
4991
|
-
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
4992
|
-
strokeWidth: finite(chart.gridWidth, 1)
|
|
4993
|
-
}
|
|
5130
|
+
style
|
|
4994
5131
|
};
|
|
4995
5132
|
}
|
|
4996
5133
|
function createCellValueLabel(context, layout, cell) {
|
|
4997
5134
|
const { chart, bounds, nextOrder } = context;
|
|
5135
|
+
const size = Math.max(6, finite(chart.config?.cellValueSize, layout.fontSize));
|
|
4998
5136
|
return {
|
|
4999
5137
|
...chartText({
|
|
5000
5138
|
id: `chart-heatmap-value-${chart.id}-${cell.seriesId}-${cell.columnIndex}`,
|
|
@@ -5002,15 +5140,16 @@ function createCellValueLabel(context, layout, cell) {
|
|
|
5002
5140
|
bounds,
|
|
5003
5141
|
frame: {
|
|
5004
5142
|
x: cell.frame.x,
|
|
5005
|
-
y: cell.frame.y + cell.frame.height / 2 -
|
|
5143
|
+
y: cell.frame.y + cell.frame.height / 2 - size / 2,
|
|
5006
5144
|
width: cell.frame.width,
|
|
5007
|
-
height:
|
|
5145
|
+
height: size + 2
|
|
5008
5146
|
},
|
|
5009
5147
|
text: String(cell.value),
|
|
5010
5148
|
chart,
|
|
5011
5149
|
align: "center"
|
|
5012
5150
|
}),
|
|
5013
|
-
|
|
5151
|
+
...chart.config?.cellValueSize === void 0 ? {} : { fontSize: size },
|
|
5152
|
+
color: chart.config?.cellValueColor ?? contrastTextColor(cell.color)
|
|
5014
5153
|
};
|
|
5015
5154
|
}
|
|
5016
5155
|
|
|
@@ -5273,6 +5412,10 @@ function groupSankeyColumns(ids, columns) {
|
|
|
5273
5412
|
return groups;
|
|
5274
5413
|
}
|
|
5275
5414
|
|
|
5415
|
+
// src/renderScene/charts/geometry/sankey/constants.ts
|
|
5416
|
+
var SANKEY_NODE_WIDTH = 18;
|
|
5417
|
+
var SANKEY_NODE_GAP = 8;
|
|
5418
|
+
|
|
5276
5419
|
// src/renderScene/charts/geometry/sankey/graph.ts
|
|
5277
5420
|
function createSankeyGraph(nodes, links) {
|
|
5278
5421
|
const ids = new Set(nodes.map((node) => node.id));
|
|
@@ -5296,10 +5439,6 @@ function createSankeyGraph(nodes, links) {
|
|
|
5296
5439
|
return { ids, links: validLinks, incoming, outgoing };
|
|
5297
5440
|
}
|
|
5298
5441
|
|
|
5299
|
-
// src/renderScene/charts/geometry/sankey/constants.ts
|
|
5300
|
-
var SANKEY_NODE_WIDTH = 18;
|
|
5301
|
-
var SANKEY_NODE_GAP = 8;
|
|
5302
|
-
|
|
5303
5442
|
// src/renderScene/charts/geometry/sankey/nodeGeometry.ts
|
|
5304
5443
|
function nodeValues(graph) {
|
|
5305
5444
|
const values = /* @__PURE__ */ new Map();
|
|
@@ -5310,11 +5449,11 @@ function nodeValues(graph) {
|
|
|
5310
5449
|
}
|
|
5311
5450
|
return values;
|
|
5312
5451
|
}
|
|
5313
|
-
function calculateValueScale(groups, values, height) {
|
|
5452
|
+
function calculateValueScale(groups, values, height, nodeGap) {
|
|
5314
5453
|
let scale = Infinity;
|
|
5315
5454
|
for (const ids of groups.values()) {
|
|
5316
5455
|
const total = ids.reduce((sum, id) => sum + (values.get(id) ?? 0), 0);
|
|
5317
|
-
const gaps = Math.max(0, ids.length - 1) *
|
|
5456
|
+
const gaps = Math.max(0, ids.length - 1) * nodeGap;
|
|
5318
5457
|
const usable = Math.max(1, height - gaps);
|
|
5319
5458
|
if (total > 0) {
|
|
5320
5459
|
scale = Math.min(scale, usable / total);
|
|
@@ -5325,16 +5464,16 @@ function calculateValueScale(groups, values, height) {
|
|
|
5325
5464
|
}
|
|
5326
5465
|
return scale;
|
|
5327
5466
|
}
|
|
5328
|
-
function sankeyNodeX(column, columnCount, width) {
|
|
5467
|
+
function sankeyNodeX(column, columnCount, width, nodeWidth = SANKEY_NODE_WIDTH) {
|
|
5329
5468
|
if (columnCount <= 1) {
|
|
5330
5469
|
return 0;
|
|
5331
5470
|
}
|
|
5332
|
-
return column * (width -
|
|
5471
|
+
return column * (width - nodeWidth) / (columnCount - 1);
|
|
5333
5472
|
}
|
|
5334
|
-
function calculateNodeGeometry(graph, columns, height) {
|
|
5473
|
+
function calculateNodeGeometry(graph, columns, height, nodeGap = SANKEY_NODE_GAP) {
|
|
5335
5474
|
const groups = groupSankeyColumns(graph.ids, columns);
|
|
5336
5475
|
const values = nodeValues(graph);
|
|
5337
|
-
const valueScale = calculateValueScale(groups, values, height);
|
|
5476
|
+
const valueScale = calculateValueScale(groups, values, height, nodeGap);
|
|
5338
5477
|
const y = /* @__PURE__ */ new Map();
|
|
5339
5478
|
const heights = /* @__PURE__ */ new Map();
|
|
5340
5479
|
for (const ids of groups.values()) {
|
|
@@ -5343,7 +5482,7 @@ function calculateNodeGeometry(graph, columns, height) {
|
|
|
5343
5482
|
const nodeHeight = Math.max(2, (values.get(id) ?? 0) * valueScale);
|
|
5344
5483
|
y.set(id, cursor);
|
|
5345
5484
|
heights.set(id, nodeHeight);
|
|
5346
|
-
cursor += nodeHeight +
|
|
5485
|
+
cursor += nodeHeight + nodeGap;
|
|
5347
5486
|
}
|
|
5348
5487
|
}
|
|
5349
5488
|
return {
|
|
@@ -5356,7 +5495,7 @@ function calculateNodeGeometry(graph, columns, height) {
|
|
|
5356
5495
|
}
|
|
5357
5496
|
|
|
5358
5497
|
// src/renderScene/charts/geometry/sankey/links.ts
|
|
5359
|
-
function layoutSankeyLinks(graph, geometry, width, offsets) {
|
|
5498
|
+
function layoutSankeyLinks(graph, geometry, width, offsets, nodeWidth = SANKEY_NODE_WIDTH) {
|
|
5360
5499
|
const outgoingOffsets = /* @__PURE__ */ new Map();
|
|
5361
5500
|
const incomingOffsets = /* @__PURE__ */ new Map();
|
|
5362
5501
|
for (const id of graph.ids) {
|
|
@@ -5378,8 +5517,8 @@ function layoutSankeyLinks(graph, geometry, width, offsets) {
|
|
|
5378
5517
|
target: link.target,
|
|
5379
5518
|
value: link.value,
|
|
5380
5519
|
color: link.color,
|
|
5381
|
-
x0: sankeyNodeX(geometry.columns.get(link.source) ?? 0, geometry.columnCount, width) +
|
|
5382
|
-
x1: sankeyNodeX(geometry.columns.get(link.target) ?? 0, geometry.columnCount, width) + (targetOffset?.x ?? 0),
|
|
5520
|
+
x0: sankeyNodeX(geometry.columns.get(link.source) ?? 0, geometry.columnCount, width, nodeWidth) + nodeWidth + (sourceOffset?.x ?? 0),
|
|
5521
|
+
x1: sankeyNodeX(geometry.columns.get(link.target) ?? 0, geometry.columnCount, width, nodeWidth) + (targetOffset?.x ?? 0),
|
|
5383
5522
|
sourceY0: sourceTop + sourceSlice,
|
|
5384
5523
|
sourceY1: sourceTop + sourceSlice + sliceHeight,
|
|
5385
5524
|
targetY0: targetTop + targetSlice,
|
|
@@ -5389,7 +5528,7 @@ function layoutSankeyLinks(graph, geometry, width, offsets) {
|
|
|
5389
5528
|
}
|
|
5390
5529
|
|
|
5391
5530
|
// src/renderScene/charts/geometry/sankey/nodes.ts
|
|
5392
|
-
function layoutSankeyNodes(inputs, graph, geometry, width, offsets) {
|
|
5531
|
+
function layoutSankeyNodes(inputs, graph, geometry, width, offsets, nodeWidth = SANKEY_NODE_WIDTH) {
|
|
5393
5532
|
return [...graph.ids].map((id) => {
|
|
5394
5533
|
const input = inputs.find((node) => node.id === id);
|
|
5395
5534
|
const column = geometry.columns.get(id) ?? 0;
|
|
@@ -5398,9 +5537,9 @@ function layoutSankeyNodes(inputs, graph, geometry, width, offsets) {
|
|
|
5398
5537
|
id,
|
|
5399
5538
|
label: input?.label ?? id,
|
|
5400
5539
|
color: input?.color,
|
|
5401
|
-
x: sankeyNodeX(column, geometry.columnCount, width) + (offset?.x ?? 0),
|
|
5540
|
+
x: sankeyNodeX(column, geometry.columnCount, width, nodeWidth) + (offset?.x ?? 0),
|
|
5402
5541
|
y: (geometry.y.get(id) ?? 0) + (offset?.y ?? 0),
|
|
5403
|
-
width:
|
|
5542
|
+
width: nodeWidth,
|
|
5404
5543
|
height: geometry.heights.get(id) ?? 2,
|
|
5405
5544
|
column
|
|
5406
5545
|
};
|
|
@@ -5417,17 +5556,17 @@ function collectOffsets(inputs) {
|
|
|
5417
5556
|
}
|
|
5418
5557
|
return offsets;
|
|
5419
5558
|
}
|
|
5420
|
-
function layoutSankey(nodeInputs, linkInputs, width, height) {
|
|
5559
|
+
function layoutSankey(nodeInputs, linkInputs, width, height, options = { nodeWidth: SANKEY_NODE_WIDTH, nodeGap: SANKEY_NODE_GAP }) {
|
|
5421
5560
|
const graph = createSankeyGraph(nodeInputs, linkInputs);
|
|
5422
5561
|
if (graph.ids.size === 0) {
|
|
5423
5562
|
return { nodes: [], links: [] };
|
|
5424
5563
|
}
|
|
5425
5564
|
const columns = assignSankeyColumns(graph);
|
|
5426
|
-
const geometry = calculateNodeGeometry(graph, columns, height);
|
|
5565
|
+
const geometry = calculateNodeGeometry(graph, columns, height, options.nodeGap);
|
|
5427
5566
|
const offsets = collectOffsets(nodeInputs);
|
|
5428
5567
|
return {
|
|
5429
|
-
nodes: layoutSankeyNodes(nodeInputs, graph, geometry, width, offsets),
|
|
5430
|
-
links: layoutSankeyLinks(graph, geometry, width, offsets)
|
|
5568
|
+
nodes: layoutSankeyNodes(nodeInputs, graph, geometry, width, offsets, options.nodeWidth),
|
|
5569
|
+
links: layoutSankeyLinks(graph, geometry, width, offsets, options.nodeWidth)
|
|
5431
5570
|
};
|
|
5432
5571
|
}
|
|
5433
5572
|
|
|
@@ -5529,6 +5668,8 @@ function placeHorizontalTreemapRow(row, bounds) {
|
|
|
5529
5668
|
}
|
|
5530
5669
|
|
|
5531
5670
|
// src/renderScene/charts/renderers/hexbin.ts
|
|
5671
|
+
var DEFAULT_MIN_OPACITY = 0.15;
|
|
5672
|
+
var GAP_TO_RADIUS = 1 / Math.sqrt(3);
|
|
5532
5673
|
function hexPath(cx, cy, radius) {
|
|
5533
5674
|
const points = [];
|
|
5534
5675
|
for (let corner = 0; corner < 6; corner++) {
|
|
@@ -5540,7 +5681,11 @@ function hexPath(cx, cy, radius) {
|
|
|
5540
5681
|
function renderHexbin(context) {
|
|
5541
5682
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
5542
5683
|
const nodes = [];
|
|
5543
|
-
const
|
|
5684
|
+
const config = chart.config;
|
|
5685
|
+
const hexRadius = Math.max(1, config?.hexRadius ?? DEFAULT_HEX_RADIUS);
|
|
5686
|
+
const drawRadius = Math.max(0.5, hexRadius - Math.max(0, config?.hexGap ?? 0) * GAP_TO_RADIUS);
|
|
5687
|
+
const strokeWidth = config?.hexStrokeWidth ?? 0;
|
|
5688
|
+
const minOpacity = Math.min(1, Math.max(0, config?.hexMinOpacity ?? DEFAULT_MIN_OPACITY));
|
|
5544
5689
|
const shadow = resolveChartShadow(chart.shadowStyle);
|
|
5545
5690
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
5546
5691
|
chart.series.forEach((series, seriesIndex) => {
|
|
@@ -5553,16 +5698,21 @@ function renderHexbin(context) {
|
|
|
5553
5698
|
const bins = computeHexBins(pixelPoints2, hexRadius);
|
|
5554
5699
|
const maxCount = Math.max(1, ...bins.map((bin) => bin.count));
|
|
5555
5700
|
const color2 = series.color ?? CHART_COLORS[seriesIndex % CHART_COLORS.length];
|
|
5701
|
+
const ramp = config?.scale;
|
|
5556
5702
|
bins.forEach((bin, i) => {
|
|
5703
|
+
const share = bin.count / maxCount;
|
|
5704
|
+
const fill2 = ramp ? colorAtRamp(ramp, share) : color2;
|
|
5557
5705
|
nodes.push({
|
|
5558
5706
|
type: "path",
|
|
5559
5707
|
id: `chart-hexbin-${chart.id}-${series.id}-${i}`,
|
|
5560
5708
|
order: nextOrder(),
|
|
5561
5709
|
bounds,
|
|
5562
|
-
d: hexPath(plot.x + bin.cx, plot.y + bin.cy,
|
|
5710
|
+
d: hexPath(plot.x + bin.cx, plot.y + bin.cy, drawRadius),
|
|
5563
5711
|
style: {
|
|
5564
|
-
fill: paint(
|
|
5565
|
-
|
|
5712
|
+
fill: paint(fill2, diagnostics, chart.id),
|
|
5713
|
+
stroke: strokeWidth > 0 ? paint(config?.hexStrokeColor ?? fill2, diagnostics, chart.id) : void 0,
|
|
5714
|
+
strokeWidth: strokeWidth > 0 ? strokeWidth : void 0,
|
|
5715
|
+
opacity: ramp ? void 0 : Math.max(minOpacity, share),
|
|
5566
5716
|
shadow,
|
|
5567
5717
|
clip: clipPath ? { type: "path", d: clipPath } : void 0
|
|
5568
5718
|
}
|
|
@@ -5919,10 +6069,8 @@ function renderMekkoColumnLabels(context, layout, columnIndex, column) {
|
|
|
5919
6069
|
if (!context.showLabels) {
|
|
5920
6070
|
return [];
|
|
5921
6071
|
}
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
createColumnLabel(context, layout, columnIndex, column)
|
|
5925
|
-
];
|
|
6072
|
+
const columnLabel = createColumnLabel(context, layout, columnIndex, column);
|
|
6073
|
+
return context.chart.config?.showMekkoTotals === false ? [columnLabel] : [createTotalLabel(context, layout, columnIndex, column), columnLabel];
|
|
5926
6074
|
}
|
|
5927
6075
|
function createTotalLabel(context, layout, columnIndex, column) {
|
|
5928
6076
|
const { chart, plot, bounds, nextOrder } = context;
|
|
@@ -5968,17 +6116,21 @@ function createColumnLabel(context, layout, columnIndex, column) {
|
|
|
5968
6116
|
}
|
|
5969
6117
|
|
|
5970
6118
|
// src/renderScene/charts/renderers/mekko/layout.ts
|
|
5971
|
-
var COLUMN_GAP = 4;
|
|
5972
6119
|
function createMekkoLayout(context) {
|
|
5973
6120
|
const labels = mekkoColumnLabels(context);
|
|
5974
6121
|
const labelGutterWidth = context.showLabels ? 30 : 0;
|
|
5975
6122
|
const grid = createMekkoGrid(context, labelGutterWidth);
|
|
5976
6123
|
const fontSize = Math.max(9, finite(context.chart.fontSize, 12));
|
|
6124
|
+
const columnGap = Math.max(0, finite(context.chart.config?.mekkoColumnGap, 4));
|
|
6125
|
+
const smallFontSize = Math.max(8, fontSize - 1);
|
|
5977
6126
|
return {
|
|
5978
|
-
columns: createMekkoColumns(context, grid, labels),
|
|
6127
|
+
columns: createMekkoColumns(context, grid, labels, columnGap),
|
|
5979
6128
|
fontSize,
|
|
5980
|
-
smallFontSize
|
|
6129
|
+
smallFontSize,
|
|
5981
6130
|
labelGutterWidth,
|
|
6131
|
+
columnGap,
|
|
6132
|
+
labelSize: Math.max(6, finite(context.chart.config?.mekkoLabelSize, smallFontSize)),
|
|
6133
|
+
valueSize: Math.max(6, finite(context.chart.config?.mekkoValueSize, smallFontSize)),
|
|
5982
6134
|
grid
|
|
5983
6135
|
};
|
|
5984
6136
|
}
|
|
@@ -5996,20 +6148,20 @@ function createMekkoGrid(context, labelGutterWidth) {
|
|
|
5996
6148
|
height: Math.max(1, context.plot.height - topGutter - bottomGutter)
|
|
5997
6149
|
};
|
|
5998
6150
|
}
|
|
5999
|
-
function createMekkoColumns(context, grid, labels) {
|
|
6151
|
+
function createMekkoColumns(context, grid, labels, columnGap) {
|
|
6000
6152
|
const totals = labels.map(
|
|
6001
6153
|
(_, columnIndex) => context.chart.series.reduce((sum, series) => sum + (series.values[columnIndex] ?? 0), 0)
|
|
6002
6154
|
);
|
|
6003
6155
|
const grandTotal = totals.reduce((sum, total) => sum + total, 0);
|
|
6004
6156
|
const maximumTotal = Math.max(1, ...totals);
|
|
6005
|
-
const availableWidth = Math.max(1, grid.width -
|
|
6157
|
+
const availableWidth = Math.max(1, grid.width - columnGap * Math.max(0, labels.length - 1));
|
|
6006
6158
|
let nextX = grid.x;
|
|
6007
6159
|
return labels.map((label, index) => {
|
|
6008
6160
|
const total = totals[index];
|
|
6009
6161
|
const width = grandTotal > 0 ? total / grandTotal * availableWidth : availableWidth / labels.length;
|
|
6010
6162
|
const height = context.chart.config?.mekkoVaryHeight ? grid.height * (total / maximumTotal) : grid.height;
|
|
6011
6163
|
const column = { label, total, x: nextX, y: grid.y + grid.height - height, width, height };
|
|
6012
|
-
nextX += width +
|
|
6164
|
+
nextX += width + columnGap;
|
|
6013
6165
|
return column;
|
|
6014
6166
|
});
|
|
6015
6167
|
}
|
|
@@ -6076,8 +6228,10 @@ function createSegmentNode(context, segment, nextColor) {
|
|
|
6076
6228
|
const { chart, plot, bounds, diagnostics, nextOrder } = context;
|
|
6077
6229
|
const shadow = resolveChartShadow(chart.shadowStyle);
|
|
6078
6230
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
6079
|
-
const
|
|
6231
|
+
const config = chart.config;
|
|
6232
|
+
const radius = segment.isTop || config?.mekkoRoundAll ? mekkoCornerRadius(context) : 0;
|
|
6080
6233
|
const { x, y, width, height } = segment.frame;
|
|
6234
|
+
const segmentGap = Math.max(0, finite(config?.mekkoSegmentGap, 0));
|
|
6081
6235
|
const fallback = "#94a3b8";
|
|
6082
6236
|
const gradientBounds = {
|
|
6083
6237
|
minX: x + width / 2 - height / 2,
|
|
@@ -6098,11 +6252,11 @@ function createSegmentNode(context, segment, nextColor) {
|
|
|
6098
6252
|
id: `chart-mekko-seg-${chart.id}-${segment.columnIndex}-${segment.seriesId}`,
|
|
6099
6253
|
order: nextOrder(),
|
|
6100
6254
|
bounds: nextColor ? gradientBounds : bounds,
|
|
6101
|
-
d:
|
|
6255
|
+
d: barPath(x, y + segmentGap / 2, width, Math.max(0, height - segmentGap), radius, Boolean(config?.mekkoRoundAll)),
|
|
6102
6256
|
style: {
|
|
6103
6257
|
fill: fill2,
|
|
6104
|
-
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
6105
|
-
strokeWidth: finite(chart.gridWidth, 1),
|
|
6258
|
+
stroke: { kind: "solid", color: config?.mekkoSegmentStrokeColor ?? chart.gridColor ?? "#e2e8f0" },
|
|
6259
|
+
strokeWidth: finite(config?.mekkoSegmentStrokeWidth, finite(chart.gridWidth, 1)),
|
|
6106
6260
|
shadow,
|
|
6107
6261
|
clip: clipPath ? { type: "path", d: clipPath } : void 0
|
|
6108
6262
|
}
|
|
@@ -6116,12 +6270,17 @@ function createSegmentLabel(context, layout, segment) {
|
|
|
6116
6270
|
}
|
|
6117
6271
|
const innerWidth = Math.max(1, width - 8);
|
|
6118
6272
|
const innerHeight = Math.max(1, height - 6);
|
|
6119
|
-
const lineHeight = layout.
|
|
6120
|
-
const
|
|
6121
|
-
|
|
6273
|
+
const lineHeight = layout.labelSize * 1.2;
|
|
6274
|
+
const valueHeight = layout.valueSize * 1.2;
|
|
6275
|
+
const labelLines = wrapText(segment.seriesLabel, innerWidth, layout.labelSize).map(
|
|
6276
|
+
(line) => ellipsizeToWidth(line, innerWidth, layout.labelSize, true)
|
|
6277
|
+
);
|
|
6278
|
+
if (labelLines.length * lineHeight + valueHeight > innerHeight) {
|
|
6122
6279
|
return [];
|
|
6123
6280
|
}
|
|
6124
|
-
const textColor = contrastTextColor(representativeColor(segment.color, "#ffffff"));
|
|
6281
|
+
const textColor = chart.config?.mekkoTextColor ?? contrastTextColor(representativeColor(segment.color, "#ffffff"));
|
|
6282
|
+
const columnTotal = layout.columns[segment.columnIndex]?.total ?? 0;
|
|
6283
|
+
const valueText = chart.config?.mekkoValueFormat === "percent" ? `${columnTotal > 0 ? Math.round(segment.value / columnTotal * 100) : 0}%` : String(segment.value);
|
|
6125
6284
|
const label = {
|
|
6126
6285
|
...chartText({
|
|
6127
6286
|
id: `chart-mekko-seg-label-${chart.id}-${segment.columnIndex}-${segment.seriesId}`,
|
|
@@ -6132,7 +6291,7 @@ function createSegmentLabel(context, layout, segment) {
|
|
|
6132
6291
|
chart
|
|
6133
6292
|
}),
|
|
6134
6293
|
lines: labelLines,
|
|
6135
|
-
fontSize: layout.
|
|
6294
|
+
fontSize: layout.labelSize,
|
|
6136
6295
|
fontWeight: "bold",
|
|
6137
6296
|
color: textColor
|
|
6138
6297
|
};
|
|
@@ -6147,11 +6306,11 @@ function createSegmentLabel(context, layout, segment) {
|
|
|
6147
6306
|
width: innerWidth,
|
|
6148
6307
|
height: Math.max(1, innerHeight - labelLines.length * lineHeight)
|
|
6149
6308
|
},
|
|
6150
|
-
text:
|
|
6309
|
+
text: valueText,
|
|
6151
6310
|
chart
|
|
6152
6311
|
}),
|
|
6153
|
-
lines: [
|
|
6154
|
-
fontSize: layout.
|
|
6312
|
+
lines: [valueText],
|
|
6313
|
+
fontSize: layout.valueSize,
|
|
6155
6314
|
color: textColor
|
|
6156
6315
|
};
|
|
6157
6316
|
return [label, valueNode];
|
|
@@ -6366,7 +6525,7 @@ function renderPie(context) {
|
|
|
6366
6525
|
}
|
|
6367
6526
|
|
|
6368
6527
|
// src/renderScene/charts/renderers/polarArea.ts
|
|
6369
|
-
var
|
|
6528
|
+
var TOP2 = -Math.PI / 2;
|
|
6370
6529
|
var TRACK_COLOR_FALLBACK = "#e2e8f0";
|
|
6371
6530
|
var MIN_LABEL_SWEEP = 14 * Math.PI / 180;
|
|
6372
6531
|
var LABEL_WIDTH = 80;
|
|
@@ -6388,7 +6547,8 @@ function layoutOf(context) {
|
|
|
6388
6547
|
gapPx: Math.max(0, finite(chart.config?.pieSliceGap, 0)),
|
|
6389
6548
|
axisMin,
|
|
6390
6549
|
range: finite(chart.axisY.max, 100) - axisMin,
|
|
6391
|
-
sweep: chart.series.length > 0 ? Math.PI * 2 / chart.series.length : 0
|
|
6550
|
+
sweep: chart.series.length > 0 ? Math.PI * 2 / chart.series.length : 0,
|
|
6551
|
+
start: TOP2 + finite(chart.config?.pieStartAngle, 0) * Math.PI / 180
|
|
6392
6552
|
};
|
|
6393
6553
|
}
|
|
6394
6554
|
function clampedCorner(layout, outerRadius, angles) {
|
|
@@ -6420,7 +6580,11 @@ function wedgeNodes(context, layout, series, angles, outerRadius, value, rawColo
|
|
|
6420
6580
|
order: nextOrder(),
|
|
6421
6581
|
bounds,
|
|
6422
6582
|
d: trackPath,
|
|
6423
|
-
style: {
|
|
6583
|
+
style: {
|
|
6584
|
+
fill: paint(chart.gridColor ?? TRACK_COLOR_FALLBACK, diagnostics, chart.id),
|
|
6585
|
+
opacity: chart.config?.polarTrackOpacity,
|
|
6586
|
+
...trackStroke(context)
|
|
6587
|
+
}
|
|
6424
6588
|
};
|
|
6425
6589
|
const wedgePath = createPieSlicePath(
|
|
6426
6590
|
{ centerX, centerY, outerRadius, innerRadius },
|
|
@@ -6452,16 +6616,63 @@ function wedgeNodes(context, layout, series, angles, outerRadius, value, rawColo
|
|
|
6452
6616
|
pieValue: value
|
|
6453
6617
|
},
|
|
6454
6618
|
prop: seriesValueProp(series.id, 0),
|
|
6455
|
-
style: { fill: color2, innerShadow: shadow }
|
|
6619
|
+
style: { fill: color2, innerShadow: shadow, ...wedgeStroke(context) }
|
|
6456
6620
|
};
|
|
6457
6621
|
return shadowCaster ? [track, shadowCaster, wedge] : [track, wedge];
|
|
6458
6622
|
}
|
|
6623
|
+
function trackStroke(context) {
|
|
6624
|
+
const config = context.chart.config;
|
|
6625
|
+
if (!config?.polarTrackStroke) {
|
|
6626
|
+
return {};
|
|
6627
|
+
}
|
|
6628
|
+
const dash = (config.polarTrackDash ?? "").split(/[ ,]+/).map(Number).filter((part) => Number.isFinite(part) && part > 0);
|
|
6629
|
+
return {
|
|
6630
|
+
stroke: { kind: "solid", color: config.polarTrackStroke },
|
|
6631
|
+
strokeWidth: finite(config.polarTrackStrokeWidth, 1),
|
|
6632
|
+
dash: dash.length > 0 ? dash : void 0
|
|
6633
|
+
};
|
|
6634
|
+
}
|
|
6635
|
+
function wedgeStroke(context) {
|
|
6636
|
+
const config = context.chart.config;
|
|
6637
|
+
if (!config?.pieStroke) {
|
|
6638
|
+
return {};
|
|
6639
|
+
}
|
|
6640
|
+
return {
|
|
6641
|
+
stroke: { kind: "solid", color: config.pieStroke },
|
|
6642
|
+
strokeWidth: finite(config.pieStrokeWidth, 1)
|
|
6643
|
+
};
|
|
6644
|
+
}
|
|
6645
|
+
function ringNodes(context, layout) {
|
|
6646
|
+
const { chart, bounds, nextOrder } = context;
|
|
6647
|
+
if (!chart.config?.polarRings || layout.range <= 0) {
|
|
6648
|
+
return [];
|
|
6649
|
+
}
|
|
6650
|
+
return chartTicks(chart.axisY).filter((tick) => tick > layout.axisMin && tick < layout.axisMin + layout.range).map((tick) => {
|
|
6651
|
+
const radius = layout.innerRadius + (layout.maxRadius - layout.innerRadius) * (tick - layout.axisMin) / layout.range;
|
|
6652
|
+
return {
|
|
6653
|
+
type: "ellipse",
|
|
6654
|
+
id: `chart-polar-area-ring-${chart.id}-${tick}`,
|
|
6655
|
+
order: nextOrder(),
|
|
6656
|
+
bounds,
|
|
6657
|
+
cx: layout.centerX,
|
|
6658
|
+
cy: layout.centerY,
|
|
6659
|
+
rx: radius,
|
|
6660
|
+
ry: radius,
|
|
6661
|
+
style: {
|
|
6662
|
+
fill: { kind: "none" },
|
|
6663
|
+
stroke: { kind: "solid", color: chart.textColor ?? "#334155" },
|
|
6664
|
+
strokeWidth: finite(chart.gridWidth, 1),
|
|
6665
|
+
opacity: 0.25
|
|
6666
|
+
}
|
|
6667
|
+
};
|
|
6668
|
+
});
|
|
6669
|
+
}
|
|
6459
6670
|
function renderPolarArea(context) {
|
|
6460
6671
|
const layout = layoutOf(context);
|
|
6461
|
-
const { centerX, centerY, innerRadius, maxRadius, axisMin, range, sweep } = layout;
|
|
6672
|
+
const { centerX, centerY, innerRadius, maxRadius, axisMin, range, sweep, start } = layout;
|
|
6462
6673
|
const showLabels = context.showLabels && sweep >= MIN_LABEL_SWEEP;
|
|
6463
|
-
|
|
6464
|
-
const angles = { start:
|
|
6674
|
+
const wedges = context.chart.series.flatMap((series, index) => {
|
|
6675
|
+
const angles = { start: start + index * sweep, end: start + (index + 1) * sweep };
|
|
6465
6676
|
const value = Math.max(0, finite(series.values[0], 0));
|
|
6466
6677
|
const fraction = range > 0 ? Math.min(1, Math.max(0, (value - axisMin) / range)) : 0;
|
|
6467
6678
|
const outerRadius = Math.max(innerRadius + 1, innerRadius + (maxRadius - innerRadius) * fraction);
|
|
@@ -6473,11 +6684,19 @@ function renderPolarArea(context) {
|
|
|
6473
6684
|
const geometry = { centerX, centerY, outerRadius, innerRadius };
|
|
6474
6685
|
return [...nodes, ...createWedgeLabel(context, geometry, angles, series, value, rawColor)];
|
|
6475
6686
|
});
|
|
6687
|
+
return [...wedges, ...ringNodes(context, layout)];
|
|
6688
|
+
}
|
|
6689
|
+
function labelSizes(chart) {
|
|
6690
|
+
const base = Math.max(9, finite(chart.fontSize, 12));
|
|
6691
|
+
return {
|
|
6692
|
+
nameSize: Math.max(6, finite(chart.config?.polarNameSize, base)),
|
|
6693
|
+
valueSize: Math.max(6, finite(chart.config?.polarValueSize, base))
|
|
6694
|
+
};
|
|
6476
6695
|
}
|
|
6477
6696
|
function labelPlacement2(context, geometry, angles, series, fillColor) {
|
|
6478
6697
|
const mid = (angles.start + angles.end) / 2;
|
|
6479
|
-
const
|
|
6480
|
-
const lineHeight =
|
|
6698
|
+
const { nameSize, valueSize } = labelSizes(context.chart);
|
|
6699
|
+
const lineHeight = (nameSize + valueSize) * 1.2 / 2;
|
|
6481
6700
|
const ringThickness = geometry.outerRadius - geometry.innerRadius;
|
|
6482
6701
|
const labelOffsetX = finite(series.labelOffsetX, 0);
|
|
6483
6702
|
const labelOffsetY = finite(series.labelOffsetY, 0);
|
|
@@ -6485,13 +6704,14 @@ function labelPlacement2(context, geometry, angles, series, fillColor) {
|
|
|
6485
6704
|
const tooThin = ringThickness < lineHeight * 2 + 6;
|
|
6486
6705
|
const chordWidth = 2 * geometry.outerRadius * Math.sin(Math.abs(angles.end - angles.start) / 2);
|
|
6487
6706
|
const fitsInline = !tooThin && chordWidth >= LABEL_WIDTH;
|
|
6488
|
-
|
|
6707
|
+
const outsideLabels = context.chart.config?.polarOutsideLabels ?? false;
|
|
6708
|
+
if (!fitsInline && !hasManualOffset && !outsideLabels) {
|
|
6489
6709
|
return void 0;
|
|
6490
6710
|
}
|
|
6491
6711
|
const outside = hasManualOffset || !fitsInline;
|
|
6492
6712
|
const tickStart = pieArcPoint(geometry, mid, geometry.outerRadius + LEADER_INSET);
|
|
6493
6713
|
const point = outside ? hasManualOffset ? addOffset(pieArcPoint(geometry, mid, geometry.outerRadius), labelOffsetX, labelOffsetY) : pieArcPoint(geometry, mid, geometry.outerRadius + OUTSIDE_GAP) : pieArcPoint(geometry, mid, geometry.innerRadius + ringThickness * LABEL_RADIUS_FRACTION);
|
|
6494
|
-
const color2 = outside ? sameHueTint(representativeColor(fillColor, OUTSIDE_FALLBACK_COLOR), OUTSIDE_TINT_LIGHTNESS) ?? OUTSIDE_FALLBACK_COLOR : sameHueContrastColor(
|
|
6714
|
+
const color2 = outside ? outsideLabels && context.chart.textColor ? context.chart.textColor : sameHueTint(representativeColor(fillColor, OUTSIDE_FALLBACK_COLOR), OUTSIDE_TINT_LIGHTNESS) ?? OUTSIDE_FALLBACK_COLOR : sameHueContrastColor(
|
|
6495
6715
|
representativeColor(fillColor, "#0f172a"),
|
|
6496
6716
|
contrastTextColor(representativeColor(fillColor, "#0f172a"))
|
|
6497
6717
|
);
|
|
@@ -6504,8 +6724,8 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
6504
6724
|
}
|
|
6505
6725
|
const { chart, bounds, nextOrder } = context;
|
|
6506
6726
|
const { point, color: color2, outside, mid, tickStart } = placement;
|
|
6507
|
-
const
|
|
6508
|
-
const lineHeight =
|
|
6727
|
+
const { nameSize, valueSize } = labelSizes(chart);
|
|
6728
|
+
const lineHeight = Math.max(nameSize, valueSize) * 1.2;
|
|
6509
6729
|
const tickEnd = outside ? clipSegmentToRect(tickStart, point, LABEL_WIDTH / 2, lineHeight) : tickStart;
|
|
6510
6730
|
const tick = {
|
|
6511
6731
|
type: "path",
|
|
@@ -6528,22 +6748,28 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
6528
6748
|
bounds,
|
|
6529
6749
|
x: point.x - LABEL_WIDTH / 2,
|
|
6530
6750
|
width: LABEL_WIDTH,
|
|
6531
|
-
height: lineHeight,
|
|
6532
6751
|
fontFamily: chart.fontFamily ?? DEFAULT_FONT,
|
|
6533
|
-
fontSize,
|
|
6534
6752
|
align: "center",
|
|
6535
6753
|
verticalAlign: "middle",
|
|
6536
6754
|
lineHeight: 1.2,
|
|
6537
6755
|
color: color2
|
|
6538
6756
|
};
|
|
6757
|
+
const valueFirst = chart.config?.polarValueFirst ?? false;
|
|
6758
|
+
const nameHeight = nameSize * 1.2;
|
|
6759
|
+
const valueHeight = valueSize * 1.2;
|
|
6760
|
+
const top = point.y - (nameHeight + valueHeight) / 2;
|
|
6761
|
+
const nameY = valueFirst ? top + valueHeight : top;
|
|
6762
|
+
const valueY = valueFirst ? top : top + nameHeight;
|
|
6539
6763
|
const nameText = {
|
|
6540
6764
|
type: "text",
|
|
6541
6765
|
id: `chart-polar-area-label-name-${chart.id}-${series.id}`,
|
|
6542
6766
|
order: nextOrder(),
|
|
6543
6767
|
...base,
|
|
6544
|
-
y:
|
|
6768
|
+
y: nameY,
|
|
6769
|
+
height: nameSize * 1.2,
|
|
6770
|
+
fontSize: nameSize,
|
|
6545
6771
|
lines: [series.label],
|
|
6546
|
-
fontWeight: "bold",
|
|
6772
|
+
fontWeight: valueFirst ? "normal" : "bold",
|
|
6547
6773
|
detail,
|
|
6548
6774
|
prop: seriesLabelProp(series.id)
|
|
6549
6775
|
};
|
|
@@ -6552,9 +6778,11 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
6552
6778
|
id: `chart-polar-area-label-value-${chart.id}-${series.id}`,
|
|
6553
6779
|
order: nextOrder(),
|
|
6554
6780
|
...base,
|
|
6555
|
-
y:
|
|
6781
|
+
y: valueY,
|
|
6782
|
+
height: valueSize * 1.2,
|
|
6783
|
+
fontSize: valueSize,
|
|
6556
6784
|
lines: [formatFieldValue(value)],
|
|
6557
|
-
fontWeight: "normal",
|
|
6785
|
+
fontWeight: valueFirst ? "bold" : "normal",
|
|
6558
6786
|
detail,
|
|
6559
6787
|
prop: seriesValueProp(series.id, 0),
|
|
6560
6788
|
propKind: "value"
|
|
@@ -6578,7 +6806,8 @@ function radarFrameFor(context) {
|
|
|
6578
6806
|
min: chart.axisY.min,
|
|
6579
6807
|
max: chart.axisY.max,
|
|
6580
6808
|
count: radarCategoryCount(configuredCount, dataCount),
|
|
6581
|
-
curved: chart.chartType === "radial"
|
|
6809
|
+
curved: chart.chartType === "radial",
|
|
6810
|
+
tension: chart.config?.radarTension
|
|
6582
6811
|
};
|
|
6583
6812
|
}
|
|
6584
6813
|
function createRadarGeometry(context) {
|
|
@@ -6590,6 +6819,10 @@ function createRadarGeometry(context) {
|
|
|
6590
6819
|
return {
|
|
6591
6820
|
circular: frame.curved,
|
|
6592
6821
|
areaOpacity: Math.max(0, Math.min(1, chart.config?.areaOpacity ?? 0.16)),
|
|
6822
|
+
strokeWidth: Math.max(0, chart.config?.radarStrokeWidth ?? 2),
|
|
6823
|
+
tension: frame.tension,
|
|
6824
|
+
pointSize: Math.max(0, chart.config?.radarPointSize ?? 3),
|
|
6825
|
+
showSpokes: chart.config?.radarSpokes ?? true,
|
|
6593
6826
|
categories,
|
|
6594
6827
|
centerX: frame.centerX,
|
|
6595
6828
|
centerY: frame.centerY,
|
|
@@ -6614,7 +6847,7 @@ function renderRadarGrid(context, geometry) {
|
|
|
6614
6847
|
if (context.chart.showGrid === false) {
|
|
6615
6848
|
return [];
|
|
6616
6849
|
}
|
|
6617
|
-
return [...renderRings(context, geometry), ...renderSpokes(context, geometry)];
|
|
6850
|
+
return [...renderRings(context, geometry), ...geometry.showSpokes ? renderSpokes(context, geometry) : []];
|
|
6618
6851
|
}
|
|
6619
6852
|
function renderRings(context, geometry) {
|
|
6620
6853
|
return chartTicks(context.chart.axisY).filter((tick) => tick > context.chart.axisY.min).map((tick) => createRingNode(context, geometry, tick));
|
|
@@ -6722,11 +6955,11 @@ function renderRadarSeries(context, geometry) {
|
|
|
6722
6955
|
function renderSeries(context, geometry, series, seriesIndex) {
|
|
6723
6956
|
const color2 = series.color ?? CHART_COLORS[seriesIndex % CHART_COLORS.length];
|
|
6724
6957
|
const points = seriesPoints(series, context, geometry);
|
|
6725
|
-
const path = radarSeriesPath(points, geometry.circular);
|
|
6958
|
+
const path = radarSeriesPath(points, geometry.circular, geometry.tension);
|
|
6726
6959
|
return [
|
|
6727
6960
|
createSeriesFill(context, geometry, series, path, color2),
|
|
6728
|
-
createSeriesStroke(context, series, path, color2),
|
|
6729
|
-
...createSeriesPoints(context, series, points, color2)
|
|
6961
|
+
...geometry.strokeWidth > 0 ? [createSeriesStroke(context, geometry, series, path, color2)] : [],
|
|
6962
|
+
...geometry.pointSize > 0 ? createSeriesPoints(context, geometry, series, points, color2) : []
|
|
6730
6963
|
];
|
|
6731
6964
|
}
|
|
6732
6965
|
function seriesPoints(series, context, geometry) {
|
|
@@ -6751,7 +6984,7 @@ function createSeriesFill(context, geometry, series, path, color2) {
|
|
|
6751
6984
|
}
|
|
6752
6985
|
};
|
|
6753
6986
|
}
|
|
6754
|
-
function createSeriesStroke(context, series, path, color2) {
|
|
6987
|
+
function createSeriesStroke(context, geometry, series, path, color2) {
|
|
6755
6988
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
6756
6989
|
return {
|
|
6757
6990
|
type: "path",
|
|
@@ -6763,13 +6996,13 @@ function createSeriesStroke(context, series, path, color2) {
|
|
|
6763
6996
|
style: {
|
|
6764
6997
|
fill: { kind: "none" },
|
|
6765
6998
|
stroke: paint(color2, diagnostics, chart.id),
|
|
6766
|
-
strokeWidth:
|
|
6999
|
+
strokeWidth: geometry.strokeWidth,
|
|
6767
7000
|
lineJoin: "round",
|
|
6768
7001
|
shadow: resolveChartShadow(chart.shadowStyle)
|
|
6769
7002
|
}
|
|
6770
7003
|
};
|
|
6771
7004
|
}
|
|
6772
|
-
function createSeriesPoints(context, series, points, color2) {
|
|
7005
|
+
function createSeriesPoints(context, geometry, series, points, color2) {
|
|
6773
7006
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
6774
7007
|
return points.map((point, pointIndex) => ({
|
|
6775
7008
|
type: "ellipse",
|
|
@@ -6778,8 +7011,8 @@ function createSeriesPoints(context, series, points, color2) {
|
|
|
6778
7011
|
bounds,
|
|
6779
7012
|
cx: point.x,
|
|
6780
7013
|
cy: point.y,
|
|
6781
|
-
rx:
|
|
6782
|
-
ry:
|
|
7014
|
+
rx: geometry.pointSize,
|
|
7015
|
+
ry: geometry.pointSize,
|
|
6783
7016
|
detail: { of: "chartValue", series: series.id, valueIndex: pointIndex, mark: "radar-vertex" },
|
|
6784
7017
|
prop: seriesValueProp(series.id, pointIndex),
|
|
6785
7018
|
style: { fill: paint(color2, diagnostics, chart.id) }
|
|
@@ -6797,7 +7030,7 @@ function renderRadar(context) {
|
|
|
6797
7030
|
}
|
|
6798
7031
|
|
|
6799
7032
|
// src/renderScene/charts/renderers/radialBar.ts
|
|
6800
|
-
var
|
|
7033
|
+
var TOP3 = -Math.PI / 2;
|
|
6801
7034
|
var DEFAULT_RING_THICKNESS = 14;
|
|
6802
7035
|
var DEFAULT_RING_GAP = 4;
|
|
6803
7036
|
var TRACK_OPACITY = 0.18;
|
|
@@ -6823,14 +7056,14 @@ function ringShadow(shadow, ringThickness) {
|
|
|
6823
7056
|
const scale = distance > maxDistance ? maxDistance / distance : 1;
|
|
6824
7057
|
return { ...shadow, blur, dx: shadow.dx * scale, dy: shadow.dy * scale };
|
|
6825
7058
|
}
|
|
6826
|
-
function ringProgressPath(cx, cy, r, sweep) {
|
|
7059
|
+
function ringProgressPath(cx, cy, r, sweep, from) {
|
|
6827
7060
|
if (sweep >= Math.PI * 2 - FULL_SWEEP_EPSILON) {
|
|
6828
|
-
const start2 = arcPoint(cx, cy, r,
|
|
6829
|
-
const mid = arcPoint(cx, cy, r,
|
|
7061
|
+
const start2 = arcPoint(cx, cy, r, from);
|
|
7062
|
+
const mid = arcPoint(cx, cy, r, from + Math.PI);
|
|
6830
7063
|
return `M ${start2.x} ${start2.y} A ${r} ${r} 0 1 1 ${mid.x} ${mid.y} A ${r} ${r} 0 1 1 ${start2.x} ${start2.y}`;
|
|
6831
7064
|
}
|
|
6832
|
-
const start = arcPoint(cx, cy, r,
|
|
6833
|
-
const end = arcPoint(cx, cy, r,
|
|
7065
|
+
const start = arcPoint(cx, cy, r, from);
|
|
7066
|
+
const end = arcPoint(cx, cy, r, from + sweep);
|
|
6834
7067
|
const largeArc = sweep > Math.PI ? 1 : 0;
|
|
6835
7068
|
return `M ${start.x} ${start.y} A ${r} ${r} 0 ${largeArc} 1 ${end.x} ${end.y}`;
|
|
6836
7069
|
}
|
|
@@ -6844,12 +7077,16 @@ function layoutOf2(context) {
|
|
|
6844
7077
|
ringThickness: Math.max(1, finite(chart.config?.ringThickness, DEFAULT_RING_THICKNESS)),
|
|
6845
7078
|
ringGap: Math.max(0, finite(chart.config?.ringGap, DEFAULT_RING_GAP)),
|
|
6846
7079
|
axisMin,
|
|
6847
|
-
range: finite(chart.axisY.max, 100) - axisMin
|
|
7080
|
+
range: finite(chart.axisY.max, 100) - axisMin,
|
|
7081
|
+
start: TOP3 + finite(chart.config?.ringStartAngle, 0) * Math.PI / 180,
|
|
7082
|
+
total: Math.min(360, Math.max(1, finite(chart.config?.ringSweep, 360))) * Math.PI / 180,
|
|
7083
|
+
trackOpacity: Math.min(1, Math.max(0, finite(chart.config?.ringTrackOpacity, TRACK_OPACITY))),
|
|
7084
|
+
cap: chart.config?.ringCap ?? "round"
|
|
6848
7085
|
};
|
|
6849
7086
|
}
|
|
6850
7087
|
function ringEndShadows(context, layout, series, radius, sweep, color2) {
|
|
6851
7088
|
const { chart, bounds, nextOrder } = context;
|
|
6852
|
-
const { centerX, centerY, ringThickness } = layout;
|
|
7089
|
+
const { centerX, centerY, ringThickness, start } = layout;
|
|
6853
7090
|
const shadow = resolveChartShadow(chart.shadowStyle);
|
|
6854
7091
|
const isFullCircle = sweep >= Math.PI * 2 - FULL_SWEEP_EPSILON;
|
|
6855
7092
|
if (!shadow || isFullCircle) {
|
|
@@ -6858,8 +7095,8 @@ function ringEndShadows(context, layout, series, radius, sweep, color2) {
|
|
|
6858
7095
|
const clampedShadow = ringShadow(shadow, ringThickness);
|
|
6859
7096
|
const stubSweep = Math.min(sweep, ringThickness / radius);
|
|
6860
7097
|
return [
|
|
6861
|
-
[
|
|
6862
|
-
[
|
|
7098
|
+
[start, start + stubSweep],
|
|
7099
|
+
[start + sweep - stubSweep, start + sweep]
|
|
6863
7100
|
].map(
|
|
6864
7101
|
([from, to], endIndex) => ({
|
|
6865
7102
|
type: "path",
|
|
@@ -6871,7 +7108,7 @@ function ringEndShadows(context, layout, series, radius, sweep, color2) {
|
|
|
6871
7108
|
fill: { kind: "none" },
|
|
6872
7109
|
stroke: color2,
|
|
6873
7110
|
strokeWidth: ringThickness,
|
|
6874
|
-
lineCap:
|
|
7111
|
+
lineCap: layout.cap,
|
|
6875
7112
|
shadow: clampedShadow,
|
|
6876
7113
|
clip: {
|
|
6877
7114
|
type: "path",
|
|
@@ -6881,9 +7118,9 @@ function ringEndShadows(context, layout, series, radius, sweep, color2) {
|
|
|
6881
7118
|
})
|
|
6882
7119
|
);
|
|
6883
7120
|
}
|
|
6884
|
-
function
|
|
7121
|
+
function ringNodes2(context, layout, series, index) {
|
|
6885
7122
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
6886
|
-
const { centerX, centerY, outerRadius, ringThickness, ringGap, axisMin, range } = layout;
|
|
7123
|
+
const { centerX, centerY, outerRadius, ringThickness, ringGap, axisMin, range, start, total, trackOpacity, cap } = layout;
|
|
6887
7124
|
const radius = outerRadius - index * (ringThickness + ringGap) - ringThickness / 2;
|
|
6888
7125
|
if (radius <= ringThickness / 2) {
|
|
6889
7126
|
return [];
|
|
@@ -6891,7 +7128,13 @@ function ringNodes(context, layout, series, index) {
|
|
|
6891
7128
|
const color2 = paint(series.color ?? CHART_COLORS[index % CHART_COLORS.length], diagnostics, chart.id);
|
|
6892
7129
|
const value = Math.max(0, finite(series.values[0], 0));
|
|
6893
7130
|
const fraction = range > 0 ? Math.min(1, Math.max(0, (value - axisMin) / range)) : 0;
|
|
6894
|
-
const
|
|
7131
|
+
const trackStyle = {
|
|
7132
|
+
fill: { kind: "none" },
|
|
7133
|
+
stroke: color2,
|
|
7134
|
+
strokeWidth: ringThickness,
|
|
7135
|
+
opacity: trackOpacity
|
|
7136
|
+
};
|
|
7137
|
+
const track = total >= Math.PI * 2 - FULL_SWEEP_EPSILON ? {
|
|
6895
7138
|
type: "ellipse",
|
|
6896
7139
|
id: `chart-radial-bar-track-${chart.id}-${series.id}`,
|
|
6897
7140
|
order: nextOrder(),
|
|
@@ -6900,28 +7143,35 @@ function ringNodes(context, layout, series, index) {
|
|
|
6900
7143
|
cy: centerY,
|
|
6901
7144
|
rx: radius,
|
|
6902
7145
|
ry: radius,
|
|
6903
|
-
style:
|
|
7146
|
+
style: trackStyle
|
|
7147
|
+
} : {
|
|
7148
|
+
type: "path",
|
|
7149
|
+
id: `chart-radial-bar-track-${chart.id}-${series.id}`,
|
|
7150
|
+
order: nextOrder(),
|
|
7151
|
+
bounds,
|
|
7152
|
+
d: arcSegmentPath(centerX, centerY, radius, start, start + total),
|
|
7153
|
+
style: { ...trackStyle, lineCap: cap }
|
|
6904
7154
|
};
|
|
6905
7155
|
if (fraction <= 0) {
|
|
6906
7156
|
return [track];
|
|
6907
7157
|
}
|
|
6908
|
-
const sweep = fraction *
|
|
7158
|
+
const sweep = fraction * total;
|
|
6909
7159
|
const casters = ringEndShadows(context, layout, series, radius, sweep, color2);
|
|
6910
7160
|
const progress = {
|
|
6911
7161
|
type: "path",
|
|
6912
7162
|
id: `chart-radial-bar-ring-${chart.id}-${series.id}`,
|
|
6913
7163
|
order: nextOrder(),
|
|
6914
7164
|
bounds,
|
|
6915
|
-
d: ringProgressPath(centerX, centerY, radius, sweep),
|
|
7165
|
+
d: ringProgressPath(centerX, centerY, radius, sweep, start),
|
|
6916
7166
|
detail: { of: "chartValue", series: series.id, valueIndex: 0, mark: "radial-bar-ring" },
|
|
6917
7167
|
prop: seriesValueProp(series.id, 0),
|
|
6918
|
-
style: { fill: { kind: "none" }, stroke: color2, strokeWidth: ringThickness, lineCap:
|
|
7168
|
+
style: { fill: { kind: "none" }, stroke: color2, strokeWidth: ringThickness, lineCap: cap }
|
|
6919
7169
|
};
|
|
6920
7170
|
return [track, ...casters, progress];
|
|
6921
7171
|
}
|
|
6922
7172
|
function renderRadialBar(context) {
|
|
6923
7173
|
const layout = layoutOf2(context);
|
|
6924
|
-
return context.chart.series.flatMap((series, index) =>
|
|
7174
|
+
return context.chart.series.flatMap((series, index) => ringNodes2(context, layout, series, index));
|
|
6925
7175
|
}
|
|
6926
7176
|
|
|
6927
7177
|
// src/renderScene/charts/renderers/sankey/links.ts
|
|
@@ -6931,11 +7181,11 @@ function renderSankeyLinks(context, data) {
|
|
|
6931
7181
|
const { plot } = context;
|
|
6932
7182
|
const clipPath = shadow ? `M ${plot.x} ${plot.y} H ${plot.x + plot.width} V ${plot.y + plot.height} H ${plot.x} Z` : void 0;
|
|
6933
7183
|
return data.links.map((link, linkIndex) => {
|
|
6934
|
-
const ribbon = createSankeyLinkRibbon(data, link, linkIndex, gradient);
|
|
7184
|
+
const ribbon = createSankeyLinkRibbon(context, data, link, linkIndex, gradient);
|
|
6935
7185
|
return createSankeyRibbonNode(context, ribbon, shadow, clipPath, gradient);
|
|
6936
7186
|
});
|
|
6937
7187
|
}
|
|
6938
|
-
function createSankeyLinkRibbon(data, link, linkIndex, gradient) {
|
|
7188
|
+
function createSankeyLinkRibbon(context, data, link, linkIndex, gradient) {
|
|
6939
7189
|
const source = {
|
|
6940
7190
|
x: data.baseX + link.x0,
|
|
6941
7191
|
top: data.baseY + link.sourceY0,
|
|
@@ -6946,6 +7196,7 @@ function createSankeyLinkRibbon(data, link, linkIndex, gradient) {
|
|
|
6946
7196
|
top: data.baseY + link.targetY0,
|
|
6947
7197
|
bottom: data.baseY + link.targetY1
|
|
6948
7198
|
};
|
|
7199
|
+
const config = context.chart.config;
|
|
6949
7200
|
const fromColor = link.color || data.nodeColors.get(link.source) || DEFAULT_ZONE_FILL;
|
|
6950
7201
|
const toColor = data.nodeColors.get(link.target) || DEFAULT_ZONE_FILL;
|
|
6951
7202
|
const fill2 = gradient ? {
|
|
@@ -6962,9 +7213,9 @@ function createSankeyLinkRibbon(data, link, linkIndex, gradient) {
|
|
|
6962
7213
|
toId: link.target,
|
|
6963
7214
|
source,
|
|
6964
7215
|
target,
|
|
6965
|
-
controlX:
|
|
7216
|
+
controlX: source.x + (target.x - source.x) * Math.min(1, Math.max(0, finite(config?.sankeyLinkCurve, 0.5))),
|
|
6966
7217
|
fill: fill2,
|
|
6967
|
-
opacity: link.color ? 0.85 : 0.45
|
|
7218
|
+
opacity: Math.min(1, Math.max(0, finite(config?.sankeyLinkOpacity, link.color ? 0.85 : 0.45)))
|
|
6968
7219
|
};
|
|
6969
7220
|
}
|
|
6970
7221
|
function createSankeyRibbonNode(context, ribbon, shadow, clipPath, gradient) {
|
|
@@ -7108,7 +7359,7 @@ function createOutsideLabel(context, data, node) {
|
|
|
7108
7359
|
chart,
|
|
7109
7360
|
align: isLastColumn ? "right" : "left"
|
|
7110
7361
|
}),
|
|
7111
|
-
fontSize: data.
|
|
7362
|
+
fontSize: data.labelSize,
|
|
7112
7363
|
fontWeight: "bold",
|
|
7113
7364
|
verticalAlign: "middle"
|
|
7114
7365
|
};
|
|
@@ -7119,7 +7370,7 @@ function createInsideLabel(context, data, node, orientation) {
|
|
|
7119
7370
|
const y = data.baseY + node.y;
|
|
7120
7371
|
const centerX = x + node.width / 2;
|
|
7121
7372
|
const centerY = y + node.height / 2;
|
|
7122
|
-
const fontSize = data.
|
|
7373
|
+
const fontSize = data.labelSize;
|
|
7123
7374
|
const id = `chart-sankey-label-${chart.id}-${node.id}`;
|
|
7124
7375
|
if (orientation === "vertical") {
|
|
7125
7376
|
const thickness = fontSize * 1.4;
|
|
@@ -7165,13 +7416,17 @@ function createSankeyRenderData(context) {
|
|
|
7165
7416
|
const { chart, plot, showLabels } = context;
|
|
7166
7417
|
const labelGutter = showLabels ? 92 : 0;
|
|
7167
7418
|
const availableWidth = Math.max(1, plot.width - labelGutter * 2);
|
|
7168
|
-
const layout = layoutSankey(createNodeInputs(context), createLinkInputs(context), availableWidth, plot.height
|
|
7419
|
+
const layout = layoutSankey(createNodeInputs(context), createLinkInputs(context), availableWidth, plot.height, {
|
|
7420
|
+
nodeWidth: Math.max(1, finite(chart.config?.sankeyNodeWidth, 18)),
|
|
7421
|
+
nodeGap: Math.max(0, finite(chart.config?.sankeyNodeGap, 8))
|
|
7422
|
+
});
|
|
7169
7423
|
return {
|
|
7170
7424
|
...layout,
|
|
7171
7425
|
baseX: plot.x + labelGutter,
|
|
7172
7426
|
baseY: plot.y,
|
|
7173
7427
|
labelGutter,
|
|
7174
7428
|
fontSize: Math.max(9, finite(chart.fontSize, 12)),
|
|
7429
|
+
labelSize: Math.max(6, finite(chart.config?.sankeyLabelSize, Math.max(9, finite(chart.fontSize, 12)) - 2)),
|
|
7175
7430
|
columnCount: Math.max(1, ...layout.nodes.map((node) => node.column + 1)),
|
|
7176
7431
|
nodeColors: new Map(layout.nodes.map((node) => [node.id, node.color || DEFAULT_ZONE_FILL]))
|
|
7177
7432
|
};
|
|
@@ -7211,20 +7466,24 @@ function renderSankey(context) {
|
|
|
7211
7466
|
}
|
|
7212
7467
|
|
|
7213
7468
|
// src/renderScene/charts/renderers/scatter.ts
|
|
7214
|
-
|
|
7469
|
+
var DEFAULT_POINT_SIZE = 4;
|
|
7470
|
+
function renderScatter(context) {
|
|
7215
7471
|
const nodes = [];
|
|
7216
7472
|
const shadow = resolveChartShadow(context.chart.shadowStyle);
|
|
7217
7473
|
context.chart.series.forEach((series, seriesIndex) => {
|
|
7218
7474
|
const color2 = series.color ?? CHART_COLORS[seriesIndex % CHART_COLORS.length];
|
|
7219
7475
|
const points = pixelPoints(context, seriesValuePairs(context.chart, series));
|
|
7220
7476
|
points.forEach((point, pointIndex) => {
|
|
7221
|
-
nodes.push(createScatterPoint(context, series, point, pointIndex, color2,
|
|
7477
|
+
nodes.push(createScatterPoint(context, series, point, pointIndex, color2, shadow));
|
|
7222
7478
|
});
|
|
7223
7479
|
});
|
|
7224
7480
|
return nodes;
|
|
7225
7481
|
}
|
|
7226
|
-
function createScatterPoint(context, series, point, pointIndex, color2,
|
|
7482
|
+
function createScatterPoint(context, series, point, pointIndex, color2, shadow) {
|
|
7227
7483
|
const { chart, bounds, diagnostics, nextOrder } = context;
|
|
7484
|
+
const config = chart.config;
|
|
7485
|
+
const radius = config?.pointSize ?? DEFAULT_POINT_SIZE;
|
|
7486
|
+
const strokeWidth = config?.pointStrokeWidth ?? 0;
|
|
7228
7487
|
return {
|
|
7229
7488
|
type: "ellipse",
|
|
7230
7489
|
id: `chart-point-${chart.id}-${series.id}-${pointIndex}`,
|
|
@@ -7235,7 +7494,13 @@ function createScatterPoint(context, series, point, pointIndex, color2, radius,
|
|
|
7235
7494
|
rx: radius,
|
|
7236
7495
|
ry: radius,
|
|
7237
7496
|
detail: { of: "chartValue", series: series.id, valueIndex: pointIndex },
|
|
7238
|
-
style: {
|
|
7497
|
+
style: {
|
|
7498
|
+
fill: paint(color2, diagnostics, chart.id),
|
|
7499
|
+
stroke: strokeWidth > 0 ? paint(config?.pointStrokeColor ?? color2, diagnostics, chart.id) : void 0,
|
|
7500
|
+
strokeWidth: strokeWidth > 0 ? strokeWidth : void 0,
|
|
7501
|
+
opacity: config?.pointOpacity,
|
|
7502
|
+
shadow
|
|
7503
|
+
}
|
|
7239
7504
|
};
|
|
7240
7505
|
}
|
|
7241
7506
|
|
|
@@ -7257,7 +7522,11 @@ function createTreemapLayout(context) {
|
|
|
7257
7522
|
gridWidth: Math.max(1, plot.width),
|
|
7258
7523
|
gridHeight: Math.max(1, plot.height - legendHeight),
|
|
7259
7524
|
cellGap,
|
|
7260
|
-
cellRadius: Math.max(0, finite(chart.config?.barCornerRadius, cellGap))
|
|
7525
|
+
cellRadius: Math.max(0, finite(chart.config?.barCornerRadius, cellGap)),
|
|
7526
|
+
headerHeight: Math.max(0, finite(chart.config?.headerHeight, 20)),
|
|
7527
|
+
labelSize: Math.max(6, finite(chart.config?.tileLabelSize, Math.max(8, fontSize - 1))),
|
|
7528
|
+
valueSize: Math.max(6, finite(chart.config?.tileValueSize, Math.max(8, fontSize - 1))),
|
|
7529
|
+
labelPadding: Math.max(0, finite(chart.config?.tileLabelPadding, 4))
|
|
7261
7530
|
};
|
|
7262
7531
|
}
|
|
7263
7532
|
function treemapLeafValue(leaf) {
|
|
@@ -7405,7 +7674,6 @@ function renderSideLegend(context, layout) {
|
|
|
7405
7674
|
}
|
|
7406
7675
|
|
|
7407
7676
|
// src/renderScene/charts/renderers/treemap/tiles.ts
|
|
7408
|
-
var HEADER_HEIGHT = 20;
|
|
7409
7677
|
function renderTreemapTiles(context, layout) {
|
|
7410
7678
|
const { tiles, headers } = layoutTreemapTiles(context, layout);
|
|
7411
7679
|
const nodes = [];
|
|
@@ -7444,7 +7712,7 @@ function layoutTreemapTiles(context, layout) {
|
|
|
7444
7712
|
const tiles = [];
|
|
7445
7713
|
const headers = [];
|
|
7446
7714
|
groupRects.forEach((groupRect) => {
|
|
7447
|
-
const headerHeight = context.showLabels ? Math.min(
|
|
7715
|
+
const headerHeight = context.showLabels ? Math.min(layout.headerHeight, groupRect.height) : 0;
|
|
7448
7716
|
if (context.showLabels) {
|
|
7449
7717
|
headers.push({
|
|
7450
7718
|
key: groupRect.item.key,
|
|
@@ -7478,7 +7746,7 @@ function renderTreemapHeader(context, layout, header, index) {
|
|
|
7478
7746
|
x: plot.x + header.x,
|
|
7479
7747
|
y: plot.y + header.y,
|
|
7480
7748
|
width: header.width,
|
|
7481
|
-
height:
|
|
7749
|
+
height: layout.headerHeight,
|
|
7482
7750
|
rx: layout.cellRadius,
|
|
7483
7751
|
style: { fill: { kind: "solid", color: fill2 } }
|
|
7484
7752
|
};
|
|
@@ -7490,7 +7758,7 @@ function renderTreemapHeader(context, layout, header, index) {
|
|
|
7490
7758
|
bounds,
|
|
7491
7759
|
frame: {
|
|
7492
7760
|
x: plot.x + header.x,
|
|
7493
|
-
y: plot.y + header.y + (
|
|
7761
|
+
y: plot.y + header.y + (layout.headerHeight - smallFontSize) / 2,
|
|
7494
7762
|
width: header.width,
|
|
7495
7763
|
height: smallFontSize + 2
|
|
7496
7764
|
},
|
|
@@ -7548,8 +7816,8 @@ function createTileNode(context, layout, tile, color2, nextColor) {
|
|
|
7548
7816
|
rx: layout.cellRadius,
|
|
7549
7817
|
style: {
|
|
7550
7818
|
fill: fill2,
|
|
7551
|
-
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
7552
|
-
strokeWidth: finite(chart.gridWidth, 1),
|
|
7819
|
+
stroke: { kind: "solid", color: chart.config?.tileStrokeColor ?? chart.gridColor ?? "#e2e8f0" },
|
|
7820
|
+
strokeWidth: finite(chart.config?.tileStrokeWidth, finite(chart.gridWidth, 1)),
|
|
7553
7821
|
shadow,
|
|
7554
7822
|
clip: clipPath ? { type: "path", d: clipPath } : void 0
|
|
7555
7823
|
}
|
|
@@ -7559,13 +7827,15 @@ function createTileLabel(context, layout, tile, color2) {
|
|
|
7559
7827
|
const { chart, plot, bounds, nextOrder } = context;
|
|
7560
7828
|
const { leaf, value } = tile.item;
|
|
7561
7829
|
const gap = layout.cellGap;
|
|
7562
|
-
const
|
|
7563
|
-
const
|
|
7564
|
-
const
|
|
7565
|
-
const
|
|
7566
|
-
const
|
|
7567
|
-
const
|
|
7568
|
-
const lineHeight = layout.
|
|
7830
|
+
const pad = layout.labelPadding;
|
|
7831
|
+
const width = Math.max(1, tile.width - gap - pad * 2);
|
|
7832
|
+
const height = Math.max(1, tile.height - gap - pad * 1.5);
|
|
7833
|
+
const x = plot.x + tile.x + gap / 2 + pad;
|
|
7834
|
+
const y = plot.y + tile.y + gap / 2 + pad * 0.75;
|
|
7835
|
+
const textColor = chart.config?.tileTextColor ?? contrastTextColor(representativeColor(color2, "#ffffff"));
|
|
7836
|
+
const lineHeight = layout.labelSize * 1.2;
|
|
7837
|
+
const maxLines = Math.max(1, Math.floor(height / lineHeight));
|
|
7838
|
+
const labelLines = wrapText(leaf.label, width, layout.labelSize).slice(0, maxLines).map((line) => ellipsizeToWidth(line, width, layout.labelSize, true));
|
|
7569
7839
|
const label = {
|
|
7570
7840
|
...chartText({
|
|
7571
7841
|
id: `chart-treemap-label-${chart.id}-${leaf.id}`,
|
|
@@ -7576,10 +7846,15 @@ function createTileLabel(context, layout, tile, color2) {
|
|
|
7576
7846
|
chart
|
|
7577
7847
|
}),
|
|
7578
7848
|
lines: labelLines,
|
|
7579
|
-
fontSize: layout.
|
|
7849
|
+
fontSize: layout.labelSize,
|
|
7580
7850
|
fontWeight: "bold",
|
|
7581
7851
|
color: textColor
|
|
7582
7852
|
};
|
|
7853
|
+
const valueText = String(value);
|
|
7854
|
+
const valueFits = labelLines.length * lineHeight + layout.valueSize * 1.2 <= height + 2 && estimateTextWidth(valueText, layout.valueSize, false) <= width;
|
|
7855
|
+
if (chart.config?.showTileValues === false || !valueFits) {
|
|
7856
|
+
return [label];
|
|
7857
|
+
}
|
|
7583
7858
|
const valueNode = {
|
|
7584
7859
|
...chartText({
|
|
7585
7860
|
id: `chart-treemap-value-${chart.id}-${leaf.id}`,
|
|
@@ -7595,7 +7870,7 @@ function createTileLabel(context, layout, tile, color2) {
|
|
|
7595
7870
|
chart
|
|
7596
7871
|
}),
|
|
7597
7872
|
lines: [String(value)],
|
|
7598
|
-
fontSize: layout.
|
|
7873
|
+
fontSize: layout.valueSize,
|
|
7599
7874
|
color: textColor
|
|
7600
7875
|
};
|
|
7601
7876
|
return [label, valueNode];
|
|
@@ -7694,9 +7969,10 @@ function radarDetail(chart, plot) {
|
|
|
7694
7969
|
const centerX = plot.x + plot.width / 2;
|
|
7695
7970
|
const centerY = plot.y + plot.height / 2;
|
|
7696
7971
|
const curved = chart.chartType === "radial" ? 1 : 0;
|
|
7972
|
+
const tension = chart.config?.radarTension;
|
|
7697
7973
|
return {
|
|
7698
7974
|
of: "radarGeometry",
|
|
7699
|
-
radarGeometry: `${centerX},${centerY},${radius},${chart.axisY.min},${chart.axisY.max},${count},${curved}`
|
|
7975
|
+
radarGeometry: `${centerX},${centerY},${radius},${chart.axisY.min},${chart.axisY.max},${count},${curved}${tension === void 0 ? "" : `,${tension}`}`
|
|
7700
7976
|
};
|
|
7701
7977
|
}
|
|
7702
7978
|
function frameDetail(chart, plot) {
|
|
@@ -8458,7 +8734,7 @@ function shaderSurfaceSvg(node, defs) {
|
|
|
8458
8734
|
const rotation = transform(node.rotation, { x: node.x + node.width / 2, y: node.y + node.height / 2 });
|
|
8459
8735
|
const parameters = xml(JSON.stringify(node.shader.parameters));
|
|
8460
8736
|
const fillColor = node.fillColor ? ` data-sf-shader-fill="${xml(node.fillColor)}"` : "";
|
|
8461
|
-
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" ? "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>`;
|
|
8737
|
+
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>`;
|
|
8462
8738
|
}
|
|
8463
8739
|
function rollingDigitSvg(character, node) {
|
|
8464
8740
|
const style = node.widgetStyle;
|
|
@@ -8469,7 +8745,7 @@ function rollingDigitSvg(character, node) {
|
|
|
8469
8745
|
}
|
|
8470
8746
|
function rollingNumberSvg(node, defs) {
|
|
8471
8747
|
const rotation = transform(node.rotation, { x: node.x + node.width / 2, y: node.y + node.height / 2 });
|
|
8472
|
-
const fontSize = Math.max(1, Math.min(node.width, node.height) * 0.28);
|
|
8748
|
+
const fontSize = node.widgetStyle.fontSize > 0 ? node.widgetStyle.fontSize : Math.max(1, Math.min(node.width, node.height) * 0.28);
|
|
8473
8749
|
const label = node.label ? `<span xmlns="http://www.w3.org/1999/xhtml" style="margin-bottom:.14em;color:${xml(node.widgetStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${xml(node.label)}</span>` : "";
|
|
8474
8750
|
const digits = [...node.value].map((character) => rollingDigitSvg(character, node)).join("");
|
|
8475
8751
|
const widgetStyle = xml(JSON.stringify(node.widgetStyle));
|
|
@@ -8555,5 +8831,5 @@ function render(source, options = {}) {
|
|
|
8555
8831
|
}
|
|
8556
8832
|
|
|
8557
8833
|
export { DEFAULT_ROLLING_NUMBER_STYLE, collectCanvasObjects, decodeColor, decodeShadow, formatRollingNumber, render, renderCanvas, sflToRenderInput };
|
|
8558
|
-
//# sourceMappingURL=chunk-
|
|
8559
|
-
//# sourceMappingURL=chunk-
|
|
8834
|
+
//# sourceMappingURL=chunk-65IVT4GK.js.map
|
|
8835
|
+
//# sourceMappingURL=chunk-65IVT4GK.js.map
|