stickyflow 0.7.0 → 0.8.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 +12 -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-JCRPLPKV.js → chunk-CZW3ARXQ.js} +4 -4
- package/dist/{chunk-JCRPLPKV.js.map → chunk-CZW3ARXQ.js.map} +1 -1
- package/dist/{chunk-MUKIGLR5.js → chunk-EDOPENSE.js} +169 -42
- package/dist/chunk-EDOPENSE.js.map +1 -0
- package/dist/{chunk-EKAWJFJQ.cjs → chunk-FQ7GMLCM.cjs} +15 -15
- package/dist/{chunk-EKAWJFJQ.cjs.map → chunk-FQ7GMLCM.cjs.map} +1 -1
- package/dist/{chunk-JQK4IGXJ.js → chunk-GLZVHUSW.js} +50 -6
- package/dist/chunk-GLZVHUSW.js.map +1 -0
- package/dist/{chunk-BUOWM3LC.cjs → chunk-IR2T47NW.cjs} +198 -71
- package/dist/chunk-IR2T47NW.cjs.map +1 -0
- package/dist/{chunk-ZNHYW47T.js → chunk-LFEGZJWC.js} +3 -3
- package/dist/{chunk-ZNHYW47T.js.map → chunk-LFEGZJWC.js.map} +1 -1
- package/dist/{chunk-KXYSO6GC.cjs → chunk-LNW5VIEA.cjs} +53 -5
- package/dist/chunk-LNW5VIEA.cjs.map +1 -0
- package/dist/{chunk-SDMQRSRW.js → chunk-MAPNY7MJ.js} +331 -125
- package/dist/chunk-MAPNY7MJ.js.map +1 -0
- package/dist/{chunk-A73UJ5AQ.cjs → chunk-VOYX6JMW.cjs} +950 -744
- package/dist/chunk-VOYX6JMW.cjs.map +1 -0
- package/dist/{chunk-OWNVXKXN.cjs → chunk-XPM3E7NV.cjs} +23 -23
- package/dist/{chunk-OWNVXKXN.cjs.map → chunk-XPM3E7NV.cjs.map} +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +266 -235
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +2 -2
- package/dist/interaction/index.d.ts +2 -2
- package/dist/interaction/index.js +42 -11
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-BU2uYzjG.d.cts → render-Bp2FLEzv.d.cts} +10 -0
- package/dist/{render-BU2uYzjG.d.ts → render-Bp2FLEzv.d.ts} +10 -0
- package/dist/{runtime-BPzyD-Nd.d.ts → runtime-CWIGxRcL.d.ts} +2 -2
- package/dist/{runtime-B7KiTmn8.d.cts → runtime-DIag-XBa.d.cts} +2 -2
- package/dist/{runtimeTypes-BIP70z72.d.cts → runtimeTypes-BYODuxHk.d.cts} +1 -1
- package/dist/{runtimeTypes-DalvhScn.d.ts → runtimeTypes-C7sSLfOK.d.ts} +1 -1
- package/dist/stickyflow-diagram.global.js +141 -38
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-DMWs27Hn.d.ts → types-B9QM_H3R.d.ts} +1 -1
- package/dist/{types-D_2NZ6lL.d.cts → types-D2w6D_wG.d.cts} +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-A73UJ5AQ.cjs.map +0 -1
- package/dist/chunk-BUOWM3LC.cjs.map +0 -1
- package/dist/chunk-JQK4IGXJ.js.map +0 -1
- package/dist/chunk-KXYSO6GC.cjs.map +0 -1
- package/dist/chunk-MUKIGLR5.js.map +0 -1
- package/dist/chunk-SDMQRSRW.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentRegistryVersion, isDimensionObject, isIsometricObject, sflToCanvasState, registerComponentDescriptor, isBuiltInComponentType, getComponentDescriptor, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, DEFAULT_FONT, isGenericComponent, cleanFootprint, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, personLabelArea, wrapText, heuristicRichMeasure, shadeFill, extrudeFootprint, isometricFaces, roundedPolygonPath, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricBounds, AXIS_SIN, deriveFaceFills, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, isometricTopFaceCenter, 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, resolveRollingNumberStyle, formatRollingNumber } from './chunk-
|
|
1
|
+
import { componentRegistryVersion, isDimensionObject, isIsometricObject, sflToCanvasState, registerComponentDescriptor, isBuiltInComponentType, getComponentDescriptor, tag, EMPTY_BOUNDS, DOM_CONTRACT_VERSION, edgePointToward, elementCenter, VISIBLE_ISOMETRIC_FACES, isometricFaceCenter, finite, freeformPathData, rotatedBounds, DEFAULT_FONT, isGenericComponent, cleanFootprint, pointAtNormalizedPort, boxBounds, cornersRoundedRectPath, calculateLinkRoute, labelGapDash, getLineMidpoint, personLabelArea, wrapText, heuristicRichMeasure, shadeFill, extrudeFootprint, isometricFaces, roundedPolygonPath, stackSequence, stackRank, topRoundedRectPath, rightRoundedRectPath, leftRoundedRectPath, bottomRoundedRectPath, isHorizontalBar, paint, CHART_TITLE_PROP, chartText, chartTicks, mapChartValue, roundedOrthogonalPathData, localShapePath, pillCornerRadius, isometricBounds, AXIS_SIN, deriveFaceFills, labelTilt, tiltedLabelRoom, resolveChartShadow, CHART_COLORS, angleForAxisValue, horizontalRows, rowTop, categoryProp, isometricTopFaceCenter, 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, labelBelowFrame, 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, labelAboveFrame, seriesValueColorProp, stackedSegment, errorBarRange, createVerticalErrorWhiskerNode, formatBarLabel, barLabelSize, CATEGORY_LABEL_ROW, BAR_LABEL, pillPath, resolveRollingNumberStyle, formatRollingNumber } from './chunk-GLZVHUSW.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-]*`;
|
|
@@ -240,6 +240,14 @@ function axesOf(p) {
|
|
|
240
240
|
axisLineStyle: p.axisLineStyle === "dashed" || p.axisLineStyle === "dotted" ? p.axisLineStyle : void 0,
|
|
241
241
|
tickLength: numOf(p.tickLength),
|
|
242
242
|
axisFontSize: numOf(p.axisFontSize),
|
|
243
|
+
axisLabelAngle: numOf(p.axisLabelAngle),
|
|
244
|
+
axisLabelSpace: numOf(p.axisLabelSpace),
|
|
245
|
+
rowLabelSide: p.rowLabelSide === "left" || p.rowLabelSide === "right" ? p.rowLabelSide : void 0,
|
|
246
|
+
columnLabelSide: p.columnLabelSide === "top" || p.columnLabelSide === "bottom" ? p.columnLabelSide : void 0,
|
|
247
|
+
legendSide: p.legendSide === "top" || p.legendSide === "bottom" || p.legendSide === "left" || p.legendSide === "right" ? p.legendSide : void 0,
|
|
248
|
+
xLabelGap: numOf(p.xLabelGap),
|
|
249
|
+
yLabelGap: numOf(p.yLabelGap),
|
|
250
|
+
axisLabelAlign: p.axisLabelAlign === "left" || p.axisLabelAlign === "center" || p.axisLabelAlign === "right" ? p.axisLabelAlign : void 0,
|
|
243
251
|
axisFontFamily: p.axisFontFamily,
|
|
244
252
|
showValueAxis: p.showValueAxis !== "false",
|
|
245
253
|
categoryAlign: p.categoryAlign === "left" || p.categoryAlign === "inside" ? p.categoryAlign : void 0,
|
|
@@ -250,6 +258,7 @@ function textOf(p) {
|
|
|
250
258
|
return {
|
|
251
259
|
textColor: p.textColor ?? "#0f172a",
|
|
252
260
|
titleSize: numOf(p.titleSize),
|
|
261
|
+
titleAlign: p.titleAlign === "left" || p.titleAlign === "center" || p.titleAlign === "right" ? p.titleAlign : void 0,
|
|
253
262
|
titleWeight: p.titleWeight === "normal" ? "normal" : void 0,
|
|
254
263
|
titleColor: p.titleColor,
|
|
255
264
|
fontSize: numOf(p.fontSize) ?? 12,
|
|
@@ -259,6 +268,7 @@ function textOf(p) {
|
|
|
259
268
|
function legendOf(p) {
|
|
260
269
|
return {
|
|
261
270
|
legendColor: p.legendColor,
|
|
271
|
+
legendGap: numOf(p.legendGap),
|
|
262
272
|
showLegend: p.showLegend === "true",
|
|
263
273
|
legendPosition: legendPositionOf(p.legendPosition)
|
|
264
274
|
};
|
|
@@ -3538,7 +3548,13 @@ function renderShapeGeometry(context) {
|
|
|
3538
3548
|
}
|
|
3539
3549
|
|
|
3540
3550
|
// src/renderScene/artifacts/shape/shaderSurface.ts
|
|
3541
|
-
var RECT_PROGRAMS = /* @__PURE__ */ new Set([
|
|
3551
|
+
var RECT_PROGRAMS = /* @__PURE__ */ new Set([
|
|
3552
|
+
"reactivePanel",
|
|
3553
|
+
"ledMatrix",
|
|
3554
|
+
"lightBand",
|
|
3555
|
+
"silkFolds",
|
|
3556
|
+
"glowCard"
|
|
3557
|
+
]);
|
|
3542
3558
|
function shaderMask(context) {
|
|
3543
3559
|
if (context.shape.shapeType === "circle" || context.shape.shapeType === "oval") {
|
|
3544
3560
|
return "ellipse";
|
|
@@ -4057,6 +4073,12 @@ function hasCartesianDecorations(chart) {
|
|
|
4057
4073
|
function tickOffset(chart) {
|
|
4058
4074
|
return hasCartesianDecorations(chart) ? Math.max(0, finite(chart.tickLength, 0)) : 0;
|
|
4059
4075
|
}
|
|
4076
|
+
function xLabelOffset(chart) {
|
|
4077
|
+
return tickOffset(chart) + (hasCartesianDecorations(chart) ? Math.max(0, finite(chart.xLabelGap, 0)) : 0);
|
|
4078
|
+
}
|
|
4079
|
+
function yLabelOffset(chart) {
|
|
4080
|
+
return tickOffset(chart) + (hasCartesianDecorations(chart) ? Math.max(0, finite(chart.yLabelGap, 0)) : 0);
|
|
4081
|
+
}
|
|
4060
4082
|
function isHorizontalBoxplot(chart) {
|
|
4061
4083
|
return chart.chartType === "boxplot" && chart.config?.orientation === "horizontal";
|
|
4062
4084
|
}
|
|
@@ -4078,6 +4100,9 @@ function barCategoryLabelWidth(chart) {
|
|
|
4078
4100
|
return Math.max(0, ...categories.map((category) => category.length)) * fontSize * 0.58 + 16;
|
|
4079
4101
|
}
|
|
4080
4102
|
function leftLabelWidth(chart) {
|
|
4103
|
+
if (chart.axisLabelSpace && chart.axisLabelSpace > 0 && (isHorizontalBoxplot(chart) || isHorizontalBar(chart))) {
|
|
4104
|
+
return chart.axisLabelSpace;
|
|
4105
|
+
}
|
|
4081
4106
|
if (isHorizontalBoxplot(chart)) {
|
|
4082
4107
|
return boxplotCategoryLabelWidth(chart);
|
|
4083
4108
|
}
|
|
@@ -4089,6 +4114,14 @@ function leftLabelWidth(chart) {
|
|
|
4089
4114
|
}
|
|
4090
4115
|
return chart.axisY.label ? 60 : 46;
|
|
4091
4116
|
}
|
|
4117
|
+
function tiltedBottomRoom(chart) {
|
|
4118
|
+
const tilt = labelTilt(chart);
|
|
4119
|
+
if (tilt <= 0) {
|
|
4120
|
+
return 0;
|
|
4121
|
+
}
|
|
4122
|
+
const labels = chart.chartType === "bar" && !isHorizontalBar(chart) ? chart.config?.categories ?? [] : chart.chartType === "boxplot" && !isHorizontalBoxplot(chart) ? chart.series.map((series) => series.label || series.id) : [];
|
|
4123
|
+
return labels.length > 0 ? Math.max(0, tiltedLabelRoom(chart, labels, tilt) - 18) : 0;
|
|
4124
|
+
}
|
|
4092
4125
|
function decorations(chart) {
|
|
4093
4126
|
const showLabels = chart.showAxisLabels !== false;
|
|
4094
4127
|
const showLegend = chart.showLegend !== false;
|
|
@@ -4098,15 +4131,16 @@ function decorations(chart) {
|
|
|
4098
4131
|
const legendStacked = hasLegendItems && isStackedLegendPosition(legendPosition);
|
|
4099
4132
|
const sideColumnWidth = legendStacked ? stackedLegendColumnWidth(chart) + LEGEND_COLUMN_GAP : 0;
|
|
4100
4133
|
const treemapSide = treemapSideLegendSide(chart, showLegend);
|
|
4101
|
-
const
|
|
4102
|
-
const
|
|
4134
|
+
const tickX = xLabelOffset(chart);
|
|
4135
|
+
const tickY = yLabelOffset(chart);
|
|
4136
|
+
const padLeft = tickY + (showLabels ? leftLabelWidth(chart) : 12) + (legendPosition === "bottomLeft" ? sideColumnWidth : 0) + (treemapSide === "left" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
|
|
4103
4137
|
const padRight = 24 + (legendPosition === "bottomRight" ? sideColumnWidth : 0) + (treemapSide === "right" ? TREEMAP_SIDE_LEGEND_WIDTH : 0);
|
|
4104
4138
|
const valueRow = chart.chartType === "bar" && chart.config?.showBarLabels === true && chart.config.barLabelPosition === "axis";
|
|
4105
4139
|
const horizontalValueAxis = isHorizontalBar(chart) && chart.showValueAxis !== false;
|
|
4106
4140
|
const basePadBottom = showLabels ? isHorizontalBar(chart) ? horizontalValueAxis ? 34 : 12 : (chart.axisX.label ? 52 : 34) + (valueRow ? 18 : 0) : 12;
|
|
4107
4141
|
const hasColorBar = chart.chartType === "field" && showLegend && Boolean(chart.config?.scale?.stops.length);
|
|
4108
4142
|
const legendAtBottomRow = hasLegendItems && !legendAtTop && !legendStacked;
|
|
4109
|
-
const padBottom =
|
|
4143
|
+
const padBottom = tickX + basePadBottom + (showLabels ? tiltedBottomRoom(chart) : 0) + (hasColorBar ? 44 : 0) + (legendAtBottomRow ? 16 + LEGEND_ROW_HEIGHT : 0);
|
|
4110
4144
|
const titleHeight = chart.title ? Math.max(44, 20 + finite(chart.titleSize, 14) * 1.6) : 0;
|
|
4111
4145
|
const padTop = titleHeight || (legendAtTop && hasLegendItems ? 44 : 24);
|
|
4112
4146
|
return {
|
|
@@ -4138,6 +4172,7 @@ function buildCategoricalXAxisTicks(chart, layout, order) {
|
|
|
4138
4172
|
const slotWidth = layout.plot.width / count;
|
|
4139
4173
|
const labels = categoryLabels(chart, count);
|
|
4140
4174
|
const editable = Boolean(chart.config?.categories?.length);
|
|
4175
|
+
const tilt = labelTilt(chart);
|
|
4141
4176
|
const left = chart.categoryAlign === "left";
|
|
4142
4177
|
const groupGap = left ? Math.min(
|
|
4143
4178
|
Math.max(0, finite(chart.config?.barGroupGap, 8)),
|
|
@@ -4145,6 +4180,27 @@ function buildCategoricalXAxisTicks(chart, layout, order) {
|
|
|
4145
4180
|
) : 0;
|
|
4146
4181
|
return Array.from({ length: count }, (_value, index) => {
|
|
4147
4182
|
const centerX = layout.plot.x + (index + 0.5) * slotWidth;
|
|
4183
|
+
if (tilt > 0) {
|
|
4184
|
+
const text = labels[index] ?? String(index + 1);
|
|
4185
|
+
const { frame, rotation } = labelBelowFrame(chart, text, tilt, {
|
|
4186
|
+
x: centerX,
|
|
4187
|
+
y: layout.plot.y + layout.plot.height + 4 + xLabelOffset(chart)
|
|
4188
|
+
});
|
|
4189
|
+
return {
|
|
4190
|
+
...chartText({
|
|
4191
|
+
role: "axis",
|
|
4192
|
+
id: `chart-x-tick-${chart.id}-${index}`,
|
|
4193
|
+
order: order + index,
|
|
4194
|
+
bounds: layout.bounds,
|
|
4195
|
+
frame,
|
|
4196
|
+
text,
|
|
4197
|
+
chart,
|
|
4198
|
+
align: "right",
|
|
4199
|
+
rotation
|
|
4200
|
+
}),
|
|
4201
|
+
prop: editable ? categoryProp(index) : void 0
|
|
4202
|
+
};
|
|
4203
|
+
}
|
|
4148
4204
|
return {
|
|
4149
4205
|
...chartText({
|
|
4150
4206
|
role: "axis",
|
|
@@ -4153,7 +4209,7 @@ function buildCategoricalXAxisTicks(chart, layout, order) {
|
|
|
4153
4209
|
bounds: layout.bounds,
|
|
4154
4210
|
frame: {
|
|
4155
4211
|
x: left ? layout.plot.x + index * slotWidth + groupGap / 2 : centerX - slotWidth / 2,
|
|
4156
|
-
y: layout.plot.y + layout.plot.height + 4 +
|
|
4212
|
+
y: layout.plot.y + layout.plot.height + 4 + xLabelOffset(chart),
|
|
4157
4213
|
width: left ? slotWidth - groupGap : slotWidth,
|
|
4158
4214
|
height: 18
|
|
4159
4215
|
},
|
|
@@ -4168,8 +4224,30 @@ function buildCategoricalXAxisTicks(chart, layout, order) {
|
|
|
4168
4224
|
function buildSeriesXAxisTicks(chart, layout, order) {
|
|
4169
4225
|
const count = Math.max(1, chart.series.length);
|
|
4170
4226
|
const slotWidth = layout.plot.width / count;
|
|
4227
|
+
const tilt = labelTilt(chart);
|
|
4171
4228
|
return chart.series.map((series, index) => {
|
|
4172
4229
|
const centerX = layout.plot.x + (index + 0.5) * slotWidth;
|
|
4230
|
+
if (tilt > 0) {
|
|
4231
|
+
const text = series.label || series.id;
|
|
4232
|
+
const { frame, rotation } = labelBelowFrame(chart, text, tilt, {
|
|
4233
|
+
x: centerX,
|
|
4234
|
+
y: layout.plot.y + layout.plot.height + 4 + xLabelOffset(chart)
|
|
4235
|
+
});
|
|
4236
|
+
return {
|
|
4237
|
+
...chartText({
|
|
4238
|
+
role: "axis",
|
|
4239
|
+
id: `chart-x-tick-${chart.id}-${index}`,
|
|
4240
|
+
order: order + index,
|
|
4241
|
+
bounds: layout.bounds,
|
|
4242
|
+
frame,
|
|
4243
|
+
text,
|
|
4244
|
+
chart,
|
|
4245
|
+
align: "right",
|
|
4246
|
+
rotation
|
|
4247
|
+
}),
|
|
4248
|
+
prop: seriesLabelProp(series.id)
|
|
4249
|
+
};
|
|
4250
|
+
}
|
|
4173
4251
|
return {
|
|
4174
4252
|
...chartText({
|
|
4175
4253
|
role: "axis",
|
|
@@ -4178,7 +4256,7 @@ function buildSeriesXAxisTicks(chart, layout, order) {
|
|
|
4178
4256
|
bounds: layout.bounds,
|
|
4179
4257
|
frame: {
|
|
4180
4258
|
x: centerX - slotWidth / 2,
|
|
4181
|
-
y: layout.plot.y + layout.plot.height + 4 +
|
|
4259
|
+
y: layout.plot.y + layout.plot.height + 4 + xLabelOffset(chart),
|
|
4182
4260
|
width: slotWidth,
|
|
4183
4261
|
height: 18
|
|
4184
4262
|
},
|
|
@@ -4200,7 +4278,7 @@ function buildNumericXAxisTicks(chart, layout, order) {
|
|
|
4200
4278
|
id: `chart-x-tick-${chart.id}-${tick}`,
|
|
4201
4279
|
order: order + index,
|
|
4202
4280
|
bounds: layout.bounds,
|
|
4203
|
-
frame: { x: x - 20, y: layout.plot.y + layout.plot.height + 10 +
|
|
4281
|
+
frame: { x: x - 20, y: layout.plot.y + layout.plot.height + 10 + xLabelOffset(chart), width: 40, height: 18 },
|
|
4204
4282
|
text: String(tick),
|
|
4205
4283
|
chart,
|
|
4206
4284
|
align: "center"
|
|
@@ -4217,7 +4295,7 @@ function buildNumericYAxisTicks(chart, layout, order) {
|
|
|
4217
4295
|
id: `chart-y-tick-${chart.id}-${tick}`,
|
|
4218
4296
|
order: order + index,
|
|
4219
4297
|
bounds: layout.bounds,
|
|
4220
|
-
frame: { x: chart.x, y: y - 6, width: layout.padLeft - 14 -
|
|
4298
|
+
frame: { x: chart.x, y: y - 6, width: layout.padLeft - 14 - yLabelOffset(chart), height: 18 },
|
|
4221
4299
|
text: String(tick),
|
|
4222
4300
|
chart,
|
|
4223
4301
|
align: "right"
|
|
@@ -6291,92 +6369,74 @@ function createCellValueLabel(context, layout, cell) {
|
|
|
6291
6369
|
};
|
|
6292
6370
|
}
|
|
6293
6371
|
|
|
6294
|
-
// src/renderScene/charts/renderers/heatmap/headers.ts
|
|
6295
|
-
function renderHeatmapHeaders(context, layout) {
|
|
6296
|
-
return [...renderRowHeaders(context, layout), ...renderColumnHeaders(context, layout)];
|
|
6297
|
-
}
|
|
6298
|
-
function renderRowHeaders(context, layout) {
|
|
6299
|
-
if (layout.reservedSpace.rowHeaders <= 0) {
|
|
6300
|
-
return [];
|
|
6301
|
-
}
|
|
6302
|
-
return layout.rows.map((series, rowIndex) => createRowHeader(context, layout, series, rowIndex));
|
|
6303
|
-
}
|
|
6304
|
-
function createRowHeader(context, layout, series, rowIndex) {
|
|
6305
|
-
const { chart, plot, bounds, nextOrder } = context;
|
|
6306
|
-
return chartText({
|
|
6307
|
-
id: `chart-heatmap-row-${chart.id}-${series.id}`,
|
|
6308
|
-
order: nextOrder(),
|
|
6309
|
-
bounds,
|
|
6310
|
-
frame: {
|
|
6311
|
-
x: plot.x,
|
|
6312
|
-
y: layout.grid.y + rowIndex * layout.grid.cellHeight + layout.grid.cellHeight / 2 - layout.fontSize / 2,
|
|
6313
|
-
width: layout.reservedSpace.rowHeaders - 8,
|
|
6314
|
-
height: layout.fontSize + 2
|
|
6315
|
-
},
|
|
6316
|
-
text: series.label,
|
|
6317
|
-
chart
|
|
6318
|
-
});
|
|
6319
|
-
}
|
|
6320
|
-
function renderColumnHeaders(context, layout) {
|
|
6321
|
-
if (layout.reservedSpace.columnHeaders <= 0) {
|
|
6322
|
-
return [];
|
|
6323
|
-
}
|
|
6324
|
-
return layout.columns.map((label, columnIndex) => createColumnHeader(context, layout, label, columnIndex));
|
|
6325
|
-
}
|
|
6326
|
-
function createColumnHeader(context, layout, label, columnIndex) {
|
|
6327
|
-
const { chart, plot, bounds, nextOrder } = context;
|
|
6328
|
-
return chartText({
|
|
6329
|
-
id: `chart-heatmap-col-${chart.id}-${columnIndex}`,
|
|
6330
|
-
order: nextOrder(),
|
|
6331
|
-
bounds,
|
|
6332
|
-
frame: {
|
|
6333
|
-
x: layout.grid.x + columnIndex * layout.grid.cellWidth,
|
|
6334
|
-
y: plot.y,
|
|
6335
|
-
width: layout.grid.cellWidth,
|
|
6336
|
-
height: layout.fontSize + 2
|
|
6337
|
-
},
|
|
6338
|
-
text: label,
|
|
6339
|
-
chart,
|
|
6340
|
-
align: "center"
|
|
6341
|
-
});
|
|
6342
|
-
}
|
|
6343
|
-
|
|
6344
6372
|
// src/renderScene/charts/renderers/heatmap/layout.ts
|
|
6345
6373
|
function createHeatmapLayout(context) {
|
|
6346
6374
|
const { chart } = context;
|
|
6347
6375
|
const columns = heatmapColumns(context);
|
|
6348
|
-
const
|
|
6376
|
+
const sides = heatmapSides(context);
|
|
6377
|
+
const reservedSpace = heatmapReservedSpace(context, sides);
|
|
6349
6378
|
return {
|
|
6350
6379
|
rows: chart.series,
|
|
6351
6380
|
columns,
|
|
6352
6381
|
bands: axisBands(chart.axisY),
|
|
6353
6382
|
zones: chart.config?.zones?.length ? chart.config.zones : DEFAULT_HEATMAP_ZONES,
|
|
6354
6383
|
fontSize: Math.max(9, finite(chart.fontSize, 12)),
|
|
6384
|
+
headerFontSize: headerFontSize(chart),
|
|
6385
|
+
legendGap: legendGap(chart),
|
|
6386
|
+
sides,
|
|
6355
6387
|
reservedSpace,
|
|
6356
|
-
grid: createHeatmapGrid(context, reservedSpace, columns.length)
|
|
6388
|
+
grid: createHeatmapGrid(context, reservedSpace, sides, columns.length)
|
|
6389
|
+
};
|
|
6390
|
+
}
|
|
6391
|
+
var headerFontSize = (chart) => Math.max(9, finite(chart.axisFontSize ?? chart.fontSize, 12));
|
|
6392
|
+
var rowGap = (chart) => Math.min(120, Math.max(0, finite(chart.yLabelGap, 6)));
|
|
6393
|
+
var columnGap = (chart) => Math.min(120, Math.max(0, finite(chart.xLabelGap, 4)));
|
|
6394
|
+
var legendGap = (chart) => Math.min(80, Math.max(0, finite(chart.legendGap, 6)));
|
|
6395
|
+
function heatmapSides(context) {
|
|
6396
|
+
const { chart } = context;
|
|
6397
|
+
return {
|
|
6398
|
+
rows: chart.rowLabelSide === "right" ? "right" : "left",
|
|
6399
|
+
columns: chart.columnLabelSide === "bottom" ? "bottom" : "top",
|
|
6400
|
+
legend: chart.legendSide ?? "bottom"
|
|
6357
6401
|
};
|
|
6358
6402
|
}
|
|
6359
6403
|
function heatmapColumns(context) {
|
|
6360
6404
|
const { chart } = context;
|
|
6361
6405
|
return chart.config?.categories?.length ? chart.config.categories : chart.series[0]?.values?.map((_, index) => String(index + 1)) ?? [];
|
|
6362
6406
|
}
|
|
6363
|
-
|
|
6407
|
+
var LEGEND_ACROSS = 32;
|
|
6408
|
+
var LEGEND_BESIDE = 56;
|
|
6409
|
+
function heatmapReservedSpace(context, sides) {
|
|
6364
6410
|
const { chart } = context;
|
|
6365
|
-
const fontSize =
|
|
6411
|
+
const fontSize = headerFontSize(chart);
|
|
6366
6412
|
const longestLabel = chart.series.reduce(
|
|
6367
6413
|
(max, series) => Math.max(max, estimateTextWidth(series.label ?? "", fontSize, false)),
|
|
6368
6414
|
0
|
|
6369
6415
|
);
|
|
6416
|
+
const vertical = sides.legend === "left" || sides.legend === "right";
|
|
6370
6417
|
return {
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6418
|
+
// The names get the room they ask for, or as much as the longest needs. They never take more than most of the plot.
|
|
6419
|
+
rowHeaders: context.showLabels ? Math.min(
|
|
6420
|
+
context.plot.width * 0.7,
|
|
6421
|
+
chart.axisLabelSpace && chart.axisLabelSpace > 0 ? chart.axisLabelSpace : longestLabel + 6 + rowGap(chart)
|
|
6422
|
+
) : 0,
|
|
6423
|
+
columnHeaders: context.showLabels ? columnHeaderRoom(context) : 0,
|
|
6424
|
+
legend: context.showLegend ? (vertical ? LEGEND_BESIDE : LEGEND_ACROSS) + legendGap(chart) : 0
|
|
6374
6425
|
};
|
|
6375
6426
|
}
|
|
6376
|
-
function
|
|
6427
|
+
function columnHeaderRoom(context) {
|
|
6377
6428
|
const { chart } = context;
|
|
6378
|
-
const
|
|
6379
|
-
|
|
6429
|
+
const tilt = labelTilt(chart);
|
|
6430
|
+
return tilt > 0 ? Math.min(context.plot.height * 0.4, tiltedLabelRoom(chart, heatmapColumns(context), tilt) + columnGap(chart) + 4) : headerFontSize(chart) + 2 + columnGap(chart) + 6;
|
|
6431
|
+
}
|
|
6432
|
+
function createHeatmapGrid(context, reservedSpace, sides, columnCount) {
|
|
6433
|
+
const { chart } = context;
|
|
6434
|
+
const left = (sides.rows === "left" ? reservedSpace.rowHeaders : 0) + (sides.legend === "left" ? reservedSpace.legend : 0);
|
|
6435
|
+
const right = (sides.rows === "right" ? reservedSpace.rowHeaders : 0) + (sides.legend === "right" ? reservedSpace.legend : 0);
|
|
6436
|
+
const top = (sides.columns === "top" ? reservedSpace.columnHeaders : 0) + (sides.legend === "top" ? reservedSpace.legend : 0);
|
|
6437
|
+
const bottom = (sides.columns === "bottom" ? reservedSpace.columnHeaders : 0) + (sides.legend === "bottom" ? reservedSpace.legend : 0);
|
|
6438
|
+
const width = Math.max(1, context.plot.width - left - right);
|
|
6439
|
+
const height = Math.max(1, context.plot.height - top - bottom);
|
|
6380
6440
|
const rowCount = chart.series.length;
|
|
6381
6441
|
const cellGap = Math.max(0, finite(chart.config?.cellGap, 0));
|
|
6382
6442
|
let cellWidth = columnCount ? width / columnCount : width;
|
|
@@ -6391,8 +6451,8 @@ function createHeatmapGrid(context, reservedSpace, columnCount) {
|
|
|
6391
6451
|
gridHeight = cellSize * rowCount;
|
|
6392
6452
|
}
|
|
6393
6453
|
return {
|
|
6394
|
-
x: context.plot.x +
|
|
6395
|
-
y: context.plot.y +
|
|
6454
|
+
x: context.plot.x + left,
|
|
6455
|
+
y: context.plot.y + top,
|
|
6396
6456
|
width: gridWidth,
|
|
6397
6457
|
height: gridHeight,
|
|
6398
6458
|
cellWidth,
|
|
@@ -6402,30 +6462,151 @@ function createHeatmapGrid(context, reservedSpace, columnCount) {
|
|
|
6402
6462
|
};
|
|
6403
6463
|
}
|
|
6404
6464
|
|
|
6465
|
+
// src/renderScene/charts/renderers/heatmap/headers.ts
|
|
6466
|
+
function renderHeatmapHeaders(context, layout) {
|
|
6467
|
+
return [...renderRowHeaders(context, layout), ...renderColumnHeaders(context, layout)];
|
|
6468
|
+
}
|
|
6469
|
+
function renderRowHeaders(context, layout) {
|
|
6470
|
+
if (layout.reservedSpace.rowHeaders <= 0) {
|
|
6471
|
+
return [];
|
|
6472
|
+
}
|
|
6473
|
+
return layout.rows.map((series, rowIndex) => createRowHeader(context, layout, series, rowIndex));
|
|
6474
|
+
}
|
|
6475
|
+
function createRowHeader(context, layout, series, rowIndex) {
|
|
6476
|
+
const { chart, bounds, nextOrder } = context;
|
|
6477
|
+
const room = layout.reservedSpace.rowHeaders;
|
|
6478
|
+
const gap = rowGap(chart);
|
|
6479
|
+
const x = layout.sides.rows === "left" ? layout.grid.x - room : layout.grid.x + layout.grid.width + gap;
|
|
6480
|
+
return chartText({
|
|
6481
|
+
id: `chart-heatmap-row-${chart.id}-${series.id}`,
|
|
6482
|
+
order: nextOrder(),
|
|
6483
|
+
bounds,
|
|
6484
|
+
frame: {
|
|
6485
|
+
x,
|
|
6486
|
+
y: layout.grid.y + rowIndex * layout.grid.cellHeight + layout.grid.cellHeight / 2 - layout.headerFontSize / 2,
|
|
6487
|
+
width: Math.max(1, room - gap),
|
|
6488
|
+
height: layout.headerFontSize + 2
|
|
6489
|
+
},
|
|
6490
|
+
text: series.label,
|
|
6491
|
+
chart,
|
|
6492
|
+
align: chart.axisLabelAlign ?? "left",
|
|
6493
|
+
role: "axis"
|
|
6494
|
+
});
|
|
6495
|
+
}
|
|
6496
|
+
function renderColumnHeaders(context, layout) {
|
|
6497
|
+
if (layout.reservedSpace.columnHeaders <= 0) {
|
|
6498
|
+
return [];
|
|
6499
|
+
}
|
|
6500
|
+
return layout.columns.map((label, columnIndex) => createColumnHeader(context, layout, label, columnIndex));
|
|
6501
|
+
}
|
|
6502
|
+
function createColumnHeader(context, layout, label, columnIndex) {
|
|
6503
|
+
const { chart, bounds, nextOrder } = context;
|
|
6504
|
+
const above = layout.sides.columns === "top";
|
|
6505
|
+
const centerX = layout.grid.x + (columnIndex + 0.5) * layout.grid.cellWidth;
|
|
6506
|
+
const tilt = labelTilt(chart);
|
|
6507
|
+
const gap = columnGap(chart);
|
|
6508
|
+
const id = `chart-heatmap-col-${chart.id}-${columnIndex}`;
|
|
6509
|
+
if (tilt > 0) {
|
|
6510
|
+
const { frame, rotation } = above ? labelAboveFrame(chart, label, tilt, { x: centerX, y: layout.grid.y - gap }) : labelBelowFrame(chart, label, tilt, { x: centerX, y: layout.grid.y + layout.grid.height + gap });
|
|
6511
|
+
return chartText({
|
|
6512
|
+
id,
|
|
6513
|
+
order: nextOrder(),
|
|
6514
|
+
bounds,
|
|
6515
|
+
frame,
|
|
6516
|
+
text: label,
|
|
6517
|
+
chart,
|
|
6518
|
+
align: above ? "left" : "right",
|
|
6519
|
+
rotation,
|
|
6520
|
+
role: "axis"
|
|
6521
|
+
});
|
|
6522
|
+
}
|
|
6523
|
+
return chartText({
|
|
6524
|
+
id,
|
|
6525
|
+
order: nextOrder(),
|
|
6526
|
+
bounds,
|
|
6527
|
+
frame: {
|
|
6528
|
+
x: layout.grid.x + columnIndex * layout.grid.cellWidth,
|
|
6529
|
+
y: above ? layout.grid.y - gap - (layout.headerFontSize + 2) : layout.grid.y + layout.grid.height + gap,
|
|
6530
|
+
width: layout.grid.cellWidth,
|
|
6531
|
+
height: layout.headerFontSize + 2
|
|
6532
|
+
},
|
|
6533
|
+
text: label,
|
|
6534
|
+
chart,
|
|
6535
|
+
align: "center",
|
|
6536
|
+
role: "axis"
|
|
6537
|
+
});
|
|
6538
|
+
}
|
|
6539
|
+
|
|
6405
6540
|
// src/renderScene/charts/renderers/heatmap/legend.ts
|
|
6406
|
-
var
|
|
6407
|
-
var
|
|
6541
|
+
var BAR_THICKNESS = 10;
|
|
6542
|
+
var TICK_LENGTH2 = 4;
|
|
6408
6543
|
var ROW_GAP = 2;
|
|
6544
|
+
var LABEL_WIDTH = 48;
|
|
6545
|
+
function barPlace(layout) {
|
|
6546
|
+
const { grid, sides, reservedSpace, legendGap: legendGap2 } = layout;
|
|
6547
|
+
const rowRoom = reservedSpace.rowHeaders;
|
|
6548
|
+
const columnRoom = reservedSpace.columnHeaders;
|
|
6549
|
+
switch (sides.legend) {
|
|
6550
|
+
case "top": {
|
|
6551
|
+
const edge = grid.y - (sides.columns === "top" ? columnRoom : 0);
|
|
6552
|
+
return {
|
|
6553
|
+
x: grid.x,
|
|
6554
|
+
y: edge - legendGap2 - BAR_THICKNESS,
|
|
6555
|
+
width: grid.width,
|
|
6556
|
+
height: BAR_THICKNESS,
|
|
6557
|
+
vertical: false,
|
|
6558
|
+
numbers: "top"
|
|
6559
|
+
};
|
|
6560
|
+
}
|
|
6561
|
+
case "left": {
|
|
6562
|
+
const edge = grid.x - (sides.rows === "left" ? rowRoom : 0);
|
|
6563
|
+
return {
|
|
6564
|
+
x: edge - legendGap2 - BAR_THICKNESS,
|
|
6565
|
+
y: grid.y,
|
|
6566
|
+
width: BAR_THICKNESS,
|
|
6567
|
+
height: grid.height,
|
|
6568
|
+
vertical: true,
|
|
6569
|
+
numbers: "left"
|
|
6570
|
+
};
|
|
6571
|
+
}
|
|
6572
|
+
case "right": {
|
|
6573
|
+
const edge = grid.x + grid.width + (sides.rows === "right" ? rowRoom : 0);
|
|
6574
|
+
return {
|
|
6575
|
+
x: edge + legendGap2,
|
|
6576
|
+
y: grid.y,
|
|
6577
|
+
width: BAR_THICKNESS,
|
|
6578
|
+
height: grid.height,
|
|
6579
|
+
vertical: true,
|
|
6580
|
+
numbers: "right"
|
|
6581
|
+
};
|
|
6582
|
+
}
|
|
6583
|
+
default: {
|
|
6584
|
+
const edge = grid.y + grid.height + (sides.columns === "bottom" ? columnRoom : 0);
|
|
6585
|
+
return {
|
|
6586
|
+
x: grid.x,
|
|
6587
|
+
y: edge + legendGap2,
|
|
6588
|
+
width: grid.width,
|
|
6589
|
+
height: BAR_THICKNESS,
|
|
6590
|
+
vertical: false,
|
|
6591
|
+
numbers: "bottom"
|
|
6592
|
+
};
|
|
6593
|
+
}
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6409
6596
|
function renderHeatmapLegend(context, layout) {
|
|
6410
6597
|
if (layout.reservedSpace.legend <= 0 || layout.zones.length === 0) {
|
|
6411
6598
|
return [];
|
|
6412
6599
|
}
|
|
6413
|
-
const
|
|
6414
|
-
const
|
|
6415
|
-
|
|
6416
|
-
const barY = layout.grid.y + layout.grid.height + 6;
|
|
6417
|
-
const barBounds = boxBounds({ x: barX, y: barY, width: barWidth, height: BAR_HEIGHT });
|
|
6418
|
-
return [
|
|
6419
|
-
createGradientBar(context, layout, barX, barY, barWidth, barBounds),
|
|
6420
|
-
...createBoundaryTicks(context, layout, barX, barY, barWidth, labelHeight)
|
|
6421
|
-
];
|
|
6600
|
+
const place = barPlace(layout);
|
|
6601
|
+
const barBounds = boxBounds({ x: place.x, y: place.y, width: place.width, height: place.height });
|
|
6602
|
+
return [createGradientBar(context, layout, place, barBounds), ...createBoundaryTicks(context, layout, place)];
|
|
6422
6603
|
}
|
|
6423
6604
|
function bandRatio(layout, value) {
|
|
6424
6605
|
const first = layout.bands[0];
|
|
6425
6606
|
const last = layout.bands[layout.bands.length - 1];
|
|
6426
6607
|
return last === first ? 0 : (value - first) / (last - first);
|
|
6427
6608
|
}
|
|
6428
|
-
function createGradientBar(context, layout,
|
|
6609
|
+
function createGradientBar(context, layout, place, barBounds) {
|
|
6429
6610
|
const { chart, nextOrder } = context;
|
|
6430
6611
|
const bandCount = Math.max(0, layout.bands.length - 1);
|
|
6431
6612
|
const zones = layout.zones.slice(0, bandCount);
|
|
@@ -6438,53 +6619,77 @@ function createGradientBar(context, layout, barX, barY, barWidth, barBounds) {
|
|
|
6438
6619
|
id: `chart-heatmap-legend-bar-${chart.id}`,
|
|
6439
6620
|
order: nextOrder(),
|
|
6440
6621
|
bounds: barBounds,
|
|
6441
|
-
x:
|
|
6442
|
-
y:
|
|
6443
|
-
width:
|
|
6444
|
-
height:
|
|
6622
|
+
x: place.x,
|
|
6623
|
+
y: place.y,
|
|
6624
|
+
width: place.width,
|
|
6625
|
+
height: place.height,
|
|
6445
6626
|
rx: 3,
|
|
6446
6627
|
zoneGradient: { axis: "y", min: chart.axisY.min, max: chart.axisY.max },
|
|
6447
6628
|
style: {
|
|
6448
|
-
|
|
6629
|
+
// Across the grid it runs from the lowest value on the left; beside it from the lowest at the bottom.
|
|
6630
|
+
fill: stops.length ? { kind: "linear-gradient", angle: place.vertical ? 270 : 0, stops } : { kind: "solid", color: DEFAULT_ZONE_FILL },
|
|
6449
6631
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
6450
6632
|
strokeWidth: 1
|
|
6451
6633
|
}
|
|
6452
6634
|
};
|
|
6453
6635
|
}
|
|
6454
|
-
function createBoundaryTicks(context, layout,
|
|
6636
|
+
function createBoundaryTicks(context, layout, place) {
|
|
6455
6637
|
const { chart, bounds, nextOrder } = context;
|
|
6456
|
-
const
|
|
6457
|
-
const
|
|
6638
|
+
const labelHeight = layout.fontSize + 2;
|
|
6639
|
+
const lastIndex = layout.bands.length - 1;
|
|
6458
6640
|
return layout.bands.flatMap((value, index) => {
|
|
6459
|
-
const
|
|
6641
|
+
const ratio = bandRatio(layout, value);
|
|
6642
|
+
const at = place.vertical ? place.y + place.height - ratio * place.height : place.x + ratio * place.width;
|
|
6643
|
+
const tickPath = tickPathAt(place, at);
|
|
6460
6644
|
const tick = {
|
|
6461
6645
|
type: "path",
|
|
6462
6646
|
id: `chart-heatmap-legend-tick-${chart.id}-${index}`,
|
|
6463
6647
|
order: nextOrder(),
|
|
6464
6648
|
bounds,
|
|
6465
|
-
d:
|
|
6649
|
+
d: tickPath,
|
|
6466
6650
|
style: {
|
|
6467
6651
|
fill: { kind: "none" },
|
|
6468
6652
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
6469
6653
|
strokeWidth: 1
|
|
6470
6654
|
}
|
|
6471
6655
|
};
|
|
6472
|
-
const isFirst = index === 0;
|
|
6473
|
-
const isLast = index === layout.bands.length - 1;
|
|
6474
|
-
const align = isFirst ? "left" : isLast ? "right" : "center";
|
|
6475
|
-
const frameX = isFirst ? x : isLast ? x - labelWidth : x - labelWidth / 2;
|
|
6476
6656
|
const label = chartText({
|
|
6477
6657
|
id: `chart-heatmap-legend-tick-label-${chart.id}-${index}`,
|
|
6478
6658
|
order: nextOrder(),
|
|
6479
6659
|
bounds,
|
|
6480
|
-
|
|
6660
|
+
...labelAt(place, at, index === 0, index === lastIndex, labelHeight),
|
|
6481
6661
|
text: formatFieldValue(value),
|
|
6482
|
-
chart
|
|
6483
|
-
align
|
|
6662
|
+
chart
|
|
6484
6663
|
});
|
|
6485
6664
|
return [tick, label];
|
|
6486
6665
|
});
|
|
6487
6666
|
}
|
|
6667
|
+
function tickPathAt(place, at) {
|
|
6668
|
+
if (place.vertical) {
|
|
6669
|
+
const from2 = place.numbers === "right" ? place.x + place.width : place.x;
|
|
6670
|
+
const to2 = place.numbers === "right" ? from2 + TICK_LENGTH2 : from2 - TICK_LENGTH2;
|
|
6671
|
+
return `M ${from2} ${at} L ${to2} ${at}`;
|
|
6672
|
+
}
|
|
6673
|
+
const from = place.numbers === "bottom" ? place.y + place.height : place.y;
|
|
6674
|
+
const to = place.numbers === "bottom" ? from + TICK_LENGTH2 : from - TICK_LENGTH2;
|
|
6675
|
+
return `M ${at} ${from} L ${at} ${to}`;
|
|
6676
|
+
}
|
|
6677
|
+
function labelAt(place, at, first, last, labelHeight) {
|
|
6678
|
+
if (place.vertical) {
|
|
6679
|
+
const onRight = place.numbers === "right";
|
|
6680
|
+
const x2 = onRight ? place.x + place.width + TICK_LENGTH2 + ROW_GAP : place.x - TICK_LENGTH2 - ROW_GAP - LABEL_WIDTH;
|
|
6681
|
+
return {
|
|
6682
|
+
frame: { x: x2, y: at - labelHeight / 2, width: LABEL_WIDTH, height: labelHeight },
|
|
6683
|
+
align: onRight ? "left" : "right"
|
|
6684
|
+
};
|
|
6685
|
+
}
|
|
6686
|
+
const y = place.numbers === "bottom" ? place.y + place.height + TICK_LENGTH2 + ROW_GAP : place.y - TICK_LENGTH2 - ROW_GAP - labelHeight;
|
|
6687
|
+
const x = first ? at : last ? at - LABEL_WIDTH : at - LABEL_WIDTH / 2;
|
|
6688
|
+
return {
|
|
6689
|
+
frame: { x, y, width: LABEL_WIDTH, height: labelHeight },
|
|
6690
|
+
align: first ? "left" : last ? "right" : "center"
|
|
6691
|
+
};
|
|
6692
|
+
}
|
|
6488
6693
|
|
|
6489
6694
|
// src/renderScene/charts/renderers/heatmap.ts
|
|
6490
6695
|
function renderHeatmap(context) {
|
|
@@ -7259,14 +7464,14 @@ function createMekkoLayout(context) {
|
|
|
7259
7464
|
const labelGutterWidth = context.showLabels ? 30 : 0;
|
|
7260
7465
|
const grid = createMekkoGrid(context, labelGutterWidth);
|
|
7261
7466
|
const fontSize = Math.max(9, finite(context.chart.fontSize, 12));
|
|
7262
|
-
const
|
|
7467
|
+
const columnGap2 = Math.max(0, finite(context.chart.config?.mekkoColumnGap, 4));
|
|
7263
7468
|
const smallFontSize = Math.max(8, fontSize - 1);
|
|
7264
7469
|
return {
|
|
7265
|
-
columns: createMekkoColumns(context, grid, labels,
|
|
7470
|
+
columns: createMekkoColumns(context, grid, labels, columnGap2),
|
|
7266
7471
|
fontSize,
|
|
7267
7472
|
smallFontSize,
|
|
7268
7473
|
labelGutterWidth,
|
|
7269
|
-
columnGap,
|
|
7474
|
+
columnGap: columnGap2,
|
|
7270
7475
|
labelSize: Math.max(6, finite(context.chart.config?.mekkoLabelSize, smallFontSize)),
|
|
7271
7476
|
valueSize: Math.max(6, finite(context.chart.config?.mekkoValueSize, smallFontSize)),
|
|
7272
7477
|
grid
|
|
@@ -7286,20 +7491,20 @@ function createMekkoGrid(context, labelGutterWidth) {
|
|
|
7286
7491
|
height: Math.max(1, context.plot.height - topGutter - bottomGutter)
|
|
7287
7492
|
};
|
|
7288
7493
|
}
|
|
7289
|
-
function createMekkoColumns(context, grid, labels,
|
|
7494
|
+
function createMekkoColumns(context, grid, labels, columnGap2) {
|
|
7290
7495
|
const totals = labels.map(
|
|
7291
7496
|
(_, columnIndex) => context.chart.series.reduce((sum, series) => sum + (series.values[columnIndex] ?? 0), 0)
|
|
7292
7497
|
);
|
|
7293
7498
|
const grandTotal = totals.reduce((sum, total) => sum + total, 0);
|
|
7294
7499
|
const maximumTotal = Math.max(1, ...totals);
|
|
7295
|
-
const availableWidth = Math.max(1, grid.width -
|
|
7500
|
+
const availableWidth = Math.max(1, grid.width - columnGap2 * Math.max(0, labels.length - 1));
|
|
7296
7501
|
let nextX = grid.x;
|
|
7297
7502
|
return labels.map((label, index) => {
|
|
7298
7503
|
const total = totals[index];
|
|
7299
7504
|
const width = grandTotal > 0 ? total / grandTotal * availableWidth : availableWidth / labels.length;
|
|
7300
7505
|
const height = context.chart.config?.mekkoVaryHeight ? grid.height * (total / maximumTotal) : grid.height;
|
|
7301
7506
|
const column = { label, total, x: nextX, y: grid.y + grid.height - height, width, height };
|
|
7302
|
-
nextX += width +
|
|
7507
|
+
nextX += width + columnGap2;
|
|
7303
7508
|
return column;
|
|
7304
7509
|
});
|
|
7305
7510
|
}
|
|
@@ -7666,7 +7871,7 @@ function renderPie(context) {
|
|
|
7666
7871
|
var TOP2 = -Math.PI / 2;
|
|
7667
7872
|
var TRACK_COLOR_FALLBACK = "#e2e8f0";
|
|
7668
7873
|
var MIN_LABEL_SWEEP = 14 * Math.PI / 180;
|
|
7669
|
-
var
|
|
7874
|
+
var LABEL_WIDTH2 = 80;
|
|
7670
7875
|
var LABEL_RADIUS_FRACTION = 0.62;
|
|
7671
7876
|
var OUTSIDE_GAP = 14;
|
|
7672
7877
|
var LEADER_INSET = 3;
|
|
@@ -7841,7 +8046,7 @@ function labelPlacement2(context, geometry, angles, series, fillColor) {
|
|
|
7841
8046
|
const hasManualOffset = labelOffsetX !== 0 || labelOffsetY !== 0;
|
|
7842
8047
|
const tooThin = ringThickness < lineHeight * 2 + 6;
|
|
7843
8048
|
const chordWidth = 2 * geometry.outerRadius * Math.sin(Math.abs(angles.end - angles.start) / 2);
|
|
7844
|
-
const fitsInline = !tooThin && chordWidth >=
|
|
8049
|
+
const fitsInline = !tooThin && chordWidth >= LABEL_WIDTH2;
|
|
7845
8050
|
const outsideLabels = context.chart.config?.polarOutsideLabels ?? false;
|
|
7846
8051
|
if (!fitsInline && !hasManualOffset && !outsideLabels) {
|
|
7847
8052
|
return void 0;
|
|
@@ -7864,7 +8069,7 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
7864
8069
|
const { point, color, outside, mid, tickStart } = placement;
|
|
7865
8070
|
const { nameSize, valueSize } = labelSizes(chart);
|
|
7866
8071
|
const lineHeight = Math.max(nameSize, valueSize) * 1.2;
|
|
7867
|
-
const tickEnd = outside ? clipSegmentToRect(tickStart, point,
|
|
8072
|
+
const tickEnd = outside ? clipSegmentToRect(tickStart, point, LABEL_WIDTH2 / 2, lineHeight) : tickStart;
|
|
7868
8073
|
const tick = {
|
|
7869
8074
|
type: "path",
|
|
7870
8075
|
id: `chart-polar-area-label-tick-${chart.id}-${series.id}`,
|
|
@@ -7884,8 +8089,8 @@ function createWedgeLabel(context, geometry, angles, series, value, fillColor) {
|
|
|
7884
8089
|
};
|
|
7885
8090
|
const base = {
|
|
7886
8091
|
bounds,
|
|
7887
|
-
x: point.x -
|
|
7888
|
-
width:
|
|
8092
|
+
x: point.x - LABEL_WIDTH2 / 2,
|
|
8093
|
+
width: LABEL_WIDTH2,
|
|
7889
8094
|
fontFamily: chart.fontFamily ?? DEFAULT_FONT,
|
|
7890
8095
|
align: "center",
|
|
7891
8096
|
verticalAlign: "middle",
|
|
@@ -8675,8 +8880,8 @@ function treemapLeafColor(leaf, layout) {
|
|
|
8675
8880
|
}
|
|
8676
8881
|
|
|
8677
8882
|
// src/renderScene/charts/renderers/treemap/legend.ts
|
|
8678
|
-
var
|
|
8679
|
-
var
|
|
8883
|
+
var BAR_THICKNESS2 = 10;
|
|
8884
|
+
var TICK_LENGTH3 = 4;
|
|
8680
8885
|
var ROW_GAP2 = 2;
|
|
8681
8886
|
var CHART_GAP = 16;
|
|
8682
8887
|
var LABEL_SIZE = 34;
|
|
@@ -8705,7 +8910,7 @@ function renderBottomLegend(context, layout) {
|
|
|
8705
8910
|
const barWidth = layout.gridWidth;
|
|
8706
8911
|
const labelHeight = layout.fontSize + 2;
|
|
8707
8912
|
const barY = plot.y + layout.gridHeight + CHART_GAP;
|
|
8708
|
-
const barBounds = boxBounds({ x: barX, y: barY, width: barWidth, height:
|
|
8913
|
+
const barBounds = boxBounds({ x: barX, y: barY, width: barWidth, height: BAR_THICKNESS2 });
|
|
8709
8914
|
const stops = bandStops(layout);
|
|
8710
8915
|
const bar = {
|
|
8711
8916
|
type: "rect",
|
|
@@ -8715,7 +8920,7 @@ function renderBottomLegend(context, layout) {
|
|
|
8715
8920
|
x: barX,
|
|
8716
8921
|
y: barY,
|
|
8717
8922
|
width: barWidth,
|
|
8718
|
-
height:
|
|
8923
|
+
height: BAR_THICKNESS2,
|
|
8719
8924
|
rx: 3,
|
|
8720
8925
|
zoneGradient: { axis: "y", min: chart.axisY.min, max: chart.axisY.max },
|
|
8721
8926
|
style: {
|
|
@@ -8731,7 +8936,7 @@ function renderBottomLegend(context, layout) {
|
|
|
8731
8936
|
id: `chart-treemap-legend-tick-${chart.id}-${index}`,
|
|
8732
8937
|
order: nextOrder(),
|
|
8733
8938
|
bounds,
|
|
8734
|
-
d: `M ${x} ${barY +
|
|
8939
|
+
d: `M ${x} ${barY + BAR_THICKNESS2} L ${x} ${barY + BAR_THICKNESS2 + TICK_LENGTH3}`,
|
|
8735
8940
|
style: {
|
|
8736
8941
|
fill: { kind: "none" },
|
|
8737
8942
|
stroke: { kind: "solid", color: chart.gridColor ?? "#e2e8f0" },
|
|
@@ -8746,7 +8951,7 @@ function renderBottomLegend(context, layout) {
|
|
|
8746
8951
|
id: `chart-treemap-legend-tick-label-${chart.id}-${index}`,
|
|
8747
8952
|
order: nextOrder(),
|
|
8748
8953
|
bounds,
|
|
8749
|
-
frame: { x: frameX, y: barY +
|
|
8954
|
+
frame: { x: frameX, y: barY + BAR_THICKNESS2 + TICK_LENGTH3 + ROW_GAP2, width: LABEL_SIZE, height: labelHeight },
|
|
8750
8955
|
text: formatFieldValue(value),
|
|
8751
8956
|
chart,
|
|
8752
8957
|
align
|
|
@@ -8760,8 +8965,8 @@ function renderSideLegend(context, layout) {
|
|
|
8760
8965
|
const side = layout.legendPosition;
|
|
8761
8966
|
const barTop = plot.y;
|
|
8762
8967
|
const barHeight = layout.gridHeight;
|
|
8763
|
-
const barX = side === "left" ? plot.x - CHART_GAP -
|
|
8764
|
-
const barBounds = boxBounds({ x: barX, y: barTop, width:
|
|
8968
|
+
const barX = side === "left" ? plot.x - CHART_GAP - BAR_THICKNESS2 : plot.x + layout.gridWidth + CHART_GAP;
|
|
8969
|
+
const barBounds = boxBounds({ x: barX, y: barTop, width: BAR_THICKNESS2, height: barHeight });
|
|
8765
8970
|
const stops = bandStops(layout);
|
|
8766
8971
|
const bar = {
|
|
8767
8972
|
type: "rect",
|
|
@@ -8770,7 +8975,7 @@ function renderSideLegend(context, layout) {
|
|
|
8770
8975
|
bounds: barBounds,
|
|
8771
8976
|
x: barX,
|
|
8772
8977
|
y: barTop,
|
|
8773
|
-
width:
|
|
8978
|
+
width: BAR_THICKNESS2,
|
|
8774
8979
|
height: barHeight,
|
|
8775
8980
|
rx: 3,
|
|
8776
8981
|
zoneGradient: { axis: "y", min: chart.axisY.min, max: chart.axisY.max },
|
|
@@ -8780,8 +8985,8 @@ function renderSideLegend(context, layout) {
|
|
|
8780
8985
|
strokeWidth: 1
|
|
8781
8986
|
}
|
|
8782
8987
|
};
|
|
8783
|
-
const tickX = side === "left" ? barX : barX +
|
|
8784
|
-
const tickEndX = side === "left" ? tickX -
|
|
8988
|
+
const tickX = side === "left" ? barX : barX + BAR_THICKNESS2;
|
|
8989
|
+
const tickEndX = side === "left" ? tickX - TICK_LENGTH3 : tickX + TICK_LENGTH3;
|
|
8785
8990
|
const labelX2 = side === "left" ? tickEndX - ROW_GAP2 - LABEL_SIZE : tickEndX + ROW_GAP2;
|
|
8786
8991
|
const ticks2 = layout.bands.flatMap((value, index) => {
|
|
8787
8992
|
const y = barTop + (1 - bandRatio2(layout, value)) * barHeight;
|
|
@@ -9205,7 +9410,8 @@ function buildChartTitle(chart, bounds, plot, renderOrder) {
|
|
|
9205
9410
|
bounds,
|
|
9206
9411
|
frame: { x: plot.x, y: chart.y + 12, width: plot.width, height: 20 },
|
|
9207
9412
|
text: chart.title,
|
|
9208
|
-
chart
|
|
9413
|
+
chart,
|
|
9414
|
+
align: chart.titleAlign ?? "left"
|
|
9209
9415
|
}),
|
|
9210
9416
|
...chart.titleColor ? { color: chart.titleColor } : {},
|
|
9211
9417
|
fontWeight: chart.titleWeight ?? "bold",
|
|
@@ -10006,5 +10212,5 @@ function defineComponent(definition) {
|
|
|
10006
10212
|
}
|
|
10007
10213
|
|
|
10008
10214
|
export { collectCanvasObjects, decodeColor, decodeShadow, defineComponent, render, renderCanvas, sflToRenderInput, sliderReach };
|
|
10009
|
-
//# sourceMappingURL=chunk-
|
|
10010
|
-
//# sourceMappingURL=chunk-
|
|
10215
|
+
//# sourceMappingURL=chunk-MAPNY7MJ.js.map
|
|
10216
|
+
//# sourceMappingURL=chunk-MAPNY7MJ.js.map
|