vizmatic 0.1.38 → 0.1.40

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,
@@ -5780,6 +5781,11 @@ function LineChart({
5780
5781
 
5781
5782
  // src/primitives/plots.ts
5782
5783
  import React9 from "react";
5784
+ function xTickLabelAlign(index, count) {
5785
+ if (index === 0) return "left";
5786
+ if (index === count - 1) return "right";
5787
+ return "center";
5788
+ }
5783
5789
  function ScatterPlot({
5784
5790
  points,
5785
5791
  c,
@@ -5866,9 +5872,12 @@ function ScatterPlot({
5866
5872
  })
5867
5873
  )
5868
5874
  ),
5869
- ...xTicks.map((tick) => {
5875
+ ...xTicks.map((tick, index) => {
5870
5876
  const x = xInPlot(tick, xDomain, plot);
5871
- return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 44 });
5877
+ return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
5878
+ align: xTickLabelAlign(index, xTicks.length),
5879
+ width: 44
5880
+ });
5872
5881
  }),
5873
5882
  ...yTicks.map((tick) => {
5874
5883
  const y = yInPlot(tick, yDomain, plot);
@@ -5899,6 +5908,228 @@ function ScatterPlot({
5899
5908
  )
5900
5909
  });
5901
5910
  }
5911
+ function pointDominates(candidate, point, xObjective, yObjective) {
5912
+ const xNoWorse = xObjective === "minimize" ? candidate.x <= point.x : candidate.x >= point.x;
5913
+ const yNoWorse = yObjective === "minimize" ? candidate.y <= point.y : candidate.y >= point.y;
5914
+ const xBetter = xObjective === "minimize" ? candidate.x < point.x : candidate.x > point.x;
5915
+ const yBetter = yObjective === "minimize" ? candidate.y < point.y : candidate.y > point.y;
5916
+ return xNoWorse && yNoWorse && (xBetter || yBetter);
5917
+ }
5918
+ function paretoFrontierIndices(points, xObjective, yObjective) {
5919
+ const frontier = /* @__PURE__ */ new Set();
5920
+ for (const candidate of points) {
5921
+ const dominated = points.some(({ point }) => pointDominates(point, candidate.point, xObjective, yObjective));
5922
+ if (!dominated) frontier.add(candidate.index);
5923
+ }
5924
+ return frontier;
5925
+ }
5926
+ function positiveLogDomain(values, min, max) {
5927
+ const positiveValues = values.filter((value) => Number.isFinite(value) && value > 0);
5928
+ const positiveMin = min !== void 0 && Number.isFinite(min) && min > 0 ? min : Math.min(...positiveValues, 1);
5929
+ const fallbackMax = Math.max(...positiveValues, positiveMin * 10);
5930
+ const positiveMax = max !== void 0 && Number.isFinite(max) && max > 0 ? max : fallbackMax;
5931
+ const safeMin = Math.max(Number.MIN_VALUE, positiveMin);
5932
+ const safeMax = positiveMax > safeMin ? positiveMax : safeMin * 10;
5933
+ return { min: safeMin, max: safeMax, range: Math.log(safeMax) - Math.log(safeMin) };
5934
+ }
5935
+ function logChartTicks(min, max, count = 5) {
5936
+ if (!(min > 0) || !(max > min) || count <= 1) return [min];
5937
+ const startPower = Math.ceil(Math.log10(min));
5938
+ const endPower = Math.floor(Math.log10(max));
5939
+ const powers = Array.from({ length: Math.max(0, endPower - startPower + 1) }, (_, index) => 10 ** (startPower + index)).filter((value) => value >= min && value <= max);
5940
+ if (powers.length >= 4) return powers;
5941
+ return Array.from({ length: count }, (_, index) => min * (max / min) ** (index / (count - 1)));
5942
+ }
5943
+ function ParetoChart({
5944
+ points,
5945
+ c,
5946
+ title,
5947
+ subtitle,
5948
+ width = 640,
5949
+ height = 360,
5950
+ xMin,
5951
+ xMax,
5952
+ yMin,
5953
+ yMax,
5954
+ xAxisLabel,
5955
+ yAxisLabel,
5956
+ formatX = "decimal",
5957
+ formatY = "decimal",
5958
+ showGrid = true,
5959
+ xScale = "linear",
5960
+ xObjective = "minimize",
5961
+ yObjective = "maximize",
5962
+ frontierColor,
5963
+ showGoal = true,
5964
+ goalLabel,
5965
+ footer
5966
+ }) {
5967
+ const margin = { top: 22, right: 26, bottom: xAxisLabel ? 48 : 36, left: yAxisLabel ? 56 : 44 };
5968
+ const plot = createPlotArea(width, height, margin);
5969
+ const validPoints = points.map((point, index) => ({ point, index })).filter(({ point }) => Number.isFinite(point.x) && Number.isFinite(point.y) && (xScale !== "log" || point.x > 0));
5970
+ const frontierIndices = paretoFrontierIndices(validPoints, xObjective, yObjective);
5971
+ const xDomain = xScale === "log" ? positiveLogDomain(validPoints.map(({ point }) => point.x), xMin, xMax) : chartDomain(validPoints.map(({ point }) => point.x), xMin, xMax);
5972
+ const yDomain = chartDomain(validPoints.map(({ point }) => point.y), yMin, yMax);
5973
+ const xTicks = xScale === "log" ? logChartTicks(xDomain.min, xDomain.max) : chartTicks(xDomain.min, xDomain.max, 5);
5974
+ const yTicks = chartTicks(yDomain.min, yDomain.max, 5);
5975
+ const frontier = chartColor(frontierColor ?? "positive", c, 0);
5976
+ const pointFor = (xValue, yValue) => {
5977
+ 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);
5978
+ return {
5979
+ x: clamp(x, plot.x, plot.right),
5980
+ y: clamp(yInPlot(yValue, yDomain, plot), plot.y, plot.bottom)
5981
+ };
5982
+ };
5983
+ const pointGeometries = validPoints.map(({ point, index }) => {
5984
+ const pointPosition = pointFor(point.x, point.y);
5985
+ const isFrontier = frontierIndices.has(index);
5986
+ return {
5987
+ point,
5988
+ index,
5989
+ x: pointPosition.x,
5990
+ y: pointPosition.y,
5991
+ color: chartColor(point.color ?? (isFrontier ? frontier : "neutral"), c, index),
5992
+ frontier: isFrontier
5993
+ };
5994
+ });
5995
+ const frontierGeometries = pointGeometries.filter((geometry) => geometry.frontier).sort((left, right) => left.point.x - right.point.x);
5996
+ const frontierPath = frontierGeometries.length > 1 ? frontierGeometries.map((geometry, index) => `${index === 0 ? "M" : "L"} ${geometry.x.toFixed(1)} ${geometry.y.toFixed(1)}`).join(" ") : void 0;
5997
+ const goalText = goalLabel ?? `goal: ${xObjective === "minimize" ? "lower x" : "higher x"} \xB7 ${yObjective === "maximize" ? "higher y" : "lower y"}`;
5998
+ const goalXStart = plot.right - 72;
5999
+ const goalY = plot.y + 18;
6000
+ const goalXEnd = xObjective === "minimize" ? goalXStart - 26 : goalXStart + 26;
6001
+ const goalYStart = plot.y + 52;
6002
+ const goalYEnd = yObjective === "maximize" ? goalYStart - 26 : goalYStart + 26;
6003
+ const arrowSize = 5;
6004
+ return ChartFrame({
6005
+ c,
6006
+ title,
6007
+ subtitle,
6008
+ width,
6009
+ footer,
6010
+ legend: [
6011
+ { label: "Pareto frontier", color: frontier },
6012
+ { label: "dominated", color: "neutral" }
6013
+ ],
6014
+ children: React9.createElement(
6015
+ "div",
6016
+ { style: { position: "relative", width, height, display: "flex" } },
6017
+ React9.createElement(
6018
+ "svg",
6019
+ { width, height, viewBox: `0 0 ${width} ${height}` },
6020
+ showGrid && React9.createElement(
6021
+ "g",
6022
+ {},
6023
+ ...xTicks.map((tick) => {
6024
+ const x = pointFor(tick, yDomain.min).x;
6025
+ return React9.createElement("line", {
6026
+ key: `pareto-x-grid-${tick}`,
6027
+ x1: x,
6028
+ y1: plot.y,
6029
+ x2: x,
6030
+ y2: plot.bottom,
6031
+ stroke: c.borderSubtle,
6032
+ strokeWidth: 1
6033
+ });
6034
+ }),
6035
+ ...yTicks.map((tick) => {
6036
+ const y = yInPlot(tick, yDomain, plot);
6037
+ return React9.createElement("line", {
6038
+ key: `pareto-y-grid-${tick}`,
6039
+ x1: plot.x,
6040
+ y1: y,
6041
+ x2: plot.right,
6042
+ y2: y,
6043
+ stroke: c.borderSubtle,
6044
+ strokeWidth: 1
6045
+ });
6046
+ })
6047
+ ),
6048
+ React9.createElement("rect", {
6049
+ x: plot.x,
6050
+ y: plot.y,
6051
+ width: plot.innerWidth,
6052
+ height: plot.innerHeight,
6053
+ fill: "transparent",
6054
+ stroke: c.borderLight,
6055
+ strokeWidth: 1.2,
6056
+ rx: 6
6057
+ }),
6058
+ showGoal && React9.createElement(
6059
+ "g",
6060
+ { "data-pareto-goal": true, stroke: frontier, fill: "none", strokeWidth: 2, strokeLinecap: "round" },
6061
+ React9.createElement("line", { x1: goalXStart, y1: goalY, x2: goalXEnd, y2: goalY }),
6062
+ React9.createElement("line", { x1: goalXEnd, y1: goalY, x2: goalXEnd + (xObjective === "minimize" ? arrowSize : -arrowSize), y2: goalY - arrowSize }),
6063
+ React9.createElement("line", { x1: goalXEnd, y1: goalY, x2: goalXEnd + (xObjective === "minimize" ? arrowSize : -arrowSize), y2: goalY + arrowSize }),
6064
+ React9.createElement("line", { x1: goalXStart, y1: goalYStart, x2: goalXStart, y2: goalYEnd }),
6065
+ React9.createElement("line", { x1: goalXStart, y1: goalYEnd, x2: goalXStart - arrowSize, y2: goalYEnd + (yObjective === "maximize" ? arrowSize : -arrowSize) }),
6066
+ React9.createElement("line", { x1: goalXStart, y1: goalYEnd, x2: goalXStart + arrowSize, y2: goalYEnd + (yObjective === "maximize" ? arrowSize : -arrowSize) })
6067
+ ),
6068
+ frontierPath && React9.createElement("path", {
6069
+ "data-pareto-frontier": true,
6070
+ d: frontierPath,
6071
+ fill: "none",
6072
+ stroke: frontier,
6073
+ strokeWidth: 3,
6074
+ strokeLinecap: "round",
6075
+ strokeLinejoin: "round"
6076
+ }),
6077
+ ...pointGeometries.filter((geometry) => !geometry.frontier).concat(pointGeometries.filter((geometry) => geometry.frontier)).map(({ point, index, x, y, color, frontier: isFrontier }) => React9.createElement("circle", {
6078
+ key: `pareto-point-${point.label ?? "point"}-${index}`,
6079
+ "data-pareto-status": isFrontier ? "frontier" : "dominated",
6080
+ cx: x,
6081
+ cy: y,
6082
+ r: Math.max(4, Math.min(20, point.size ?? (isFrontier ? 8 : 7))),
6083
+ fill: color,
6084
+ opacity: isFrontier ? 1 : 0.38,
6085
+ stroke: isFrontier ? frontier : c.bgCard,
6086
+ strokeWidth: isFrontier ? 3 : 2
6087
+ }))
6088
+ ),
6089
+ ...xTicks.map((tick, index) => {
6090
+ const x = pointFor(tick, yDomain.min).x;
6091
+ return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6092
+ align: xTickLabelAlign(index, xTicks.length),
6093
+ width: 52
6094
+ });
6095
+ }),
6096
+ ...yTicks.map((tick) => {
6097
+ const y = yInPlot(tick, yDomain, plot);
6098
+ return chartLabel(`pareto-y-tick-${tick}`, formatChartValue(tick, formatY), plot.x - 8, y, c, { align: "right", width: 42 });
6099
+ }),
6100
+ showGoal && chartLabel("pareto-goal-label", goalText, plot.right - 2, plot.y + 9, c, {
6101
+ align: "right",
6102
+ width: 170,
6103
+ color: frontier,
6104
+ fontWeight: 850,
6105
+ fontSize: 11,
6106
+ bounds: { x: plot.x, y: plot.y, width: plot.innerWidth, height: plot.innerHeight, padding: 4 }
6107
+ }),
6108
+ xAxisLabel && chartLabel("pareto-x-axis-label", xAxisLabel, plot.x + plot.innerWidth / 2, height - 8, c, {
6109
+ width: plot.innerWidth,
6110
+ fontFamily: "Inter",
6111
+ fontWeight: 700
6112
+ }),
6113
+ yAxisLabel && chartLabel("pareto-y-axis-label", yAxisLabel, 12, plot.y + plot.innerHeight / 2, c, {
6114
+ width: plot.innerHeight,
6115
+ fontFamily: "Inter",
6116
+ fontWeight: 700,
6117
+ transform: "translate(-50%, -50%) rotate(-90deg)"
6118
+ }),
6119
+ ...pointGeometries.flatMap(({ point, index, x, y, color, frontier: isFrontier }) => {
6120
+ if (!point.label) return [];
6121
+ const placement = pointLabelPlacement(x, y, plot, index, 110);
6122
+ return [chartLabel(`pareto-point-label-${index}`, point.label, placement.x, placement.y, c, {
6123
+ align: placement.align,
6124
+ width: placement.width,
6125
+ bounds: placement.bounds,
6126
+ color: isFrontier ? color : c.textMuted,
6127
+ fontWeight: isFrontier ? 850 : 600
6128
+ })];
6129
+ })
6130
+ )
6131
+ });
6132
+ }
5902
6133
  function QuadrantChart({
5903
6134
  points,
5904
6135
  regions,
@@ -5907,27 +6138,46 @@ function QuadrantChart({
5907
6138
  subtitle,
5908
6139
  width = 700,
5909
6140
  height = 360,
6141
+ xMin,
6142
+ xMax,
6143
+ yMin,
6144
+ yMax,
6145
+ xThreshold,
6146
+ yThreshold,
5910
6147
  xAxisLabel,
5911
6148
  yAxisLabel,
6149
+ formatX = "decimal",
6150
+ formatY = "decimal",
6151
+ showTicks = false,
6152
+ showGrid = false,
5912
6153
  footer
5913
6154
  }) {
5914
- const margin = { top: 18, right: 20, bottom: xAxisLabel ? 46 : 24, left: yAxisLabel ? 54 : 24 };
6155
+ const margin = {
6156
+ top: 18,
6157
+ right: 20,
6158
+ bottom: xAxisLabel ? showTicks ? 58 : 46 : showTicks ? 36 : 24,
6159
+ left: yAxisLabel ? showTicks ? 72 : 54 : showTicks ? 48 : 24
6160
+ };
5915
6161
  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;
6162
+ const xDomain = xMin === void 0 && xMax === void 0 ? { min: 0, max: 1, range: 1 } : chartDomain(points.map((point) => point.x), xMin, xMax);
6163
+ const yDomain = yMin === void 0 && yMax === void 0 ? { min: 0, max: 1, range: 1 } : chartDomain(points.map((point) => point.y), yMin, yMax);
6164
+ const resolvedXThreshold = clamp(xThreshold ?? xDomain.min + xDomain.range / 2, xDomain.min, xDomain.max);
6165
+ const resolvedYThreshold = clamp(yThreshold ?? yDomain.min + yDomain.range / 2, yDomain.min, yDomain.max);
6166
+ const midX = xInPlot(resolvedXThreshold, xDomain, plot);
6167
+ const midY = yInPlot(resolvedYThreshold, yDomain, plot);
6168
+ const xTicks = showTicks || showGrid ? chartTicks(xDomain.min, xDomain.max, 5) : [];
6169
+ const yTicks = showTicks || showGrid ? chartTicks(yDomain.min, yDomain.max, 5) : [];
5920
6170
  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 }
6171
+ { key: "top-left", region: regions.topLeft, x: plot.x, y: plot.y, width: midX - plot.x, height: midY - plot.y },
6172
+ { key: "top-right", region: regions.topRight, x: midX, y: plot.y, width: plot.right - midX, height: midY - plot.y },
6173
+ { key: "bottom-left", region: regions.bottomLeft, x: plot.x, y: midY, width: midX - plot.x, height: plot.bottom - midY },
6174
+ { key: "bottom-right", region: regions.bottomRight, x: midX, y: midY, width: plot.right - midX, height: plot.bottom - midY }
5925
6175
  ];
5926
6176
  const pointGeometries = points.map((point, index) => ({
5927
6177
  point,
5928
6178
  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,
6179
+ x: xInPlot(clamp(point.x, xDomain.min, xDomain.max), xDomain, plot),
6180
+ y: yInPlot(clamp(point.y, yDomain.min, yDomain.max), yDomain, plot),
5931
6181
  color: chartColor(point.color, c, index)
5932
6182
  }));
5933
6183
  return ChartFrame({
@@ -5944,15 +6194,49 @@ function QuadrantChart({
5944
6194
  React9.createElement(
5945
6195
  "svg",
5946
6196
  { 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
- })),
6197
+ ...regionEntries.map(({ key, region, x, y, width: regionWidth, height: regionHeight }, index) => {
6198
+ const color = chartColor(region.color, c, index);
6199
+ const emphasized = region.emphasis === true;
6200
+ return React9.createElement("rect", {
6201
+ key: `quadrant-${key}`,
6202
+ x,
6203
+ y,
6204
+ width: regionWidth,
6205
+ height: regionHeight,
6206
+ fill: color,
6207
+ opacity: emphasized ? 0.2 : 0.1,
6208
+ stroke: emphasized ? color : "transparent",
6209
+ strokeWidth: emphasized ? 2 : 0
6210
+ });
6211
+ }),
6212
+ showGrid && React9.createElement(
6213
+ "g",
6214
+ {},
6215
+ ...xTicks.map((tick) => {
6216
+ const x = xInPlot(tick, xDomain, plot);
6217
+ return React9.createElement("line", {
6218
+ key: `quadrant-x-grid-${tick}`,
6219
+ x1: x,
6220
+ y1: plot.y,
6221
+ x2: x,
6222
+ y2: plot.bottom,
6223
+ stroke: c.borderSubtle,
6224
+ strokeWidth: 1
6225
+ });
6226
+ }),
6227
+ ...yTicks.map((tick) => {
6228
+ const y = yInPlot(tick, yDomain, plot);
6229
+ return React9.createElement("line", {
6230
+ key: `quadrant-y-grid-${tick}`,
6231
+ x1: plot.x,
6232
+ y1: y,
6233
+ x2: plot.right,
6234
+ y2: y,
6235
+ stroke: c.borderSubtle,
6236
+ strokeWidth: 1
6237
+ });
6238
+ })
6239
+ ),
5956
6240
  React9.createElement("rect", {
5957
6241
  x: plot.x,
5958
6242
  y: plot.y,
@@ -5979,6 +6263,30 @@ function QuadrantChart({
5979
6263
  stroke: c.borderLight,
5980
6264
  strokeWidth: 1.4
5981
6265
  }),
6266
+ ...(showTicks ? xTicks : []).map((tick) => {
6267
+ const x = xInPlot(tick, xDomain, plot);
6268
+ return React9.createElement("line", {
6269
+ key: `quadrant-x-tick-${tick}`,
6270
+ x1: x,
6271
+ y1: plot.bottom,
6272
+ x2: x,
6273
+ y2: plot.bottom + 5,
6274
+ stroke: c.textMuted,
6275
+ strokeWidth: 1.2
6276
+ });
6277
+ }),
6278
+ ...(showTicks ? yTicks : []).map((tick) => {
6279
+ const y = yInPlot(tick, yDomain, plot);
6280
+ return React9.createElement("line", {
6281
+ key: `quadrant-y-tick-${tick}`,
6282
+ x1: plot.x - 5,
6283
+ y1: y,
6284
+ x2: plot.x,
6285
+ y2: y,
6286
+ stroke: c.textMuted,
6287
+ strokeWidth: 1.2
6288
+ });
6289
+ }),
5982
6290
  ...pointGeometries.map(({ point, index, x, y, color }) => React9.createElement("circle", {
5983
6291
  key: `quadrant-point-${point.label ?? index}`,
5984
6292
  cx: x,
@@ -5989,23 +6297,34 @@ function QuadrantChart({
5989
6297
  strokeWidth: 3
5990
6298
  }))
5991
6299
  ),
5992
- ...regionEntries.flatMap(({ key, region, x, y }, index) => {
6300
+ ...regionEntries.flatMap(({ key, region, x, y, width: regionWidth }, index) => {
5993
6301
  const color = chartColor(region.color, c, index);
5994
6302
  return [
5995
- chartLabel(`quadrant-label-${key}`, region.label, x + halfWidth / 2, y + 18, c, {
5996
- width: halfWidth - 24,
6303
+ chartLabel(`quadrant-label-${key}`, region.label, x + regionWidth / 2, y + 18, c, {
6304
+ width: Math.max(1, regionWidth - 24),
5997
6305
  color,
5998
6306
  fontFamily: "Inter",
5999
6307
  fontWeight: 900,
6000
6308
  fontSize: 11
6001
6309
  }),
6002
- ...region.detail ? [chartLabel(`quadrant-detail-${key}`, region.detail, x + halfWidth / 2, y + 34, c, {
6003
- width: halfWidth - 24,
6310
+ ...region.detail ? [chartLabel(`quadrant-detail-${key}`, region.detail, x + regionWidth / 2, y + 34, c, {
6311
+ width: Math.max(1, regionWidth - 24),
6004
6312
  color: c.textMuted,
6005
6313
  fontSize: 11
6006
6314
  })] : []
6007
6315
  ];
6008
6316
  }),
6317
+ ...(showTicks ? xTicks : []).map((tick, index) => {
6318
+ const x = xInPlot(tick, xDomain, plot);
6319
+ return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6320
+ align: xTickLabelAlign(index, xTicks.length),
6321
+ width: 54
6322
+ });
6323
+ }),
6324
+ ...(showTicks ? yTicks : []).map((tick) => {
6325
+ const y = yInPlot(tick, yDomain, plot);
6326
+ return chartLabel(`quadrant-y-tick-label-${tick}`, formatChartValue(tick, formatY), plot.x - 9, y, c, { align: "right", width: 48 });
6327
+ }),
6009
6328
  ...pointGeometries.flatMap(({ point, index, x, y, color }) => {
6010
6329
  if (!point.label) return [];
6011
6330
  const placement = pointLabelPlacement(x, y, plot, index, 110);
@@ -6094,9 +6413,12 @@ function IntervalPlot({
6094
6413
  React9.createElement("circle", { key: `${item.label}-mid-${index}`, cx: midX, cy: y, r: 10, fill: c.bgCard, stroke: color, strokeWidth: 4 })
6095
6414
  ])
6096
6415
  ),
6097
- ...ticks.map((tick) => {
6416
+ ...ticks.map((tick, index) => {
6098
6417
  const x = scaleX(tick);
6099
- return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, { width: 48 });
6418
+ return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, {
6419
+ align: xTickLabelAlign(index, ticks.length),
6420
+ width: 48
6421
+ });
6100
6422
  }),
6101
6423
  axisLabel && chartLabel("interval-axis-label", axisLabel, plot.x + plot.innerWidth / 2, height - 8, c, {
6102
6424
  width: plot.innerWidth,