vizmatic 0.1.38 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/PROMPT.md CHANGED
@@ -332,7 +332,8 @@ Charts and plots:
332
332
  - `BarChart`: `data: BarChartDatum[]`, `c`, `title?`, `subtitle?`, `width?: number = 320`, `height?: number = 220`, `min?`, `max?`, `format?: ChartValueFormat = "decimal"`, `showGrid?: boolean = true`, `showValues?: boolean = true`, `yAxisLabel?`, `footer?`. `BarChartDatum`: `label`, `value`, `color?`, `valueLabel?`.
333
333
  - `LineChart`: `series: LineChartSeries[]`, `c`, `title?`, `subtitle?`, `width?: number = 420`, `height?: number = 240`, `labels?`, `min?`, `max?`, `format?: ChartValueFormat = "decimal"`, `showGrid?: boolean = true`, `showPoints?: boolean = true`, `yAxisLabel?`, `footer?`. `LineChartSeries`: `name`, `points`, `color?`, `area?`.
334
334
  - `ScatterPlot`: `points: ScatterPoint[]`, `c`, `title?`, `subtitle?`, `width?: number = 380`, `height?: number = 260`, `xMin?`, `xMax?`, `yMin?`, `yMax?`, `xAxisLabel?`, `yAxisLabel?`, `formatX?: ChartValueFormat = "decimal"`, `formatY?: ChartValueFormat = "decimal"`, `showGrid?: boolean = true`, `footer?`. `ScatterPoint`: `x`, `y`, `label?`, `color?`, `size?`.
335
- - `QuadrantChart`: `points: ScatterPoint[]`, `regions`, `c`, `title?`, `subtitle?`, `width?: number = 700`, `height?: number = 360`, `xAxisLabel?`, `yAxisLabel?`, `footer?`. `regions`: `{ topLeft, topRight, bottomLeft, bottomRight }`, each `QuadrantRegion`: `label`, `detail?`, `color?`.
335
+ - `ParetoChart`: `points: ScatterPoint[]`, `c`, `title?`, `subtitle?`, `width?: number = 640`, `height?: number = 360`, `xMin?`, `xMax?`, `yMin?`, `yMax?`, `xAxisLabel?`, `yAxisLabel?`, `formatX?: ChartValueFormat = "decimal"`, `formatY?: ChartValueFormat = "decimal"`, `showGrid?: boolean = true`, `xScale?: "linear" | "log" = "linear"`, `xObjective?: "minimize" | "maximize" = "minimize"`, `yObjective?: "minimize" | "maximize" = "maximize"`, `frontierColor?`, `showGoal?: boolean = true`, `goalLabel?`, `footer?`. It detects non-dominated points automatically; logarithmic x scales omit non-positive points.
336
+ - `QuadrantChart`: `points: ScatterPoint[]`, `regions`, `c`, `title?`, `subtitle?`, `width?: number = 700`, `height?: number = 360`, `xMin?`, `xMax?`, `yMin?`, `yMax?`, `xThreshold?`, `yThreshold?`, `xAxisLabel?`, `yAxisLabel?`, `formatX?: ChartValueFormat = "decimal"`, `formatY?: ChartValueFormat = "decimal"`, `showTicks?: boolean = false`, `showGrid?: boolean = false`, `footer?`. Without explicit domains, points use normalized 0-1 coordinates and thresholds default to centered splits. `regions`: `{ topLeft, topRight, bottomLeft, bottomRight }`, each `QuadrantRegion`: `label`, `detail?`, `color?`, `emphasis?`.
336
337
  - `IntervalPlot`: `data: IntervalDatum[]`, `c`, `title?`, `subtitle?`, `width?: number = 640`, `height?: number = 220`, `min?`, `max?`, `format?: ChartValueFormat = "decimal"`, `axisLabel?`, `footer?`. `IntervalDatum`: `label`, `low`, `mid`, `high`, `color?`, `lowLabel?`, `midLabel?`, `highLabel?`.
337
338
  - `StackedBar`: `segments: StackedBarSegment[]`, `c`, `width?: number = 480`, `height?: number = 68`, `title?`, `subtitle?`, `showLegend?: boolean = true`. `StackedBarSegment`: `label`, `value`, `color?`, `valueLabel?`.
338
339
  - `MiniBarChart`: `data: MiniBarDatum[]`, `c`, `max?`, `minBarHeight?: number = 8`, `height?: number = 92`, `barWidth?: number = 22`, `gap?: number = 10`, `radius?: number = 7`, `fontSize?: number = 11`, `showValues?: boolean = false`. `MiniBarDatum`: `label`, `value`, `tone?`, `color?`, `valueLabel?`, `opacity?`.
package/README.md CHANGED
@@ -376,9 +376,12 @@ Set `x` and `y` on every node for normalized manual positioning when no groups a
376
376
  | `BarChart` | Full bar chart with ticks, labels, values, grids, and formats. |
377
377
  | `LineChart` | Multi-series line chart with optional area fill, points, labels, and grid. |
378
378
  | `ScatterPlot` | Labeled scatter plot with axes, ticks, point sizing, and collision-aware labels. |
379
- | `QuadrantChart` | 2x2 decision matrix with regions, labeled points, and axis labels. |
379
+ | `ParetoChart` | Automatic non-dominated frontier for competing objectives, including log-scaled cost axes. |
380
+ | `QuadrantChart` | 2x2 decision matrix with numeric axes, configurable thresholds, labeled points, and optional region emphasis. |
380
381
  | `IntervalPlot` | Timeline/range plot for spans, phases, latencies, and schedules. |
381
382
 
383
+ `ParetoChart` defaults to minimizing x and maximizing y, which fits cost-versus-score comparisons. Set `xObjective` or `yObjective` for other tradeoffs. Non-positive x values are omitted on a logarithmic x-axis. `QuadrantChart` accepts raw numeric domains, threshold values, tick formats, and optional grid lines; omit them to keep normalized 0-1 coordinates and centered splits. Regions accept `emphasis: true` to give one decision region a stronger fill and border.
384
+
382
385
  #### Rendering and verification
383
386
 
384
387
  | API | Use |
package/dist/cli.js CHANGED
@@ -57,6 +57,7 @@ __export(index_exports, {
57
57
  MetricCard: () => MetricCard,
58
58
  MiniBarChart: () => MiniBarChart,
59
59
  Panel: () => Panel,
60
+ ParetoChart: () => ParetoChart,
60
61
  Pipeline: () => Pipeline,
61
62
  ProgressList: () => ProgressList,
62
63
  ProgressRow: () => ProgressRow,
@@ -5899,6 +5900,225 @@ function ScatterPlot({
5899
5900
  )
5900
5901
  });
5901
5902
  }
5903
+ function pointDominates(candidate, point, xObjective, yObjective) {
5904
+ const xNoWorse = xObjective === "minimize" ? candidate.x <= point.x : candidate.x >= point.x;
5905
+ const yNoWorse = yObjective === "minimize" ? candidate.y <= point.y : candidate.y >= point.y;
5906
+ const xBetter = xObjective === "minimize" ? candidate.x < point.x : candidate.x > point.x;
5907
+ const yBetter = yObjective === "minimize" ? candidate.y < point.y : candidate.y > point.y;
5908
+ return xNoWorse && yNoWorse && (xBetter || yBetter);
5909
+ }
5910
+ function paretoFrontierIndices(points, xObjective, yObjective) {
5911
+ const frontier = /* @__PURE__ */ new Set();
5912
+ for (const candidate of points) {
5913
+ const dominated = points.some(({ point }) => pointDominates(point, candidate.point, xObjective, yObjective));
5914
+ if (!dominated) frontier.add(candidate.index);
5915
+ }
5916
+ return frontier;
5917
+ }
5918
+ function positiveLogDomain(values, min, max) {
5919
+ const positiveValues = values.filter((value) => Number.isFinite(value) && value > 0);
5920
+ const positiveMin = min !== void 0 && Number.isFinite(min) && min > 0 ? min : Math.min(...positiveValues, 1);
5921
+ const fallbackMax = Math.max(...positiveValues, positiveMin * 10);
5922
+ const positiveMax = max !== void 0 && Number.isFinite(max) && max > 0 ? max : fallbackMax;
5923
+ const safeMin = Math.max(Number.MIN_VALUE, positiveMin);
5924
+ const safeMax = positiveMax > safeMin ? positiveMax : safeMin * 10;
5925
+ return { min: safeMin, max: safeMax, range: Math.log(safeMax) - Math.log(safeMin) };
5926
+ }
5927
+ function logChartTicks(min, max, count = 5) {
5928
+ if (!(min > 0) || !(max > min) || count <= 1) return [min];
5929
+ const startPower = Math.ceil(Math.log10(min));
5930
+ const endPower = Math.floor(Math.log10(max));
5931
+ const powers = Array.from({ length: Math.max(0, endPower - startPower + 1) }, (_, index) => 10 ** (startPower + index)).filter((value) => value >= min && value <= max);
5932
+ if (powers.length >= 4) return powers;
5933
+ return Array.from({ length: count }, (_, index) => min * (max / min) ** (index / (count - 1)));
5934
+ }
5935
+ function ParetoChart({
5936
+ points,
5937
+ c,
5938
+ title,
5939
+ subtitle,
5940
+ width = 640,
5941
+ height = 360,
5942
+ xMin,
5943
+ xMax,
5944
+ yMin,
5945
+ yMax,
5946
+ xAxisLabel,
5947
+ yAxisLabel,
5948
+ formatX = "decimal",
5949
+ formatY = "decimal",
5950
+ showGrid = true,
5951
+ xScale = "linear",
5952
+ xObjective = "minimize",
5953
+ yObjective = "maximize",
5954
+ frontierColor,
5955
+ showGoal = true,
5956
+ goalLabel,
5957
+ footer
5958
+ }) {
5959
+ const margin = { top: 22, right: 26, bottom: xAxisLabel ? 48 : 36, left: yAxisLabel ? 56 : 44 };
5960
+ const plot = createPlotArea(width, height, margin);
5961
+ const validPoints = points.map((point, index) => ({ point, index })).filter(({ point }) => Number.isFinite(point.x) && Number.isFinite(point.y) && (xScale !== "log" || point.x > 0));
5962
+ const frontierIndices = paretoFrontierIndices(validPoints, xObjective, yObjective);
5963
+ const xDomain = xScale === "log" ? positiveLogDomain(validPoints.map(({ point }) => point.x), xMin, xMax) : chartDomain(validPoints.map(({ point }) => point.x), xMin, xMax);
5964
+ const yDomain = chartDomain(validPoints.map(({ point }) => point.y), yMin, yMax);
5965
+ const xTicks = xScale === "log" ? logChartTicks(xDomain.min, xDomain.max) : chartTicks(xDomain.min, xDomain.max, 5);
5966
+ const yTicks = chartTicks(yDomain.min, yDomain.max, 5);
5967
+ const frontier = chartColor(frontierColor ?? "positive", c, 0);
5968
+ const pointFor = (xValue, yValue) => {
5969
+ const x = xScale === "log" ? plot.x + (Math.log(xValue > 0 ? xValue : xDomain.min) - Math.log(xDomain.min)) / xDomain.range * plot.innerWidth : xInPlot(xValue, xDomain, plot);
5970
+ return {
5971
+ x: clamp(x, plot.x, plot.right),
5972
+ y: clamp(yInPlot(yValue, yDomain, plot), plot.y, plot.bottom)
5973
+ };
5974
+ };
5975
+ const pointGeometries = validPoints.map(({ point, index }) => {
5976
+ const pointPosition = pointFor(point.x, point.y);
5977
+ const isFrontier = frontierIndices.has(index);
5978
+ return {
5979
+ point,
5980
+ index,
5981
+ x: pointPosition.x,
5982
+ y: pointPosition.y,
5983
+ color: chartColor(point.color ?? (isFrontier ? frontier : "neutral"), c, index),
5984
+ frontier: isFrontier
5985
+ };
5986
+ });
5987
+ const frontierGeometries = pointGeometries.filter((geometry) => geometry.frontier).sort((left, right) => left.point.x - right.point.x);
5988
+ const frontierPath = frontierGeometries.length > 1 ? frontierGeometries.map((geometry, index) => `${index === 0 ? "M" : "L"} ${geometry.x.toFixed(1)} ${geometry.y.toFixed(1)}`).join(" ") : void 0;
5989
+ const goalText = goalLabel ?? `goal: ${xObjective === "minimize" ? "lower x" : "higher x"} \xB7 ${yObjective === "maximize" ? "higher y" : "lower y"}`;
5990
+ const goalXStart = plot.right - 72;
5991
+ const goalY = plot.y + 18;
5992
+ const goalXEnd = xObjective === "minimize" ? goalXStart - 26 : goalXStart + 26;
5993
+ const goalYStart = plot.y + 52;
5994
+ const goalYEnd = yObjective === "maximize" ? goalYStart - 26 : goalYStart + 26;
5995
+ const arrowSize = 5;
5996
+ return ChartFrame({
5997
+ c,
5998
+ title,
5999
+ subtitle,
6000
+ width,
6001
+ footer,
6002
+ legend: [
6003
+ { label: "Pareto frontier", color: frontier },
6004
+ { label: "dominated", color: "neutral" }
6005
+ ],
6006
+ children: React9.createElement(
6007
+ "div",
6008
+ { style: { position: "relative", width, height, display: "flex" } },
6009
+ React9.createElement(
6010
+ "svg",
6011
+ { width, height, viewBox: `0 0 ${width} ${height}` },
6012
+ showGrid && React9.createElement(
6013
+ "g",
6014
+ {},
6015
+ ...xTicks.map((tick) => {
6016
+ const x = pointFor(tick, yDomain.min).x;
6017
+ return React9.createElement("line", {
6018
+ key: `pareto-x-grid-${tick}`,
6019
+ x1: x,
6020
+ y1: plot.y,
6021
+ x2: x,
6022
+ y2: plot.bottom,
6023
+ stroke: c.borderSubtle,
6024
+ strokeWidth: 1
6025
+ });
6026
+ }),
6027
+ ...yTicks.map((tick) => {
6028
+ const y = yInPlot(tick, yDomain, plot);
6029
+ return React9.createElement("line", {
6030
+ key: `pareto-y-grid-${tick}`,
6031
+ x1: plot.x,
6032
+ y1: y,
6033
+ x2: plot.right,
6034
+ y2: y,
6035
+ stroke: c.borderSubtle,
6036
+ strokeWidth: 1
6037
+ });
6038
+ })
6039
+ ),
6040
+ React9.createElement("rect", {
6041
+ x: plot.x,
6042
+ y: plot.y,
6043
+ width: plot.innerWidth,
6044
+ height: plot.innerHeight,
6045
+ fill: "transparent",
6046
+ stroke: c.borderLight,
6047
+ strokeWidth: 1.2,
6048
+ rx: 6
6049
+ }),
6050
+ showGoal && React9.createElement(
6051
+ "g",
6052
+ { "data-pareto-goal": true, stroke: frontier, fill: "none", strokeWidth: 2, strokeLinecap: "round" },
6053
+ React9.createElement("line", { x1: goalXStart, y1: goalY, x2: goalXEnd, y2: goalY }),
6054
+ React9.createElement("line", { x1: goalXEnd, y1: goalY, x2: goalXEnd + (xObjective === "minimize" ? arrowSize : -arrowSize), y2: goalY - arrowSize }),
6055
+ React9.createElement("line", { x1: goalXEnd, y1: goalY, x2: goalXEnd + (xObjective === "minimize" ? arrowSize : -arrowSize), y2: goalY + arrowSize }),
6056
+ React9.createElement("line", { x1: goalXStart, y1: goalYStart, x2: goalXStart, y2: goalYEnd }),
6057
+ React9.createElement("line", { x1: goalXStart, y1: goalYEnd, x2: goalXStart - arrowSize, y2: goalYEnd + (yObjective === "maximize" ? arrowSize : -arrowSize) }),
6058
+ React9.createElement("line", { x1: goalXStart, y1: goalYEnd, x2: goalXStart + arrowSize, y2: goalYEnd + (yObjective === "maximize" ? arrowSize : -arrowSize) })
6059
+ ),
6060
+ frontierPath && React9.createElement("path", {
6061
+ "data-pareto-frontier": true,
6062
+ d: frontierPath,
6063
+ fill: "none",
6064
+ stroke: frontier,
6065
+ strokeWidth: 3,
6066
+ strokeLinecap: "round",
6067
+ strokeLinejoin: "round"
6068
+ }),
6069
+ ...pointGeometries.filter((geometry) => !geometry.frontier).concat(pointGeometries.filter((geometry) => geometry.frontier)).map(({ point, index, x, y, color, frontier: isFrontier }) => React9.createElement("circle", {
6070
+ key: `pareto-point-${point.label ?? "point"}-${index}`,
6071
+ "data-pareto-status": isFrontier ? "frontier" : "dominated",
6072
+ cx: x,
6073
+ cy: y,
6074
+ r: Math.max(4, Math.min(20, point.size ?? (isFrontier ? 8 : 7))),
6075
+ fill: color,
6076
+ opacity: isFrontier ? 1 : 0.38,
6077
+ stroke: isFrontier ? frontier : c.bgCard,
6078
+ strokeWidth: isFrontier ? 3 : 2
6079
+ }))
6080
+ ),
6081
+ ...xTicks.map((tick) => {
6082
+ const x = pointFor(tick, yDomain.min).x;
6083
+ return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 52 });
6084
+ }),
6085
+ ...yTicks.map((tick) => {
6086
+ const y = yInPlot(tick, yDomain, plot);
6087
+ return chartLabel(`pareto-y-tick-${tick}`, formatChartValue(tick, formatY), plot.x - 8, y, c, { align: "right", width: 42 });
6088
+ }),
6089
+ showGoal && chartLabel("pareto-goal-label", goalText, plot.right - 2, plot.y + 9, c, {
6090
+ align: "right",
6091
+ width: 170,
6092
+ color: frontier,
6093
+ fontWeight: 850,
6094
+ fontSize: 11,
6095
+ bounds: { x: plot.x, y: plot.y, width: plot.innerWidth, height: plot.innerHeight, padding: 4 }
6096
+ }),
6097
+ xAxisLabel && chartLabel("pareto-x-axis-label", xAxisLabel, plot.x + plot.innerWidth / 2, height - 8, c, {
6098
+ width: plot.innerWidth,
6099
+ fontFamily: "Inter",
6100
+ fontWeight: 700
6101
+ }),
6102
+ yAxisLabel && chartLabel("pareto-y-axis-label", yAxisLabel, 12, plot.y + plot.innerHeight / 2, c, {
6103
+ width: plot.innerHeight,
6104
+ fontFamily: "Inter",
6105
+ fontWeight: 700,
6106
+ transform: "translate(-50%, -50%) rotate(-90deg)"
6107
+ }),
6108
+ ...pointGeometries.flatMap(({ point, index, x, y, color, frontier: isFrontier }) => {
6109
+ if (!point.label) return [];
6110
+ const placement = pointLabelPlacement(x, y, plot, index, 110);
6111
+ return [chartLabel(`pareto-point-label-${index}`, point.label, placement.x, placement.y, c, {
6112
+ align: placement.align,
6113
+ width: placement.width,
6114
+ bounds: placement.bounds,
6115
+ color: isFrontier ? color : c.textMuted,
6116
+ fontWeight: isFrontier ? 850 : 600
6117
+ })];
6118
+ })
6119
+ )
6120
+ });
6121
+ }
5902
6122
  function QuadrantChart({
5903
6123
  points,
5904
6124
  regions,
@@ -5907,27 +6127,46 @@ function QuadrantChart({
5907
6127
  subtitle,
5908
6128
  width = 700,
5909
6129
  height = 360,
6130
+ xMin,
6131
+ xMax,
6132
+ yMin,
6133
+ yMax,
6134
+ xThreshold,
6135
+ yThreshold,
5910
6136
  xAxisLabel,
5911
6137
  yAxisLabel,
6138
+ formatX = "decimal",
6139
+ formatY = "decimal",
6140
+ showTicks = false,
6141
+ showGrid = false,
5912
6142
  footer
5913
6143
  }) {
5914
- const margin = { top: 18, right: 20, bottom: xAxisLabel ? 46 : 24, left: yAxisLabel ? 54 : 24 };
6144
+ const margin = {
6145
+ top: 18,
6146
+ right: 20,
6147
+ bottom: xAxisLabel ? showTicks ? 58 : 46 : showTicks ? 36 : 24,
6148
+ left: yAxisLabel ? showTicks ? 72 : 54 : showTicks ? 48 : 24
6149
+ };
5915
6150
  const plot = createPlotArea(width, height, margin);
5916
- const halfWidth = plot.innerWidth / 2;
5917
- const halfHeight = plot.innerHeight / 2;
5918
- const midX = plot.x + halfWidth;
5919
- const midY = plot.y + halfHeight;
6151
+ const xDomain = xMin === void 0 && xMax === void 0 ? { min: 0, max: 1, range: 1 } : chartDomain(points.map((point) => point.x), xMin, xMax);
6152
+ const yDomain = yMin === void 0 && yMax === void 0 ? { min: 0, max: 1, range: 1 } : chartDomain(points.map((point) => point.y), yMin, yMax);
6153
+ const resolvedXThreshold = clamp(xThreshold ?? xDomain.min + xDomain.range / 2, xDomain.min, xDomain.max);
6154
+ const resolvedYThreshold = clamp(yThreshold ?? yDomain.min + yDomain.range / 2, yDomain.min, yDomain.max);
6155
+ const midX = xInPlot(resolvedXThreshold, xDomain, plot);
6156
+ const midY = yInPlot(resolvedYThreshold, yDomain, plot);
6157
+ const xTicks = showTicks || showGrid ? chartTicks(xDomain.min, xDomain.max, 5) : [];
6158
+ const yTicks = showTicks || showGrid ? chartTicks(yDomain.min, yDomain.max, 5) : [];
5920
6159
  const regionEntries = [
5921
- { key: "top-left", region: regions.topLeft, x: plot.x, y: plot.y },
5922
- { key: "top-right", region: regions.topRight, x: midX, y: plot.y },
5923
- { key: "bottom-left", region: regions.bottomLeft, x: plot.x, y: midY },
5924
- { key: "bottom-right", region: regions.bottomRight, x: midX, y: midY }
6160
+ { key: "top-left", region: regions.topLeft, x: plot.x, y: plot.y, width: midX - plot.x, height: midY - plot.y },
6161
+ { key: "top-right", region: regions.topRight, x: midX, y: plot.y, width: plot.right - midX, height: midY - plot.y },
6162
+ { key: "bottom-left", region: regions.bottomLeft, x: plot.x, y: midY, width: midX - plot.x, height: plot.bottom - midY },
6163
+ { key: "bottom-right", region: regions.bottomRight, x: midX, y: midY, width: plot.right - midX, height: plot.bottom - midY }
5925
6164
  ];
5926
6165
  const pointGeometries = points.map((point, index) => ({
5927
6166
  point,
5928
6167
  index,
5929
- x: plot.x + clamp(point.x, 0, 1) * plot.innerWidth,
5930
- y: plot.y + plot.innerHeight - clamp(point.y, 0, 1) * plot.innerHeight,
6168
+ x: xInPlot(clamp(point.x, xDomain.min, xDomain.max), xDomain, plot),
6169
+ y: yInPlot(clamp(point.y, yDomain.min, yDomain.max), yDomain, plot),
5931
6170
  color: chartColor(point.color, c, index)
5932
6171
  }));
5933
6172
  return ChartFrame({
@@ -5944,15 +6183,49 @@ function QuadrantChart({
5944
6183
  React9.createElement(
5945
6184
  "svg",
5946
6185
  { width, height, viewBox: `0 0 ${width} ${height}` },
5947
- ...regionEntries.map(({ key, region, x, y }, index) => React9.createElement("rect", {
5948
- key: `quadrant-${key}`,
5949
- x,
5950
- y,
5951
- width: halfWidth,
5952
- height: halfHeight,
5953
- fill: chartColor(region.color, c, index),
5954
- opacity: 0.1
5955
- })),
6186
+ ...regionEntries.map(({ key, region, x, y, width: regionWidth, height: regionHeight }, index) => {
6187
+ const color = chartColor(region.color, c, index);
6188
+ const emphasized = region.emphasis === true;
6189
+ return React9.createElement("rect", {
6190
+ key: `quadrant-${key}`,
6191
+ x,
6192
+ y,
6193
+ width: regionWidth,
6194
+ height: regionHeight,
6195
+ fill: color,
6196
+ opacity: emphasized ? 0.2 : 0.1,
6197
+ stroke: emphasized ? color : "transparent",
6198
+ strokeWidth: emphasized ? 2 : 0
6199
+ });
6200
+ }),
6201
+ showGrid && React9.createElement(
6202
+ "g",
6203
+ {},
6204
+ ...xTicks.map((tick) => {
6205
+ const x = xInPlot(tick, xDomain, plot);
6206
+ return React9.createElement("line", {
6207
+ key: `quadrant-x-grid-${tick}`,
6208
+ x1: x,
6209
+ y1: plot.y,
6210
+ x2: x,
6211
+ y2: plot.bottom,
6212
+ stroke: c.borderSubtle,
6213
+ strokeWidth: 1
6214
+ });
6215
+ }),
6216
+ ...yTicks.map((tick) => {
6217
+ const y = yInPlot(tick, yDomain, plot);
6218
+ return React9.createElement("line", {
6219
+ key: `quadrant-y-grid-${tick}`,
6220
+ x1: plot.x,
6221
+ y1: y,
6222
+ x2: plot.right,
6223
+ y2: y,
6224
+ stroke: c.borderSubtle,
6225
+ strokeWidth: 1
6226
+ });
6227
+ })
6228
+ ),
5956
6229
  React9.createElement("rect", {
5957
6230
  x: plot.x,
5958
6231
  y: plot.y,
@@ -5979,6 +6252,30 @@ function QuadrantChart({
5979
6252
  stroke: c.borderLight,
5980
6253
  strokeWidth: 1.4
5981
6254
  }),
6255
+ ...(showTicks ? xTicks : []).map((tick) => {
6256
+ const x = xInPlot(tick, xDomain, plot);
6257
+ return React9.createElement("line", {
6258
+ key: `quadrant-x-tick-${tick}`,
6259
+ x1: x,
6260
+ y1: plot.bottom,
6261
+ x2: x,
6262
+ y2: plot.bottom + 5,
6263
+ stroke: c.textMuted,
6264
+ strokeWidth: 1.2
6265
+ });
6266
+ }),
6267
+ ...(showTicks ? yTicks : []).map((tick) => {
6268
+ const y = yInPlot(tick, yDomain, plot);
6269
+ return React9.createElement("line", {
6270
+ key: `quadrant-y-tick-${tick}`,
6271
+ x1: plot.x - 5,
6272
+ y1: y,
6273
+ x2: plot.x,
6274
+ y2: y,
6275
+ stroke: c.textMuted,
6276
+ strokeWidth: 1.2
6277
+ });
6278
+ }),
5982
6279
  ...pointGeometries.map(({ point, index, x, y, color }) => React9.createElement("circle", {
5983
6280
  key: `quadrant-point-${point.label ?? index}`,
5984
6281
  cx: x,
@@ -5989,23 +6286,31 @@ function QuadrantChart({
5989
6286
  strokeWidth: 3
5990
6287
  }))
5991
6288
  ),
5992
- ...regionEntries.flatMap(({ key, region, x, y }, index) => {
6289
+ ...regionEntries.flatMap(({ key, region, x, y, width: regionWidth }, index) => {
5993
6290
  const color = chartColor(region.color, c, index);
5994
6291
  return [
5995
- chartLabel(`quadrant-label-${key}`, region.label, x + halfWidth / 2, y + 18, c, {
5996
- width: halfWidth - 24,
6292
+ chartLabel(`quadrant-label-${key}`, region.label, x + regionWidth / 2, y + 18, c, {
6293
+ width: Math.max(1, regionWidth - 24),
5997
6294
  color,
5998
6295
  fontFamily: "Inter",
5999
6296
  fontWeight: 900,
6000
6297
  fontSize: 11
6001
6298
  }),
6002
- ...region.detail ? [chartLabel(`quadrant-detail-${key}`, region.detail, x + halfWidth / 2, y + 34, c, {
6003
- width: halfWidth - 24,
6299
+ ...region.detail ? [chartLabel(`quadrant-detail-${key}`, region.detail, x + regionWidth / 2, y + 34, c, {
6300
+ width: Math.max(1, regionWidth - 24),
6004
6301
  color: c.textMuted,
6005
6302
  fontSize: 11
6006
6303
  })] : []
6007
6304
  ];
6008
6305
  }),
6306
+ ...(showTicks ? xTicks : []).map((tick) => {
6307
+ const x = xInPlot(tick, xDomain, plot);
6308
+ return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 54 });
6309
+ }),
6310
+ ...(showTicks ? yTicks : []).map((tick) => {
6311
+ const y = yInPlot(tick, yDomain, plot);
6312
+ return chartLabel(`quadrant-y-tick-label-${tick}`, formatChartValue(tick, formatY), plot.x - 9, y, c, { align: "right", width: 48 });
6313
+ }),
6009
6314
  ...pointGeometries.flatMap(({ point, index, x, y, color }) => {
6010
6315
  if (!point.label) return [];
6011
6316
  const placement = pointLabelPlacement(x, y, plot, index, 110);