@lincyaw/aegis-ui 0.7.0 → 0.9.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/dist/components/ui/AgentHud.cjs +2 -0
- package/dist/components/ui/AgentHud.cjs.map +1 -0
- package/dist/components/ui/AgentHud.d.ts +23 -0
- package/dist/components/ui/AgentHud.js +45 -0
- package/dist/components/ui/AgentHud.js.map +1 -0
- package/dist/components/ui/ChartLegend.cjs +2 -0
- package/dist/components/ui/ChartLegend.cjs.map +1 -0
- package/dist/components/ui/ChartLegend.d.ts +17 -0
- package/dist/components/ui/ChartLegend.js +37 -0
- package/dist/components/ui/ChartLegend.js.map +1 -0
- package/dist/components/ui/ColumnChart.cjs +2 -0
- package/dist/components/ui/ColumnChart.cjs.map +1 -0
- package/dist/components/ui/ColumnChart.d.ts +46 -0
- package/dist/components/ui/ColumnChart.js +154 -0
- package/dist/components/ui/ColumnChart.js.map +1 -0
- package/dist/components/ui/DataTable.cjs +1 -1
- package/dist/components/ui/DataTable.cjs.map +1 -1
- package/dist/components/ui/DataTable.d.ts +25 -1
- package/dist/components/ui/DataTable.js +305 -231
- package/dist/components/ui/DataTable.js.map +1 -1
- package/dist/components/ui/DotRangeChart.cjs +2 -0
- package/dist/components/ui/DotRangeChart.cjs.map +1 -0
- package/dist/components/ui/DotRangeChart.d.ts +44 -0
- package/dist/components/ui/DotRangeChart.js +80 -0
- package/dist/components/ui/DotRangeChart.js.map +1 -0
- package/dist/components/ui/HeadlineStat.cjs +2 -0
- package/dist/components/ui/HeadlineStat.cjs.map +1 -0
- package/dist/components/ui/HeadlineStat.d.ts +10 -0
- package/dist/components/ui/HeadlineStat.js +22 -0
- package/dist/components/ui/HeadlineStat.js.map +1 -0
- package/dist/components/ui/Heatmap.cjs +2 -0
- package/dist/components/ui/Heatmap.cjs.map +1 -0
- package/dist/components/ui/Heatmap.d.ts +52 -0
- package/dist/components/ui/Heatmap.js +82 -0
- package/dist/components/ui/Heatmap.js.map +1 -0
- package/dist/components/ui/KeyMomentCard.cjs +2 -0
- package/dist/components/ui/KeyMomentCard.cjs.map +1 -0
- package/dist/components/ui/KeyMomentCard.d.ts +19 -0
- package/dist/components/ui/KeyMomentCard.js +45 -0
- package/dist/components/ui/KeyMomentCard.js.map +1 -0
- package/dist/components/ui/LineChart.cjs +2 -0
- package/dist/components/ui/LineChart.cjs.map +1 -0
- package/dist/components/ui/LineChart.d.ts +48 -0
- package/dist/components/ui/LineChart.js +199 -0
- package/dist/components/ui/LineChart.js.map +1 -0
- package/dist/components/ui/ParetoChart.cjs +1 -1
- package/dist/components/ui/ParetoChart.cjs.map +1 -1
- package/dist/components/ui/ParetoChart.d.ts +44 -5
- package/dist/components/ui/ParetoChart.js +261 -170
- package/dist/components/ui/ParetoChart.js.map +1 -1
- package/dist/components/ui/RankBar.cjs +1 -1
- package/dist/components/ui/RankBar.cjs.map +1 -1
- package/dist/components/ui/RankBar.d.ts +21 -2
- package/dist/components/ui/RankBar.js +76 -42
- package/dist/components/ui/RankBar.js.map +1 -1
- package/dist/components/ui/ReplayScrubber.cjs +2 -0
- package/dist/components/ui/ReplayScrubber.cjs.map +1 -0
- package/dist/components/ui/ReplayScrubber.d.ts +35 -0
- package/dist/components/ui/ReplayScrubber.js +119 -0
- package/dist/components/ui/ReplayScrubber.js.map +1 -0
- package/dist/components/ui/ReplayStepStrip.cjs +2 -0
- package/dist/components/ui/ReplayStepStrip.cjs.map +1 -0
- package/dist/components/ui/ReplayStepStrip.d.ts +45 -0
- package/dist/components/ui/ReplayStepStrip.js +142 -0
- package/dist/components/ui/ReplayStepStrip.js.map +1 -0
- package/dist/components/ui/ReplayTransport.cjs +2 -0
- package/dist/components/ui/ReplayTransport.cjs.map +1 -0
- package/dist/components/ui/ReplayTransport.d.ts +25 -0
- package/dist/components/ui/ReplayTransport.js +103 -0
- package/dist/components/ui/ReplayTransport.js.map +1 -0
- package/dist/components/ui/ResultMatrix.cjs +2 -0
- package/dist/components/ui/ResultMatrix.cjs.map +1 -0
- package/dist/components/ui/ResultMatrix.d.ts +23 -0
- package/dist/components/ui/ResultMatrix.js +53 -0
- package/dist/components/ui/ResultMatrix.js.map +1 -0
- package/dist/components/ui/ScrollStory.cjs +2 -2
- package/dist/components/ui/ScrollStory.cjs.map +1 -1
- package/dist/components/ui/ScrollStory.d.ts +3 -1
- package/dist/components/ui/ScrollStory.js +34 -32
- package/dist/components/ui/ScrollStory.js.map +1 -1
- package/dist/components/ui/SeriesLabel.cjs +2 -0
- package/dist/components/ui/SeriesLabel.cjs.map +1 -0
- package/dist/components/ui/SeriesLabel.d.ts +21 -0
- package/dist/components/ui/SeriesLabel.js +38 -0
- package/dist/components/ui/SeriesLabel.js.map +1 -0
- package/dist/components/ui/StackedBar.cjs +1 -1
- package/dist/components/ui/StackedBar.cjs.map +1 -1
- package/dist/components/ui/StackedBar.d.ts +21 -8
- package/dist/components/ui/StackedBar.js +110 -74
- package/dist/components/ui/StackedBar.js.map +1 -1
- package/dist/components/ui/TableOfContents.cjs +1 -1
- package/dist/components/ui/TableOfContents.cjs.map +1 -1
- package/dist/components/ui/TableOfContents.js +31 -89
- package/dist/components/ui/TableOfContents.js.map +1 -1
- package/dist/components/ui/ThoughtCard.cjs +2 -0
- package/dist/components/ui/ThoughtCard.cjs.map +1 -0
- package/dist/components/ui/ThoughtCard.d.ts +23 -0
- package/dist/components/ui/ThoughtCard.js +55 -0
- package/dist/components/ui/ThoughtCard.js.map +1 -0
- package/dist/components/ui/TimelineChart.cjs +1 -1
- package/dist/components/ui/TimelineChart.cjs.map +1 -1
- package/dist/components/ui/TimelineChart.d.ts +12 -15
- package/dist/components/ui/TimelineChart.js +160 -150
- package/dist/components/ui/TimelineChart.js.map +1 -1
- package/dist/components/ui/TraceSpanInspector.cjs +1 -1
- package/dist/components/ui/TraceSpanInspector.cjs.map +1 -1
- package/dist/components/ui/TraceSpanInspector.js +25 -25
- package/dist/components/ui/TraceSpanInspector.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +13 -2
- package/dist/components/ui/TraceTree.js +22 -22
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/index.d.ts +31 -5
- package/dist/components/ui/traceFormat.cjs +1 -1
- package/dist/components/ui/traceFormat.cjs.map +1 -1
- package/dist/components/ui/traceFormat.d.ts +0 -2
- package/dist/components/ui/traceFormat.js +2 -6
- package/dist/components/ui/traceFormat.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useReplayPlayback.cjs +2 -0
- package/dist/hooks/useReplayPlayback.cjs.map +1 -0
- package/dist/hooks/useReplayPlayback.d.ts +44 -0
- package/dist/hooks/useReplayPlayback.js +73 -0
- package/dist/hooks/useReplayPlayback.js.map +1 -0
- package/dist/hooks/useSectionSpy.cjs +2 -0
- package/dist/hooks/useSectionSpy.cjs.map +1 -0
- package/dist/hooks/useSectionSpy.d.ts +23 -0
- package/dist/hooks/useSectionSpy.js +78 -0
- package/dist/hooks/useSectionSpy.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +339 -300
- package/dist/index.js.map +1 -1
- package/dist/layouts/SkipLink.cjs +2 -0
- package/dist/layouts/SkipLink.cjs.map +1 -0
- package/dist/layouts/SkipLink.d.ts +13 -0
- package/dist/layouts/SkipLink.js +21 -0
- package/dist/layouts/SkipLink.js.map +1 -0
- package/dist/layouts/shell/AegisShell.cjs +1 -1
- package/dist/layouts/shell/AegisShell.cjs.map +1 -1
- package/dist/layouts/shell/AegisShell.js +174 -193
- package/dist/layouts/shell/AegisShell.js.map +1 -1
- package/dist/layouts/site/SiteAnchorNav.cjs +2 -0
- package/dist/layouts/site/SiteAnchorNav.cjs.map +1 -0
- package/dist/layouts/site/SiteAnchorNav.d.ts +22 -0
- package/dist/layouts/site/SiteAnchorNav.js +51 -0
- package/dist/layouts/site/SiteAnchorNav.js.map +1 -0
- package/dist/layouts/site/SiteLayout.cjs +1 -1
- package/dist/layouts/site/SiteLayout.cjs.map +1 -1
- package/dist/layouts/site/SiteLayout.js +18 -28
- package/dist/layouts/site/SiteLayout.js.map +1 -1
- package/dist/layouts/site/SiteNav.cjs +1 -1
- package/dist/layouts/site/SiteNav.cjs.map +1 -1
- package/dist/layouts/site/SiteNav.js +50 -48
- package/dist/layouts/site/SiteNav.js.map +1 -1
- package/dist/layouts/site/SiteSectionHeader.cjs +2 -0
- package/dist/layouts/site/SiteSectionHeader.cjs.map +1 -0
- package/dist/layouts/site/SiteSectionHeader.d.ts +20 -0
- package/dist/layouts/site/SiteSectionHeader.js +30 -0
- package/dist/layouts/site/SiteSectionHeader.js.map +1 -0
- package/dist/layouts/site/index.d.ts +4 -0
- package/dist/lib/chart.cjs +2 -0
- package/dist/lib/chart.cjs.map +1 -0
- package/dist/lib/chart.d.ts +39 -0
- package/dist/lib/chart.js +51 -0
- package/dist/lib/chart.js.map +1 -0
- package/dist/locale/strings.cjs +1 -1
- package/dist/locale/strings.cjs.map +1 -1
- package/dist/locale/strings.d.ts +11 -8
- package/dist/locale/strings.js +38 -34
- package/dist/locale/strings.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/components/ui/SessionRunView.cjs +0 -4
- package/dist/components/ui/SessionRunView.cjs.map +0 -1
- package/dist/components/ui/SessionRunView.d.ts +0 -50
- package/dist/components/ui/SessionRunView.js +0 -379
- package/dist/components/ui/SessionRunView.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParetoChart.cjs","sources":["../../../src/components/ui/ParetoChart.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useMemo,\n useRef,\n} from 'react';\n\nimport { useElementWidth } from '../../hooks/useElementWidth';\nimport { useStrings } from '../../locale';\nimport { EmptyState } from './EmptyState';\nimport './ParetoChart.css';\n\nexport interface ParetoPoint {\n key: string;\n label: string;\n x: number;\n y: number;\n /** Point fill, e.g. `var(--data-cat-2)` to match the series elsewhere. */\n color?: string;\n}\n\n/** One series in the legend under the plot, e.g. a model and its colour. */\nexport interface ParetoLegendItem {\n key: string;\n label: ReactNode;\n /** Swatch fill; the same value its points use. */\n color?: string;\n}\n\ninterface ParetoChartProps {\n points: ParetoPoint[];\n xLabel: string;\n yLabel: string;\n /** Which direction counts as better on each axis. */\n xDirection?: 'lower' | 'higher';\n yDirection?: 'lower' | 'higher';\n /** Formats the 0 and maximum labels of each axis. */\n formatX?: (value: number) => string;\n formatY?: (value: number) => string;\n onSelect?: (key: string) => void;\n /** Series swatches with labels, listed under the plot. */\n legend?: ParetoLegendItem[];\n /**\n * Shown in place of the plot, at its minimum height, while there are no\n * points — e.g. an EmptyState with an icon asking for both axes. Replaces\n * the default empty state built from `emptyTitle`.\n */\n empty?: ReactNode;\n emptyTitle?: string;\n emptyDescription?: string;\n className?: string;\n}\n\n// The SVG is drawn at its measured CSS width, so these are true px.\nconst MAX_HEIGHT = 320;\nconst MIN_HEIGHT = 220;\nconst PAD_LEFT = 56;\nconst PAD_RIGHT = 16;\nconst PAD_TOP = 28;\nconst PAD_BOTTOM = 44;\nconst POINT_RADIUS = 5;\nconst LABEL_GAP = 8;\nconst GRID_STEPS = 4;\n\ntype Direction = 'lower' | 'higher';\n\nfunction better(a: number, b: number, direction: Direction): boolean {\n return direction === 'lower' ? a < b : a > b;\n}\n\n/** Axis span from 0 (or the data minimum when negative) to the maximum. */\nfunction zeroAnchoredDomain(values: number[]): [number, number] {\n const lo = Math.min(0, ...values);\n const hi = Math.max(0, ...values);\n return hi === lo ? [lo, lo + 1] : [lo, hi];\n}\n\nexport function ParetoChart({\n points,\n xLabel,\n yLabel,\n xDirection = 'lower',\n yDirection = 'higher',\n formatX = String,\n formatY = String,\n onSelect,\n legend,\n empty,\n emptyTitle,\n emptyDescription,\n className,\n}: ParetoChartProps) {\n const strings = useStrings();\n const wrapRef = useRef<HTMLDivElement>(null);\n const width = useElementWidth(wrapRef);\n const cls = ['aegis-pareto', className ?? ''].filter(Boolean).join(' ');\n\n const geometry = useMemo(() => {\n if (points.length === 0 || width === 0) {\n return null;\n }\n const height = Math.round(\n Math.min(MAX_HEIGHT, Math.max(MIN_HEIGHT, width / 2)),\n );\n const [xLo, xHi] = zeroAnchoredDomain(points.map((point) => point.x));\n const [yLo, yHi] = zeroAnchoredDomain(points.map((point) => point.y));\n const left = PAD_LEFT;\n const right = width - PAD_RIGHT;\n const top = PAD_TOP;\n const bottom = height - PAD_BOTTOM;\n const sx = (value: number): number =>\n left + ((value - xLo) / (xHi - xLo)) * (right - left);\n const sy = (value: number): number =>\n bottom - ((value - yLo) / (yHi - yLo)) * (bottom - top);\n const front = points\n .filter(\n (candidate) =>\n !points.some(\n (other) =>\n other.key !== candidate.key &&\n (better(other.x, candidate.x, xDirection) ||\n other.x === candidate.x) &&\n (better(other.y, candidate.y, yDirection) ||\n other.y === candidate.y) &&\n (better(other.x, candidate.x, xDirection) ||\n better(other.y, candidate.y, yDirection)),\n ),\n )\n .sort((a, b) => a.x - b.x);\n const steps = Array.from(\n { length: GRID_STEPS },\n (_, i) => (i + 1) / GRID_STEPS,\n );\n return {\n height,\n left,\n right,\n top,\n bottom,\n sx,\n sy,\n front,\n frontKeys: new Set(front.map((point) => point.key)),\n gridX: steps.map((t) => sx(xLo + (xHi - xLo) * t)),\n gridY: steps.map((t) => sy(yLo + (yHi - yLo) * t)),\n xLo,\n xHi,\n yLo,\n yHi,\n };\n }, [points, width, xDirection, yDirection]);\n\n if (points.length === 0) {\n return (\n <div ref={wrapRef} className={cls}>\n {empty === undefined ? (\n <EmptyState\n title={emptyTitle ?? strings.paretoEmptyTitle}\n description={emptyDescription}\n />\n ) : (\n <div\n className=\"aegis-pareto__empty\"\n style={\n {\n '--aegis-pareto-min-height': `${MIN_HEIGHT.toString()}px`,\n } as CSSProperties\n }\n >\n {empty}\n </div>\n )}\n </div>\n );\n }\n\n if (!geometry) {\n return <div ref={wrapRef} className={cls} />;\n }\n\n const { height, left, right, top, bottom, sx, sy, front, frontKeys } =\n geometry;\n const selectOnKey = (event: KeyboardEvent<SVGCircleElement>, key: string) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onSelect?.(key);\n }\n };\n\n return (\n <div ref={wrapRef} className={cls}>\n <svg\n className=\"aegis-pareto__svg\"\n width={width}\n height={height}\n viewBox={`0 0 ${width.toString()} ${height.toString()}`}\n role={onSelect ? 'group' : 'img'}\n aria-label={strings.paretoChartLabel(xLabel, yLabel)}\n style={{ '--aegis-pareto-count': points.length } as CSSProperties}\n >\n {geometry.gridY.map((y) => (\n <line\n key={`gy-${y.toString()}`}\n className=\"aegis-pareto__grid\"\n x1={left}\n y1={y}\n x2={right}\n y2={y}\n />\n ))}\n {geometry.gridX.map((x) => (\n <line\n key={`gx-${x.toString()}`}\n className=\"aegis-pareto__grid\"\n x1={x}\n y1={top}\n x2={x}\n y2={bottom}\n />\n ))}\n <line\n className=\"aegis-pareto__axis\"\n x1={left}\n y1={bottom}\n x2={right}\n y2={bottom}\n />\n <line\n className=\"aegis-pareto__axis\"\n x1={left}\n y1={top}\n x2={left}\n y2={bottom}\n />\n {front.length > 1 && (\n <polyline\n className=\"aegis-pareto__front\"\n points={front\n .map(\n (point) =>\n `${sx(point.x).toString()},${sy(point.y).toString()}`,\n )\n .join(' ')}\n />\n )}\n {points.map((point, index) => (\n <circle\n key={point.key}\n className={[\n 'aegis-pareto__point',\n frontKeys.has(point.key) ? '' : 'aegis-pareto__point--dominated',\n onSelect ? 'aegis-pareto__point--interactive' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n {\n fill: point.color,\n '--aegis-pareto-index': index,\n } as CSSProperties\n }\n cx={sx(point.x)}\n cy={sy(point.y)}\n r={POINT_RADIUS}\n role={onSelect ? 'button' : undefined}\n tabIndex={onSelect ? 0 : undefined}\n aria-label={onSelect ? point.label : undefined}\n onClick={\n onSelect\n ? () => {\n onSelect(point.key);\n }\n : undefined\n }\n onKeyDown={\n onSelect\n ? (event) => {\n selectOnKey(event, point.key);\n }\n : undefined\n }\n >\n <title>{point.label}</title>\n </circle>\n ))}\n {front.map((point) => {\n const x = sx(point.x);\n const y = sy(point.y);\n const flip = x > left + (right - left) * 0.7;\n return (\n <text\n key={`label-${point.key}`}\n className=\"aegis-pareto__point-label\"\n x={flip ? x - LABEL_GAP : x + LABEL_GAP}\n y={y < top + LABEL_GAP * 2 ? y + LABEL_GAP * 2 : y - LABEL_GAP}\n textAnchor={flip ? 'end' : 'start'}\n >\n {point.label}\n </text>\n );\n })}\n <text\n className=\"aegis-pareto__tick\"\n x={left}\n y={bottom + LABEL_GAP * 2}\n textAnchor=\"middle\"\n >\n {formatX(geometry.xLo)}\n </text>\n <text\n className=\"aegis-pareto__tick\"\n x={right}\n y={bottom + LABEL_GAP * 2}\n textAnchor=\"end\"\n >\n {formatX(geometry.xHi)}\n </text>\n <text\n className=\"aegis-pareto__tick\"\n x={left - LABEL_GAP}\n y={bottom}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n >\n {formatY(geometry.yLo)}\n </text>\n <text\n className=\"aegis-pareto__tick\"\n x={left - LABEL_GAP}\n y={top}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n >\n {formatY(geometry.yHi)}\n </text>\n <text\n className=\"aegis-pareto__axis-label\"\n x={right}\n y={height - LABEL_GAP}\n textAnchor=\"end\"\n >\n {xLabel}\n </text>\n <text\n className=\"aegis-pareto__axis-label\"\n x={left - LABEL_GAP}\n y={top - LABEL_GAP * 2}\n textAnchor=\"start\"\n >\n {yLabel}\n </text>\n </svg>\n {legend !== undefined && legend.length > 0 ? (\n <ul\n className=\"aegis-pareto__legend\"\n style={\n {\n '--aegis-pareto-swatch': `${(POINT_RADIUS * 2).toString()}px`,\n } as CSSProperties\n }\n >\n {legend.map((item) => (\n <li key={item.key} className=\"aegis-pareto__legend-item\">\n <span\n className=\"aegis-pareto__swatch\"\n style={item.color ? { background: item.color } : undefined}\n aria-hidden=\"true\"\n />\n {item.label}\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n"],"names":["MAX_HEIGHT","MIN_HEIGHT","PAD_LEFT","PAD_RIGHT","PAD_TOP","PAD_BOTTOM","POINT_RADIUS","LABEL_GAP","GRID_STEPS","better","b","direction","zeroAnchoredDomain","values","lo","hi","ParetoChart","points","xLabel","yLabel","xDirection","yDirection","formatX","formatY","onSelect","legend","empty","emptyTitle","emptyDescription","className","strings","useStrings","wrapRef","useRef","width","useElementWidth","cls","geometry","useMemo","height","xLo","xHi","point","yLo","yHi","left","right","top","bottom","sx","value","sy","front","candidate","other","a","steps","_","i","jsx","EmptyState","frontKeys","selectOnKey","event","key","jsxs","y","x","index","flip","item"],"mappings":"mSAuDMA,GAAa,IACbC,EAAa,IACbC,GAAW,GACXC,GAAY,GACZC,GAAU,GACVC,GAAa,GACbC,EAAe,EACfC,EAAY,EACZC,EAAa,EAInB,SAASC,EAAO,EAAWC,EAAWC,EAA+B,CACnE,OAAOA,IAAc,QAAU,EAAID,EAAI,EAAIA,CAC7C,CAGA,SAASE,EAAmBC,EAAoC,CAC9D,MAAMC,EAAK,KAAK,IAAI,EAAG,GAAGD,CAAM,EAC1BE,EAAK,KAAK,IAAI,EAAG,GAAGF,CAAM,EAChC,OAAOE,IAAOD,EAAK,CAACA,EAAIA,EAAK,CAAC,EAAI,CAACA,EAAIC,CAAE,CAC3C,CAEO,SAASC,GAAY,CAC1B,OAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EAAa,QACb,WAAAC,EAAa,SACb,QAAAC,EAAU,OACV,QAAAC,EAAU,OACV,SAAAC,EACA,OAAAC,EACA,MAAAC,EACA,WAAAC,EACA,iBAAAC,EACA,UAAAC,CACF,EAAqB,CACnB,MAAMC,EAAUC,EAAAA,WAAA,EACVC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAQC,EAAAA,gBAAgBH,CAAO,EAC/BI,EAAM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P,EAAShC,EACZ,WAAW,MAEV,SAAAW,CAAA,CAAA,EAEHyC,EAAAA,IAAC,OAAA,CACC,UAAU,2BACV,EAAGd,EAAOtC,EACV,EAAGwC,EAAMxC,EAAY,EACrB,WAAW,QAEV,SAAAY,CAAA,CAAA,CACH,CAAA,CAAA,EAEDM,IAAW,QAAaA,EAAO,OAAS,EACvCkC,EAAAA,IAAC,KAAA,CACC,UAAU,uBACV,MACE,CACE,wBAAyB,IAAIrD,EAAe,GAAG,UAAU,IAAA,EAI5D,WAAO,IAAKgE,GACXL,OAAC,KAAA,CAAkB,UAAU,4BAC3B,SAAA,CAAAN,EAAAA,IAAC,OAAA,CACC,UAAU,uBACV,MAAOW,EAAK,MAAQ,CAAE,WAAYA,EAAK,OAAU,OACjD,cAAY,MAAA,CAAA,EAEbA,EAAK,KAAA,CAAA,EANCA,EAAK,GAOd,CACD,CAAA,CAAA,EAED,IAAA,EACN,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ParetoChart.cjs","sources":["../../../src/components/ui/ParetoChart.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n} from 'react';\n\nimport { useElementWidth } from '../../hooks/useElementWidth';\nimport {\n type ChartColor,\n chartColorValue,\n staggeredProgress,\n zeroAnchoredDomain,\n} from '../../lib/chart';\nimport { useStrings } from '../../locale';\nimport { ChartLegend } from './ChartLegend';\nimport { EmptyState } from './EmptyState';\nimport './ParetoChart.css';\n\nexport interface ParetoPoint {\n key: string;\n label: string;\n x: number;\n y: number;\n /** Point fill, e.g. `cat-2` or a series token, to match the series elsewhere. */\n color?: ChartColor;\n}\n\n/** One series in the legend under the plot, e.g. a model and its colour. */\nexport interface ParetoLegendItem {\n key: string;\n label: ReactNode;\n /** Swatch fill; the same value its points use. */\n color?: ChartColor;\n}\n\ninterface ParetoChartProps {\n points: ParetoPoint[];\n xLabel: string;\n yLabel: string;\n /** Which direction counts as better on each axis. */\n xDirection?: 'lower' | 'higher';\n yDirection?: 'lower' | 'higher';\n /** Formats the labels of each axis. */\n formatX?: (value: number) => string;\n formatY?: (value: number) => string;\n /**\n * `log` spaces the horizontal axis by ratio, e.g. for a cost that spans\n * orders of magnitude; its values must be above 0. Defaults to `linear`.\n */\n xScale?: 'linear' | 'log';\n /** The ends of each axis. Defaults to from 0, or the data's own range on a log axis. */\n xDomain?: [number, number];\n yDomain?: [number, number];\n /**\n * The labelled gridlines of each axis. Defaults to plain gridlines with\n * labels at the two ends.\n */\n xTicks?: number[];\n yTicks?: number[];\n /**\n * Which points carry their name. `front` names the frontier; `all` names\n * every point, so the chart needs no legend. A plot too narrow for them\n * names the frontier and `highlightKeys` and lists every point under it.\n * Defaults to `front`.\n */\n labels?: 'front' | 'all';\n /** Fades the points off the frontier. Defaults to true. */\n fadeDominated?: boolean;\n /** Fades every other point, to pick out the ones a finding is about. */\n highlightKeys?: string[];\n /** The tallest the plot grows. */\n maxHeight?: number;\n onSelect?: (key: string) => void;\n /** Series swatches with labels, listed under the plot. */\n legend?: ParetoLegendItem[];\n /**\n * Shown in place of the plot, at its minimum height, while there are no\n * points — e.g. an EmptyState with an icon asking for both axes. Replaces\n * the default empty state built from `emptyTitle`.\n */\n empty?: ReactNode;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * How far the chart is drawn, 0 to 1, for a chart that draws as its\n * section scrolls in (`useScrollProgress`): points fade in from left to\n * right, then the frontier. Omitted, they fade in once on mount.\n */\n progress?: number;\n /**\n * How far the frontier is traced, 0 to 1, for a host that draws it apart\n * from the points, such as one step of a scrolling story.\n */\n frontProgress?: number;\n className?: string;\n}\n\n// The SVG is drawn at its measured CSS width, so these are true px.\nconst MAX_HEIGHT = 320;\nconst MIN_HEIGHT = 220;\nconst PAD_LEFT = 56;\nconst PAD_RIGHT = 16;\nconst PAD_TOP = 28;\nconst PAD_BOTTOM = 44;\nconst POINT_RADIUS = 5;\nconst LABEL_GAP = 8;\nconst GRID_STEPS = 4;\n// Estimates for placing labels: --fs-11 text, and the width below which\n// `labels='all'` would crowd the plot.\nconst LABEL_CHAR = 6.2;\nconst LABEL_WIDE_CHAR = 11;\nconst LABEL_LINE = 14;\nconst ALL_LABELS_MIN_WIDTH = 520;\n\ntype Direction = 'lower' | 'higher';\n\nfunction better(a: number, b: number, direction: Direction): boolean {\n return direction === 'lower' ? a < b : a > b;\n}\n\ninterface LabelBox {\n x: number;\n y: number;\n anchor: 'start' | 'end';\n}\n\nfunction labelWidth(text: string): number {\n return [...text].reduce(\n (sum, char) =>\n sum + ((char.codePointAt(0) ?? 0) > 255 ? LABEL_WIDE_CHAR : LABEL_CHAR),\n 0,\n );\n}\n\n/**\n * Puts each label beside its point on the first side where it stays on the\n * plot and clear of the labels already placed and of the other points.\n */\nfunction placeLabels(\n labelled: Array<{ key: string; label: string; x: number; y: number }>,\n allPoints: Array<{ key: string; x: number; y: number }>,\n bounds: { left: number; right: number; top: number; bottom: number },\n): Map<string, LabelBox> {\n const placed: Array<{ l: number; r: number; t: number; b: number }> = [];\n const result = new Map<string, LabelBox>();\n const reach = POINT_RADIUS + LABEL_GAP / 2;\n for (const point of labelled) {\n const w = labelWidth(point.label);\n const candidates: LabelBox[] = [\n { x: point.x + reach, y: point.y + LABEL_LINE / 3, anchor: 'start' },\n { x: point.x - reach, y: point.y + LABEL_LINE / 3, anchor: 'end' },\n { x: point.x - w / 2, y: point.y - reach, anchor: 'start' },\n { x: point.x - w / 2, y: point.y + reach + LABEL_LINE, anchor: 'start' },\n ];\n const box = (candidate: LabelBox) => {\n const l = candidate.anchor === 'end' ? candidate.x - w : candidate.x;\n return {\n l,\n r: l + w,\n t: candidate.y - LABEL_LINE,\n b: candidate.y,\n };\n };\n const onPlot = (candidate: LabelBox): boolean => {\n const { l, r, t, b } = box(candidate);\n return (\n l >= bounds.left &&\n r <= bounds.right &&\n t >= bounds.top &&\n b <= bounds.bottom\n );\n };\n const clear = (candidate: LabelBox): boolean => {\n const { l, r, t, b } = box(candidate);\n return (\n onPlot(candidate) &&\n placed.every(\n (other) => r < other.l || l > other.r || b < other.t || t > other.b,\n ) &&\n allPoints.every(\n (other) =>\n other.key === point.key ||\n other.x + POINT_RADIUS < l ||\n other.x - POINT_RADIUS > r ||\n other.y + POINT_RADIUS < t ||\n other.y - POINT_RADIUS > b,\n )\n );\n };\n // With no side free the label still stays on the plot, towards its middle.\n const chosen =\n candidates.find(clear) ??\n candidates.find(onPlot) ??\n candidates[point.x > (bounds.left + bounds.right) / 2 ? 1 : 0];\n placed.push(box(chosen));\n result.set(point.key, chosen);\n }\n return result;\n}\n\nexport function ParetoChart({\n points,\n xLabel,\n yLabel,\n xDirection = 'lower',\n yDirection = 'higher',\n formatX = String,\n formatY = String,\n xScale = 'linear',\n xDomain,\n yDomain,\n xTicks,\n yTicks,\n labels = 'front',\n fadeDominated = true,\n highlightKeys,\n maxHeight = MAX_HEIGHT,\n onSelect,\n legend,\n empty,\n emptyTitle,\n emptyDescription,\n progress,\n frontProgress,\n className,\n}: ParetoChartProps) {\n const strings = useStrings();\n const clipId = useId();\n const wrapRef = useRef<HTMLDivElement>(null);\n const width = useElementWidth(wrapRef);\n const cls = [\n 'aegis-pareto',\n progress === undefined && frontProgress === undefined\n ? ''\n : 'aegis-pareto--scroll',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const geometry = useMemo(() => {\n if (points.length === 0 || width === 0) {\n return null;\n }\n const height = Math.round(\n Math.min(maxHeight, Math.max(MIN_HEIGHT, width / 2)),\n );\n const xValues = points.map((point) => point.x);\n const logLo = Math.min(...xValues);\n const logHi = Math.max(...xValues);\n const [xLo, xHi] =\n xDomain ??\n (xScale === 'log'\n ? // One value has no span to divide, so it sits mid-axis.\n ([\n logHi > logLo ? logLo : logLo / 2,\n logHi > logLo ? logHi : logHi * 2,\n ] as const)\n : zeroAnchoredDomain(xValues));\n const [yLo, yHi] =\n yDomain ?? zeroAnchoredDomain(points.map((point) => point.y));\n const scaleX = xScale === 'log' ? Math.log10 : (value: number) => value;\n const left = PAD_LEFT;\n const right = width - PAD_RIGHT;\n const top = PAD_TOP;\n const bottom = height - PAD_BOTTOM;\n const sx = (value: number): number =>\n left +\n ((scaleX(value) - scaleX(xLo)) / (scaleX(xHi) - scaleX(xLo))) *\n (right - left);\n const sy = (value: number): number =>\n bottom - ((value - yLo) / (yHi - yLo)) * (bottom - top);\n const front = points\n .filter(\n (candidate) =>\n !points.some(\n (other) =>\n other.key !== candidate.key &&\n (better(other.x, candidate.x, xDirection) ||\n other.x === candidate.x) &&\n (better(other.y, candidate.y, yDirection) ||\n other.y === candidate.y) &&\n (better(other.x, candidate.x, xDirection) ||\n better(other.y, candidate.y, yDirection)),\n ),\n )\n .sort((a, b) => a.x - b.x);\n const steps = Array.from(\n { length: GRID_STEPS },\n (_, i) => (i + 1) / GRID_STEPS,\n );\n // Points draw in from left to right; the frontier comes last.\n const order = new Map(\n [...points]\n .sort((a, b) => sx(a.x) - sx(b.x))\n .map((point, rank) => [point.key, rank]),\n );\n return {\n height,\n order,\n left,\n right,\n top,\n bottom,\n sx,\n sy,\n front,\n frontKeys: new Set(front.map((point) => point.key)),\n // Even shares of the plot, which on a log axis are even ratios.\n gridX: xTicks?.map(sx) ?? steps.map((t) => left + (right - left) * t),\n gridY: yTicks?.map(sy) ?? steps.map((t) => sy(yLo + (yHi - yLo) * t)),\n xLabels: xTicks ?? [xLo, xHi],\n yLabels: yTicks ?? [yLo, yHi],\n };\n }, [\n points,\n width,\n xDirection,\n yDirection,\n xScale,\n xDomain,\n yDomain,\n xTicks,\n yTicks,\n maxHeight,\n ]);\n\n if (points.length === 0) {\n return (\n <div ref={wrapRef} className={cls}>\n {empty === undefined ? (\n <EmptyState\n title={emptyTitle ?? strings.paretoEmptyTitle}\n description={emptyDescription}\n />\n ) : (\n <div\n className=\"aegis-pareto__empty\"\n style={\n {\n '--aegis-pareto-min-height': `${MIN_HEIGHT.toString()}px`,\n } as CSSProperties\n }\n >\n {empty}\n </div>\n )}\n </div>\n );\n }\n\n if (!geometry) {\n return <div ref={wrapRef} className={cls} />;\n }\n\n const { height, left, right, top, bottom, sx, sy, front, frontKeys } =\n geometry;\n const highlighted =\n highlightKeys === undefined ? null : new Set(highlightKeys);\n const dimmed = (key: string): boolean =>\n highlighted !== null && !highlighted.has(key);\n const showAllLabels = labels === 'all' && width >= ALL_LABELS_MIN_WIDTH;\n const labelBoxes = placeLabels(\n points\n .filter(\n (point) =>\n showAllLabels ||\n frontKeys.has(point.key) ||\n (highlighted?.has(point.key) ?? false),\n )\n .map((point) => ({\n key: point.key,\n label: point.label,\n x: sx(point.x),\n y: sy(point.y),\n })),\n points.map((point) => ({\n key: point.key,\n x: sx(point.x),\n y: sy(point.y),\n })),\n // A label may run up into the space above the plot.\n { left, right, top: 0, bottom },\n );\n // A plot too narrow to name every point names them under it instead, so\n // none is left to a tooltip a phone cannot show.\n const legendItems =\n legend?.map((item) => ({\n key: item.key,\n label: item.label,\n color: item.color ?? ('var(--bg-inverted)' as const),\n })) ??\n (labels === 'all' && !showAllLabels\n ? points.map((point) => ({\n key: point.key,\n label: point.label,\n color: point.color ?? ('var(--bg-inverted)' as const),\n }))\n : []);\n const frontDrawn =\n frontProgress ??\n (progress === undefined\n ? undefined\n : staggeredProgress(progress, points.length, points.length + 1));\n const selectOnKey = (event: KeyboardEvent<SVGCircleElement>, key: string) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onSelect?.(key);\n }\n };\n\n return (\n <div ref={wrapRef} className={cls}>\n <svg\n className=\"aegis-pareto__svg\"\n width={width}\n height={height}\n viewBox={`0 0 ${width.toString()} ${height.toString()}`}\n role={onSelect ? 'group' : 'img'}\n aria-label={strings.paretoChartLabel(xLabel, yLabel)}\n style={\n {\n '--aegis-pareto-count': points.length,\n ...(frontDrawn === undefined\n ? {}\n : { '--aegis-pareto-front-progress': frontDrawn }),\n } as CSSProperties\n }\n >\n {geometry.gridY.map((y) => (\n <line\n key={`gy-${y.toString()}`}\n className=\"aegis-pareto__grid\"\n x1={left}\n y1={y}\n x2={right}\n y2={y}\n />\n ))}\n {geometry.gridX.map((x) => (\n <line\n key={`gx-${x.toString()}`}\n className=\"aegis-pareto__grid\"\n x1={x}\n y1={top}\n x2={x}\n y2={bottom}\n />\n ))}\n <line\n className=\"aegis-pareto__axis\"\n x1={left}\n y1={bottom}\n x2={right}\n y2={bottom}\n />\n <line\n className=\"aegis-pareto__axis\"\n x1={left}\n y1={top}\n x2={left}\n y2={bottom}\n />\n {frontDrawn !== undefined && (\n <clipPath id={clipId}>\n <rect\n x={left}\n y={0}\n width={(right - left) * frontDrawn}\n height={height}\n />\n </clipPath>\n )}\n {front.length > 1 && (\n <polyline\n className=\"aegis-pareto__front\"\n clipPath={frontDrawn === undefined ? undefined : `url(#${clipId})`}\n points={front\n .map(\n (point) =>\n `${sx(point.x).toString()},${sy(point.y).toString()}`,\n )\n .join(' ')}\n />\n )}\n {points.map((point, index) => (\n <circle\n key={point.key}\n className={[\n 'aegis-pareto__point',\n fadeDominated && !frontKeys.has(point.key)\n ? 'aegis-pareto__point--dominated'\n : '',\n dimmed(point.key) ? 'aegis-pareto__point--dimmed' : '',\n onSelect ? 'aegis-pareto__point--interactive' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n {\n fill:\n point.color === undefined\n ? undefined\n : chartColorValue(point.color),\n '--aegis-pareto-index': index,\n '--aegis-pareto-point-progress':\n progress === undefined\n ? 1\n : staggeredProgress(\n progress,\n geometry.order.get(point.key) ?? index,\n points.length + 1,\n ),\n } as CSSProperties\n }\n cx={sx(point.x)}\n cy={sy(point.y)}\n r={POINT_RADIUS}\n role={onSelect ? 'button' : undefined}\n tabIndex={onSelect ? 0 : undefined}\n aria-label={onSelect ? point.label : undefined}\n onClick={\n onSelect\n ? () => {\n onSelect(point.key);\n }\n : undefined\n }\n onKeyDown={\n onSelect\n ? (event) => {\n selectOnKey(event, point.key);\n }\n : undefined\n }\n >\n <title>{point.label}</title>\n </circle>\n ))}\n {points.map((point) => {\n const box = labelBoxes.get(point.key);\n return box === undefined ? null : (\n <text\n key={`label-${point.key}`}\n className={[\n 'aegis-pareto__point-label',\n dimmed(point.key) ? 'aegis-pareto__point-label--dimmed' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n labels === 'all'\n ? ({\n '--aegis-pareto-front-progress':\n progress === undefined\n ? 1\n : staggeredProgress(\n progress,\n geometry.order.get(point.key) ?? 0,\n points.length + 1,\n ),\n } as CSSProperties)\n : undefined\n }\n x={box.x}\n y={box.y}\n textAnchor={box.anchor}\n >\n {point.label}\n </text>\n );\n })}\n {geometry.xLabels.map((value, index) => (\n <text\n key={`x-${value.toString()}`}\n className=\"aegis-pareto__tick\"\n x={sx(value)}\n y={bottom + LABEL_GAP * 2}\n textAnchor={\n index === geometry.xLabels.length - 1 && sx(value) >= right - 1\n ? 'end'\n : 'middle'\n }\n >\n {formatX(value)}\n </text>\n ))}\n {geometry.yLabels.map((value) => (\n <text\n key={`y-${value.toString()}`}\n className=\"aegis-pareto__tick\"\n x={left - LABEL_GAP}\n y={sy(value)}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n >\n {formatY(value)}\n </text>\n ))}\n <text\n className=\"aegis-pareto__axis-label\"\n x={right}\n y={height - LABEL_GAP}\n textAnchor=\"end\"\n >\n {xLabel}\n </text>\n <text\n className=\"aegis-pareto__axis-label\"\n x={left - LABEL_GAP}\n y={top - LABEL_GAP * 2}\n textAnchor=\"start\"\n >\n {yLabel}\n </text>\n </svg>\n {legendItems.length > 0 ? (\n <ChartLegend\n className=\"aegis-pareto__legend\"\n shape=\"dot\"\n items={legendItems}\n />\n ) : null}\n </div>\n );\n}\n"],"names":["MAX_HEIGHT","MIN_HEIGHT","PAD_LEFT","PAD_RIGHT","PAD_TOP","PAD_BOTTOM","POINT_RADIUS","LABEL_GAP","GRID_STEPS","LABEL_CHAR","LABEL_WIDE_CHAR","LABEL_LINE","ALL_LABELS_MIN_WIDTH","better","a","b","direction","labelWidth","text","sum","char","placeLabels","labelled","allPoints","bounds","placed","result","reach","point","w","candidates","box","candidate","l","onPlot","r","t","clear","other","chosen","ParetoChart","points","xLabel","yLabel","xDirection","yDirection","formatX","formatY","xScale","xDomain","yDomain","xTicks","yTicks","labels","fadeDominated","highlightKeys","maxHeight","onSelect","legend","empty","emptyTitle","emptyDescription","progress","frontProgress","className","strings","useStrings","clipId","useId","wrapRef","useRef","width","useElementWidth","cls","geometry","useMemo","height","xValues","logLo","logHi","xLo","xHi","zeroAnchoredDomain","yLo","yHi","scaleX","value","left","right","top","bottom","sx","sy","front","steps","_","i","order","rank","jsx","EmptyState","frontKeys","highlighted","dimmed","key","showAllLabels","labelBoxes","legendItems","item","frontDrawn","staggeredProgress","selectOnKey","event","jsxs","y","x","index","chartColorValue","ChartLegend"],"mappings":"wWAqGMA,GAAa,IACbC,GAAa,IACbC,GAAW,GACXC,GAAY,GACZC,GAAU,GACVC,GAAa,GACbC,EAAe,EACfC,EAAY,EACZC,GAAa,EAGbC,GAAa,IACbC,GAAkB,GAClBC,EAAa,GACbC,GAAuB,IAI7B,SAASC,EAAOC,EAAWC,EAAWC,EAA+B,CACnE,OAAOA,IAAc,QAAUF,EAAIC,EAAID,EAAIC,CAC7C,CAQA,SAASE,GAAWC,EAAsB,CACxC,MAAO,CAAC,GAAGA,CAAI,EAAE,OACf,CAACC,EAAKC,IACJD,IAAQC,EAAK,YAAY,CAAC,GAAK,GAAK,IAAMV,GAAkBD,IAC9D,CAAA,CAEJ,CAMA,SAASY,GACPC,EACAC,EACAC,EACuB,CACvB,MAAMC,EAAgE,CAAA,EAChEC,MAAa,IACbC,EAAQrB,EAAeC,EAAY,EACzC,UAAWqB,KAASN,EAAU,CAC5B,MAAMO,EAAIZ,GAAWW,EAAM,KAAK,EAC1BE,EAAyB,CAC7B,CAAE,EAAGF,EAAM,EAAID,EAAO,EAAGC,EAAM,EAAIjB,EAAa,EAAG,OAAQ,OAAA,EAC3D,CAAE,EAAGiB,EAAM,EAAID,EAAO,EA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CAAA,EAVT,KAAKA,EAAM,UAAU,EAAA,CAY7B,EACAZ,EAAS,QAAQ,IAAKY,GACrBa,EAAAA,IAAC,OAAA,CAEC,UAAU,qBACV,EAAGZ,EAAOhF,EACV,EAAGqF,EAAGN,CAAK,EACX,WAAW,MACX,iBAAiB,SAEhB,WAAQA,CAAK,CAAA,EAPT,KAAKA,EAAM,UAAU,EAAA,CAS7B,EACDa,EAAAA,IAAC,OAAA,CACC,UAAU,2BACV,EAAGX,EACH,EAAGZ,EAASrE,EACZ,WAAW,MAEV,SAAAmC,CAAA,CAAA,EAEHyD,EAAAA,IAAC,OAAA,CACC,UAAU,2BACV,EAAGZ,EAAOhF,EACV,EAAGkF,EAAMlF,EAAY,EACrB,WAAW,QAEV,SAAAoC,CAAA,CAAA,CACH,CAAA,CAAA,EAEDgE,GAAY,OAAS,EACpBR,EAAAA,IAACmB,GAAAA,YAAA,CACC,UAAU,uBACV,MAAM,MACN,MAAOX,EAAA,CAAA,EAEP,IAAA,EACN,CAEJ"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ChartColor } from '../../lib/chart';
|
|
2
3
|
export interface ParetoPoint {
|
|
3
4
|
key: string;
|
|
4
5
|
label: string;
|
|
5
6
|
x: number;
|
|
6
7
|
y: number;
|
|
7
|
-
/** Point fill, e.g. `
|
|
8
|
-
color?:
|
|
8
|
+
/** Point fill, e.g. `cat-2` or a series token, to match the series elsewhere. */
|
|
9
|
+
color?: ChartColor;
|
|
9
10
|
}
|
|
10
11
|
/** One series in the legend under the plot, e.g. a model and its colour. */
|
|
11
12
|
export interface ParetoLegendItem {
|
|
12
13
|
key: string;
|
|
13
14
|
label: ReactNode;
|
|
14
15
|
/** Swatch fill; the same value its points use. */
|
|
15
|
-
color?:
|
|
16
|
+
color?: ChartColor;
|
|
16
17
|
}
|
|
17
18
|
interface ParetoChartProps {
|
|
18
19
|
points: ParetoPoint[];
|
|
@@ -21,9 +22,36 @@ interface ParetoChartProps {
|
|
|
21
22
|
/** Which direction counts as better on each axis. */
|
|
22
23
|
xDirection?: 'lower' | 'higher';
|
|
23
24
|
yDirection?: 'lower' | 'higher';
|
|
24
|
-
/** Formats the
|
|
25
|
+
/** Formats the labels of each axis. */
|
|
25
26
|
formatX?: (value: number) => string;
|
|
26
27
|
formatY?: (value: number) => string;
|
|
28
|
+
/**
|
|
29
|
+
* `log` spaces the horizontal axis by ratio, e.g. for a cost that spans
|
|
30
|
+
* orders of magnitude; its values must be above 0. Defaults to `linear`.
|
|
31
|
+
*/
|
|
32
|
+
xScale?: 'linear' | 'log';
|
|
33
|
+
/** The ends of each axis. Defaults to from 0, or the data's own range on a log axis. */
|
|
34
|
+
xDomain?: [number, number];
|
|
35
|
+
yDomain?: [number, number];
|
|
36
|
+
/**
|
|
37
|
+
* The labelled gridlines of each axis. Defaults to plain gridlines with
|
|
38
|
+
* labels at the two ends.
|
|
39
|
+
*/
|
|
40
|
+
xTicks?: number[];
|
|
41
|
+
yTicks?: number[];
|
|
42
|
+
/**
|
|
43
|
+
* Which points carry their name. `front` names the frontier; `all` names
|
|
44
|
+
* every point, so the chart needs no legend. A plot too narrow for them
|
|
45
|
+
* names the frontier and `highlightKeys` and lists every point under it.
|
|
46
|
+
* Defaults to `front`.
|
|
47
|
+
*/
|
|
48
|
+
labels?: 'front' | 'all';
|
|
49
|
+
/** Fades the points off the frontier. Defaults to true. */
|
|
50
|
+
fadeDominated?: boolean;
|
|
51
|
+
/** Fades every other point, to pick out the ones a finding is about. */
|
|
52
|
+
highlightKeys?: string[];
|
|
53
|
+
/** The tallest the plot grows. */
|
|
54
|
+
maxHeight?: number;
|
|
27
55
|
onSelect?: (key: string) => void;
|
|
28
56
|
/** Series swatches with labels, listed under the plot. */
|
|
29
57
|
legend?: ParetoLegendItem[];
|
|
@@ -35,7 +63,18 @@ interface ParetoChartProps {
|
|
|
35
63
|
empty?: ReactNode;
|
|
36
64
|
emptyTitle?: string;
|
|
37
65
|
emptyDescription?: string;
|
|
66
|
+
/**
|
|
67
|
+
* How far the chart is drawn, 0 to 1, for a chart that draws as its
|
|
68
|
+
* section scrolls in (`useScrollProgress`): points fade in from left to
|
|
69
|
+
* right, then the frontier. Omitted, they fade in once on mount.
|
|
70
|
+
*/
|
|
71
|
+
progress?: number;
|
|
72
|
+
/**
|
|
73
|
+
* How far the frontier is traced, 0 to 1, for a host that draws it apart
|
|
74
|
+
* from the points, such as one step of a scrolling story.
|
|
75
|
+
*/
|
|
76
|
+
frontProgress?: number;
|
|
38
77
|
className?: string;
|
|
39
78
|
}
|
|
40
|
-
export declare function ParetoChart({ points, xLabel, yLabel, xDirection, yDirection, formatX, formatY, onSelect, legend, empty, emptyTitle, emptyDescription, className, }: ParetoChartProps): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export declare function ParetoChart({ points, xLabel, yLabel, xDirection, yDirection, formatX, formatY, xScale, xDomain, yDomain, xTicks, yTicks, labels, fadeDominated, highlightKeys, maxHeight, onSelect, legend, empty, emptyTitle, emptyDescription, progress, frontProgress, className, }: ParetoChartProps): import("react/jsx-runtime").JSX.Element;
|
|
41
80
|
export {};
|