minerva-design 1.2.0 → 1.3.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 +7 -0
- package/dist/charts/canvas.d.cts +4 -1
- package/dist/charts/canvas.d.ts +4 -1
- package/dist/charts/core.cjs +1 -1
- package/dist/charts/core.d.cts +5 -2
- package/dist/charts/core.d.ts +5 -2
- package/dist/charts/core.js +6 -4
- package/dist/charts/engine/canvas.cjs +1 -1
- package/dist/charts/engine/canvas.cjs.map +1 -1
- package/dist/charts/engine/canvas.js +65 -53
- package/dist/charts/engine/canvas.js.map +1 -1
- package/dist/charts/engine/chart.cjs +1 -2
- package/dist/charts/engine/chart.cjs.map +1 -1
- package/dist/charts/engine/chart.js +342 -323
- package/dist/charts/engine/chart.js.map +1 -1
- package/dist/charts/engine/color.cjs +1 -1
- package/dist/charts/engine/color.cjs.map +1 -1
- package/dist/charts/engine/color.d.cts +17 -0
- package/dist/charts/engine/color.d.ts +17 -0
- package/dist/charts/engine/color.js +27 -3
- package/dist/charts/engine/color.js.map +1 -1
- package/dist/charts/engine/controller.cjs +2 -2
- package/dist/charts/engine/controller.cjs.map +1 -1
- package/dist/charts/engine/controller.d.cts +6 -0
- package/dist/charts/engine/controller.d.ts +6 -0
- package/dist/charts/engine/controller.js +317 -253
- package/dist/charts/engine/controller.js.map +1 -1
- package/dist/charts/engine/curve.cjs +2 -0
- package/dist/charts/engine/curve.cjs.map +1 -0
- package/dist/charts/engine/curve.d.cts +15 -0
- package/dist/charts/engine/curve.d.ts +15 -0
- package/dist/charts/engine/curve.js +56 -0
- package/dist/charts/engine/curve.js.map +1 -0
- package/dist/charts/engine/data.cjs +1 -1
- package/dist/charts/engine/data.cjs.map +1 -1
- package/dist/charts/engine/data.d.cts +15 -2
- package/dist/charts/engine/data.d.ts +15 -2
- package/dist/charts/engine/data.js +98 -38
- package/dist/charts/engine/data.js.map +1 -1
- package/dist/charts/engine/dom.cjs +1 -1
- package/dist/charts/engine/dom.cjs.map +1 -1
- package/dist/charts/engine/dom.d.cts +5 -3
- package/dist/charts/engine/dom.d.ts +5 -3
- package/dist/charts/engine/dom.js +27 -22
- package/dist/charts/engine/dom.js.map +1 -1
- package/dist/charts/engine/items.cjs +1 -1
- package/dist/charts/engine/items.cjs.map +1 -1
- package/dist/charts/engine/items.js +132 -61
- package/dist/charts/engine/items.js.map +1 -1
- package/dist/charts/engine/model.cjs +1 -1
- package/dist/charts/engine/model.cjs.map +1 -1
- package/dist/charts/engine/model.d.cts +30 -3
- package/dist/charts/engine/model.d.ts +30 -3
- package/dist/charts/engine/model.js +225 -108
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/overlay.cjs +1 -1
- package/dist/charts/engine/overlay.cjs.map +1 -1
- package/dist/charts/engine/overlay.d.cts +2 -0
- package/dist/charts/engine/overlay.d.ts +2 -0
- package/dist/charts/engine/overlay.js +16 -16
- package/dist/charts/engine/overlay.js.map +1 -1
- package/dist/charts/engine/presets.cjs +2 -2
- package/dist/charts/engine/presets.cjs.map +1 -1
- package/dist/charts/engine/presets.d.cts +71 -5
- package/dist/charts/engine/presets.d.ts +71 -5
- package/dist/charts/engine/presets.js +120 -33
- package/dist/charts/engine/presets.js.map +1 -1
- package/dist/charts/engine/renderers/canvas2d.cjs +1 -1
- package/dist/charts/engine/renderers/canvas2d.cjs.map +1 -1
- package/dist/charts/engine/renderers/canvas2d.js +149 -111
- package/dist/charts/engine/renderers/canvas2d.js.map +1 -1
- package/dist/charts/engine/renderers/range.cjs +1 -1
- package/dist/charts/engine/renderers/range.cjs.map +1 -1
- package/dist/charts/engine/renderers/range.js +4 -4
- package/dist/charts/engine/renderers/range.js.map +1 -1
- package/dist/charts/engine/renderers/shaders.cjs +37 -19
- package/dist/charts/engine/renderers/shaders.cjs.map +1 -1
- package/dist/charts/engine/renderers/shaders.d.cts +2 -2
- package/dist/charts/engine/renderers/shaders.d.ts +2 -2
- package/dist/charts/engine/renderers/shaders.js +37 -19
- package/dist/charts/engine/renderers/shaders.js.map +1 -1
- package/dist/charts/engine/renderers/types.cjs.map +1 -1
- package/dist/charts/engine/renderers/types.d.cts +11 -4
- package/dist/charts/engine/renderers/types.d.ts +11 -4
- package/dist/charts/engine/renderers/types.js.map +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs +1 -1
- package/dist/charts/engine/renderers/webgl2.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgl2.js +33 -12
- package/dist/charts/engine/renderers/webgl2.js.map +1 -1
- package/dist/charts/engine/renderers/webgpu.cjs +1 -1
- package/dist/charts/engine/renderers/webgpu.cjs.map +1 -1
- package/dist/charts/engine/renderers/webgpu.js +18 -15
- package/dist/charts/engine/renderers/webgpu.js.map +1 -1
- package/dist/charts/engine/scene.cjs +1 -1
- package/dist/charts/engine/scene.cjs.map +1 -1
- package/dist/charts/engine/scene.d.cts +19 -6
- package/dist/charts/engine/scene.d.ts +19 -6
- package/dist/charts/engine/scene.js +201 -89
- package/dist/charts/engine/scene.js.map +1 -1
- package/dist/charts/engine/shapes/canvas.cjs +2 -0
- package/dist/charts/engine/shapes/canvas.cjs.map +1 -0
- package/dist/charts/engine/shapes/canvas.d.cts +58 -0
- package/dist/charts/engine/shapes/canvas.d.ts +58 -0
- package/dist/charts/engine/shapes/canvas.js +159 -0
- package/dist/charts/engine/shapes/canvas.js.map +1 -0
- package/dist/charts/engine/shapes/chart.cjs +2 -0
- package/dist/charts/engine/shapes/chart.cjs.map +1 -0
- package/dist/charts/engine/shapes/chart.d.cts +6 -0
- package/dist/charts/engine/shapes/chart.d.ts +6 -0
- package/dist/charts/engine/shapes/chart.js +273 -0
- package/dist/charts/engine/shapes/chart.js.map +1 -0
- package/dist/charts/engine/shapes/draw.cjs +2 -0
- package/dist/charts/engine/shapes/draw.cjs.map +1 -0
- package/dist/charts/engine/shapes/draw.d.cts +20 -0
- package/dist/charts/engine/shapes/draw.d.ts +20 -0
- package/dist/charts/engine/shapes/draw.js +152 -0
- package/dist/charts/engine/shapes/draw.js.map +1 -0
- package/dist/charts/engine/shapes/funnel.cjs +2 -0
- package/dist/charts/engine/shapes/funnel.cjs.map +1 -0
- package/dist/charts/engine/shapes/funnel.d.cts +6 -0
- package/dist/charts/engine/shapes/funnel.d.ts +6 -0
- package/dist/charts/engine/shapes/funnel.js +149 -0
- package/dist/charts/engine/shapes/funnel.js.map +1 -0
- package/dist/charts/engine/shapes/gauge.cjs +2 -0
- package/dist/charts/engine/shapes/gauge.cjs.map +1 -0
- package/dist/charts/engine/shapes/gauge.d.cts +7 -0
- package/dist/charts/engine/shapes/gauge.d.ts +7 -0
- package/dist/charts/engine/shapes/gauge.js +173 -0
- package/dist/charts/engine/shapes/gauge.js.map +1 -0
- package/dist/charts/engine/shapes/hit.cjs +2 -0
- package/dist/charts/engine/shapes/hit.cjs.map +1 -0
- package/dist/charts/engine/shapes/hit.d.cts +28 -0
- package/dist/charts/engine/shapes/hit.d.ts +28 -0
- package/dist/charts/engine/shapes/hit.js +124 -0
- package/dist/charts/engine/shapes/hit.js.map +1 -0
- package/dist/charts/engine/shapes/index.d.cts +9 -0
- package/dist/charts/engine/shapes/index.d.ts +9 -0
- package/dist/charts/engine/shapes/layout.cjs +3 -0
- package/dist/charts/engine/shapes/layout.cjs.map +1 -0
- package/dist/charts/engine/shapes/layout.d.cts +88 -0
- package/dist/charts/engine/shapes/layout.d.ts +88 -0
- package/dist/charts/engine/shapes/layout.js +266 -0
- package/dist/charts/engine/shapes/layout.js.map +1 -0
- package/dist/charts/engine/shapes/pie.cjs +2 -0
- package/dist/charts/engine/shapes/pie.cjs.map +1 -0
- package/dist/charts/engine/shapes/pie.d.cts +20 -0
- package/dist/charts/engine/shapes/pie.d.ts +20 -0
- package/dist/charts/engine/shapes/pie.js +302 -0
- package/dist/charts/engine/shapes/pie.js.map +1 -0
- package/dist/charts/engine/shapes/radar.cjs +2 -0
- package/dist/charts/engine/shapes/radar.cjs.map +1 -0
- package/dist/charts/engine/shapes/radar.d.cts +8 -0
- package/dist/charts/engine/shapes/radar.d.ts +8 -0
- package/dist/charts/engine/shapes/radar.js +197 -0
- package/dist/charts/engine/shapes/radar.js.map +1 -0
- package/dist/charts/engine/shapes/runtime.cjs +2 -0
- package/dist/charts/engine/shapes/runtime.cjs.map +1 -0
- package/dist/charts/engine/shapes/runtime.d.cts +29 -0
- package/dist/charts/engine/shapes/runtime.d.ts +29 -0
- package/dist/charts/engine/shapes/runtime.js +97 -0
- package/dist/charts/engine/shapes/runtime.js.map +1 -0
- package/dist/charts/engine/shapes/scene.cjs +2 -0
- package/dist/charts/engine/shapes/scene.cjs.map +1 -0
- package/dist/charts/engine/shapes/scene.d.cts +257 -0
- package/dist/charts/engine/shapes/scene.d.ts +257 -0
- package/dist/charts/engine/shapes/scene.js +123 -0
- package/dist/charts/engine/shapes/scene.js.map +1 -0
- package/dist/charts/engine/shapes/treemap.cjs +2 -0
- package/dist/charts/engine/shapes/treemap.cjs.map +1 -0
- package/dist/charts/engine/shapes/treemap.d.cts +14 -0
- package/dist/charts/engine/shapes/treemap.d.ts +14 -0
- package/dist/charts/engine/shapes/treemap.js +213 -0
- package/dist/charts/engine/shapes/treemap.js.map +1 -0
- package/dist/charts/engine/shapes/types.d.cts +292 -0
- package/dist/charts/engine/shapes/types.d.ts +292 -0
- package/dist/charts/engine/signature.cjs +2 -0
- package/dist/charts/engine/signature.cjs.map +1 -0
- package/dist/charts/engine/signature.d.cts +9 -0
- package/dist/charts/engine/signature.d.ts +9 -0
- package/dist/charts/engine/signature.js +13 -0
- package/dist/charts/engine/signature.js.map +1 -0
- package/dist/charts/engine/theme.cjs +1 -1
- package/dist/charts/engine/theme.cjs.map +1 -1
- package/dist/charts/engine/theme.d.cts +10 -1
- package/dist/charts/engine/theme.d.ts +10 -1
- package/dist/charts/engine/theme.js +40 -16
- package/dist/charts/engine/theme.js.map +1 -1
- package/dist/charts/engine/types.d.cts +70 -9
- package/dist/charts/engine/types.d.ts +70 -9
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.d.cts +4 -2
- package/dist/charts/index.d.ts +4 -2
- package/dist/charts/index.js +8 -5
- package/dist/charts/react/Chart.cjs +1 -1
- package/dist/charts/react/Chart.cjs.map +1 -1
- package/dist/charts/react/Chart.d.cts +8 -1
- package/dist/charts/react/Chart.d.ts +8 -1
- package/dist/charts/react/Chart.js +66 -47
- package/dist/charts/react/Chart.js.map +1 -1
- package/dist/charts/react/charts.cjs +1 -1
- package/dist/charts/react/charts.cjs.map +1 -1
- package/dist/charts/react/charts.d.cts +10 -2
- package/dist/charts/react/charts.d.ts +10 -2
- package/dist/charts/react/charts.js +174 -51
- package/dist/charts/react/charts.js.map +1 -1
- package/dist/charts/react/shapes.cjs +2 -0
- package/dist/charts/react/shapes.cjs.map +1 -0
- package/dist/charts/react/shapes.d.cts +255 -0
- package/dist/charts/react/shapes.d.ts +255 -0
- package/dist/charts/react/shapes.js +242 -0
- package/dist/charts/react/shapes.js.map +1 -0
- package/dist/charts/react/types.d.cts +73 -4
- package/dist/charts/react/types.d.ts +73 -4
- package/dist/native/charts/src/engine/color.cjs +1 -1
- package/dist/native/charts/src/engine/color.cjs.map +1 -1
- package/dist/native/charts/src/engine/color.js +12 -3
- package/dist/native/charts/src/engine/color.js.map +1 -1
- package/dist/native/charts/src/engine/controller.cjs +2 -2
- package/dist/native/charts/src/engine/controller.cjs.map +1 -1
- package/dist/native/charts/src/engine/controller.js +334 -270
- package/dist/native/charts/src/engine/controller.js.map +1 -1
- package/dist/native/charts/src/engine/curve.cjs +2 -0
- package/dist/native/charts/src/engine/curve.cjs.map +1 -0
- package/dist/native/charts/src/engine/curve.js +56 -0
- package/dist/native/charts/src/engine/curve.js.map +1 -0
- package/dist/native/charts/src/engine/data.cjs +1 -1
- package/dist/native/charts/src/engine/data.cjs.map +1 -1
- package/dist/native/charts/src/engine/data.js +98 -38
- package/dist/native/charts/src/engine/data.js.map +1 -1
- package/dist/native/charts/src/engine/model.cjs +1 -1
- package/dist/native/charts/src/engine/model.cjs.map +1 -1
- package/dist/native/charts/src/engine/model.js +229 -112
- package/dist/native/charts/src/engine/model.js.map +1 -1
- package/dist/native/charts/src/engine/overlay.cjs +1 -1
- package/dist/native/charts/src/engine/overlay.cjs.map +1 -1
- package/dist/native/charts/src/engine/overlay.js +16 -16
- package/dist/native/charts/src/engine/overlay.js.map +1 -1
- package/dist/native/charts/src/engine/presets.cjs +1 -1
- package/dist/native/charts/src/engine/presets.cjs.map +1 -1
- package/dist/native/charts/src/engine/presets.js +11 -4
- package/dist/native/charts/src/engine/presets.js.map +1 -1
- package/dist/native/charts/src/engine/scene.cjs +1 -1
- package/dist/native/charts/src/engine/scene.cjs.map +1 -1
- package/dist/native/charts/src/engine/scene.js +209 -97
- package/dist/native/charts/src/engine/scene.js.map +1 -1
- package/dist/native/charts/src/engine/theme.cjs.map +1 -1
- package/dist/native/charts/src/engine/theme.js.map +1 -1
- package/dist/native/components/Chart/scene.cjs +1 -1
- package/dist/native/components/Chart/scene.cjs.map +1 -1
- package/dist/native/components/Chart/scene.js +31 -19
- package/dist/native/components/Chart/scene.js.map +1 -1
- package/dist/native/source/components/Chart/scene.tsx +54 -20
- package/dist/taro/index.js +1059 -579
- package/dist/uni/charts-canvas.js +3 -1
- package/dist/weapp/controls.js +966 -225
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["size","value","fallback","engineOptions","props","ChartBase","handlers","containerRef","useRef","chartRef","handlersRef","tooltipRef","renderTooltip","tipEvent","setTipEvent","useState","plot","setPlot","tipHost","useMemo","resolved","options","base","flushSync","event","optionsRef","useEffect","container","chart","createChart","offs","v","r","rect","off","useImperativeHandle","handleRef","view","width","height","style","overlay","createPortal","Chart","ref"],"sources":["../../../../charts/src/react/Chart.tsx"],"sourcesContent":["import {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { createChart } from \"../engine/chart\";\nimport type {\n ChartDragEvent,\n ChartHoverEvent,\n ChartInstance,\n ChartOptions,\n ChartPlotClickEvent,\n ChartRect,\n ChartRendererKind,\n ChartView,\n} from \"../engine/types\";\nimport type { ChartCommonProps, ChartProps } from \"./types\";\n\ninterface Handlers {\n onHover?: (event: ChartHoverEvent | null) => void;\n onPointClick?: (event: ChartHoverEvent) => void;\n onPlotClick?: (event: ChartPlotClickEvent) => void;\n onZoom?: (view: ChartView) => void;\n onRendererChange?: (renderer: ChartRendererKind) => void;\n onDrag?: (event: ChartDragEvent) => void;\n onDrop?: (event: ChartDragEvent) => void;\n}\n\nconst size = (value: number | string | undefined, fallback: string) =>\n value === undefined\n ? fallback\n : typeof value === \"number\"\n ? `${value}px`\n : value;\n\n/** Engine options of the common props */\nexport const engineOptions = (\n props: Pick<\n ChartCommonProps,\n | \"xAxis\"\n | \"yAxis\"\n | \"renderer\"\n | \"legend\"\n | \"tooltip\"\n | \"crosshair\"\n | \"annotations\"\n | \"interaction\"\n | \"padding\"\n | \"palette\"\n | \"ariaLabel\"\n > &\n Pick<ChartOptions, \"series\">,\n): ChartOptions => ({\n series: props.series,\n xAxis: props.xAxis,\n yAxis: props.yAxis,\n renderer: props.renderer,\n legend: props.legend,\n tooltip: props.tooltip,\n crosshair: props.crosshair,\n annotations: props.annotations,\n interaction: props.interaction,\n padding: props.padding,\n palette: props.palette,\n ariaLabel: props.ariaLabel,\n});\n\ninterface ChartBaseProps extends Handlers {\n options: ChartOptions;\n height?: number | string;\n width?: number | string;\n className?: string;\n style?: CSSProperties;\n handleRef?: ChartCommonProps[\"ref\"];\n /** React content of the tooltip (replaces the engine's content) */\n renderTooltip?: (event: ChartHoverEvent) => ReactNode;\n /** React content placed over the chart, given the plot area */\n overlay?: (plot: ChartRect) => ReactNode;\n}\n\n/** Mounts the engine in a sized <div> and forwards option / handler changes */\nexport function ChartBase({\n options,\n height,\n width,\n className,\n style,\n handleRef,\n renderTooltip,\n overlay,\n ...handlers\n}: ChartBaseProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const chartRef = useRef<ChartInstance | null>(null);\n const handlersRef = useRef<Handlers>(handlers);\n const tooltipRef = useRef(renderTooltip);\n const [tipEvent, setTipEvent] = useState<ChartHoverEvent | null>(null);\n const [plot, setPlot] = useState<ChartRect | null>(null);\n const tipHost = useMemo(\n () =>\n typeof document === \"undefined\" ? null : document.createElement(\"div\"),\n [],\n );\n\n const resolved = useMemo((): ChartOptions => {\n if (!renderTooltip || !tipHost || options.tooltip === false) return options;\n const base = typeof options.tooltip === \"object\" ? options.tooltip : {};\n return {\n ...options,\n tooltip: {\n ...base,\n render: (event) => {\n if (!tooltipRef.current) return null;\n // render synchronously so the engine measures the final size\n flushSync(() => setTipEvent(event));\n return tipHost;\n },\n },\n };\n }, [options, renderTooltip, tipHost]);\n const optionsRef = useRef(resolved);\n\n useEffect(() => {\n handlersRef.current = handlers;\n tooltipRef.current = renderTooltip;\n });\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const chart = createChart(container, optionsRef.current);\n chartRef.current = chart;\n const offs = [\n chart.on(\"hover\", (e) => handlersRef.current.onHover?.(e)),\n chart.on(\"click\", (e) => handlersRef.current.onPointClick?.(e)),\n chart.on(\"plotClick\", (e) => handlersRef.current.onPlotClick?.(e)),\n chart.on(\"zoom\", (v) => handlersRef.current.onZoom?.(v)),\n chart.on(\"renderer\", (r) => handlersRef.current.onRendererChange?.(r)),\n chart.on(\"drag\", (e) => handlersRef.current.onDrag?.(e)),\n chart.on(\"drop\", (e) => handlersRef.current.onDrop?.(e)),\n chart.on(\"layout\", (rect) => setPlot(rect)),\n ];\n return () => {\n offs.forEach((off) => off());\n chart.destroy();\n chartRef.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (optionsRef.current === resolved) return;\n optionsRef.current = resolved;\n chartRef.current?.setOptions(resolved);\n }, [resolved]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n resetZoom: () => chartRef.current?.resetZoom(),\n getView: () => chartRef.current?.getView() ?? null,\n setView: (view) => chartRef.current?.setView(view),\n getRenderer: () => chartRef.current?.getRenderer() ?? null,\n getInstance: () => chartRef.current,\n }),\n [],\n );\n\n return (\n <div\n className={className}\n style={{\n position: \"relative\",\n width: size(width, \"100%\"),\n height: size(height, \"320px\"),\n ...style,\n }}\n >\n <div ref={containerRef} style={{ position: \"absolute\", inset: 0 }} />\n {overlay && plot && (\n <div\n className=\"minerva-chart-overlay\"\n style={{\n position: \"absolute\",\n left: plot.x,\n top: plot.y,\n width: plot.width,\n height: plot.height,\n pointerEvents: \"none\",\n }}\n >\n {overlay(plot)}\n </div>\n )}\n {tipHost &&\n tipEvent &&\n renderTooltip &&\n createPortal(renderTooltip(tipEvent), tipHost)}\n </div>\n );\n}\n\n/**\n * GPU chart (WebGPU, then WebGL2, then Canvas2D) mixing line, area, bar and\n * scatter series; zoomable, keyboard accessible and themed by the Minerva\n * CSS variables.\n */\nexport function Chart(props: ChartProps) {\n const {\n height,\n width,\n className,\n style,\n ref,\n onHover,\n onPointClick,\n onPlotClick,\n onZoom,\n onRendererChange,\n renderTooltip,\n } = props;\n return (\n <ChartBase\n options={engineOptions(props)}\n height={height}\n width={width}\n className={className}\n style={style}\n handleRef={ref}\n onHover={onHover}\n onPointClick={onPointClick}\n onPlotClick={onPlotClick}\n onZoom={onZoom}\n onRendererChange={onRendererChange}\n renderTooltip={renderTooltip}\n />\n );\n}\n"],"mappings":";;;;;;AAiCA,IAAMA,KAAQ,GAAoC,MAChDC,MAAU,KAAA,IACNC,IACA,OAAOD,KAAU,WACf,GAAGA,EAAM,MACTA,GAGKE,KACX,OAekB;CAClB,QAAQC,EAAM;CACd,OAAOA,EAAM;CACb,OAAOA,EAAM;CACb,UAAUA,EAAM;CAChB,QAAQA,EAAM;CACd,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,aAAaA,EAAM;CACnB,aAAaA,EAAM;CACnB,SAASA,EAAM;CACf,SAASA,EAAM;CACf,WAAWA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AET;AAOA,SAAgByB,EAAM,GAAmB;CACvC,IAAM,EACJ,WACA,UACA,cACA,UACA,QACA,YACA,iBACA,gBACA,WACA,qBACA,qBACEvC;CACJ,OACE,kBAACC,GAAD;EACE,SAASF,EAAcC,CAAK;EACpB;EACD;EACI;EACJ;EACP,WAAWwC;EACF;EACK;EACD;EACL;EACU;EACH;CAChB,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["size","value","fallback","engineOptions","props","isPlainObject","proto","shallowEqual","keys","a","b","key","sameValue","v","i","sameOptions","sa","sb","s","sameTooltipEvent","item","ChartBase","handlers","containerRef","useRef","chartRef","handlersRef","tooltipRef","renderTooltip","tipEventRef","tipEvent","setTipEvent","useState","plot","setPlot","tipHost","useMemo","stable","setStable","options","hasTooltip","resolved","base","event","flushSync","optionsRef","useEffect","container","chart","createChart","offs","r","rect","off","useImperativeHandle","handleRef","view","width","height","style","overlay","createPortal","Chart","ref"],"sources":["../../../../charts/src/react/Chart.tsx"],"sourcesContent":["import {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { createChart } from \"../engine/chart\";\nimport type {\n ChartDragEvent,\n ChartHoverEvent,\n ChartInstance,\n ChartOptions,\n ChartPlotClickEvent,\n ChartRect,\n ChartRendererKind,\n ChartView,\n} from \"../engine/types\";\nimport type { ChartCommonProps, ChartProps } from \"./types\";\n\ninterface Handlers {\n onHover?: (event: ChartHoverEvent | null) => void;\n onPointClick?: (event: ChartHoverEvent) => void;\n onPlotClick?: (event: ChartPlotClickEvent) => void;\n onZoom?: (view: ChartView) => void;\n onRendererChange?: (renderer: ChartRendererKind) => void;\n onDrag?: (event: ChartDragEvent) => void;\n onDrop?: (event: ChartDragEvent) => void;\n}\n\nconst size = (value: number | string | undefined, fallback: string) =>\n value === undefined\n ? fallback\n : typeof value === \"number\"\n ? `${value}px`\n : value;\n\n/** Engine options of the common props */\nexport const engineOptions = (\n props: Pick<\n ChartCommonProps,\n | \"xAxis\"\n | \"yAxis\"\n | \"renderer\"\n | \"legend\"\n | \"tooltip\"\n | \"crosshair\"\n | \"annotations\"\n | \"interaction\"\n | \"padding\"\n | \"palette\"\n | \"ariaLabel\"\n > &\n Pick<ChartOptions, \"series\" | \"stackMode\">,\n): ChartOptions => ({\n series: props.series,\n xAxis: props.xAxis,\n yAxis: props.yAxis,\n renderer: props.renderer,\n legend: props.legend,\n tooltip: props.tooltip,\n crosshair: props.crosshair,\n annotations: props.annotations,\n interaction: props.interaction,\n padding: props.padding,\n palette: props.palette,\n ariaLabel: props.ariaLabel,\n stackMode: props.stackMode,\n});\n\ninterface ChartBaseProps extends Handlers {\n options: ChartOptions;\n height?: number | string;\n width?: number | string;\n className?: string;\n style?: CSSProperties;\n handleRef?: ChartCommonProps[\"ref\"];\n /** React content of the tooltip (replaces the engine's content) */\n renderTooltip?: (event: ChartHoverEvent) => ReactNode;\n /** React content placed over the chart, given the plot area */\n overlay?: (plot: ChartRect) => ReactNode;\n}\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n\n/** Same keys with identical values */\nconst shallowEqual = (\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n): boolean => {\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n return keys.every(\n (key) => a[key] === b[key] && Object.prototype.hasOwnProperty.call(b, key),\n );\n};\n\n/**\n * Identical values, or plain arrays / objects whose items are identical\n * (`[\"#f00\"]`, `{ title: \"x\" }` written inline)\n */\nconst sameValue = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (Array.isArray(a) && Array.isArray(b))\n return a.length === b.length && a.every((v, i) => v === b[i]);\n return isPlainObject(a) && isPlainObject(b) && shallowEqual(a, b);\n};\n\n/**\n * Whether `b` describes the same chart as `a`: top-level options compared by\n * identity (or one level deep for inline arrays / objects), series compared\n * one by one, each series shallowly (inline `series={[{ name, data }]}`\n * with a stable `data` stays equal). Data is never compared by content.\n */\nexport const sameOptions = (a: ChartOptions, b: ChartOptions): boolean => {\n if (a === b) return true;\n const keys = Object.keys(a) as (keyof ChartOptions)[];\n if (keys.length !== Object.keys(b).length) return false;\n return keys.every((key) => {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (key !== \"series\") return sameValue(a[key], b[key]);\n const sa = a.series;\n const sb = b.series;\n return (\n sa === sb ||\n (sa.length === sb.length &&\n sa.every(\n (s, i) =>\n s === sb[i] ||\n shallowEqual(\n s as unknown as Record<string, unknown>,\n sb[i] as unknown as Record<string, unknown>,\n ),\n ))\n );\n });\n};\n\n/** Same hovered points with the same values (same tooltip content) */\nconst sameTooltipEvent = (\n a: ChartHoverEvent | null,\n b: ChartHoverEvent,\n): boolean =>\n !!a &&\n a.x === b.x &&\n a.xLabel === b.xLabel &&\n a.items.length === b.items.length &&\n a.items.every((item, i) =>\n shallowEqual(\n item as unknown as Record<string, unknown>,\n b.items[i] as unknown as Record<string, unknown>,\n ),\n );\n\n/** Mounts the engine in a sized <div> and forwards option / handler changes */\nexport function ChartBase({\n options,\n height,\n width,\n className,\n style,\n handleRef,\n renderTooltip,\n overlay,\n ...handlers\n}: ChartBaseProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const chartRef = useRef<ChartInstance | null>(null);\n const handlersRef = useRef<Handlers>(handlers);\n const tooltipRef = useRef(renderTooltip);\n const tipEventRef = useRef<ChartHoverEvent | null>(null);\n const [tipEvent, setTipEvent] = useState<ChartHoverEvent | null>(null);\n const [plot, setPlot] = useState<ChartRect | null>(null);\n const tipHost = useMemo(\n () =>\n typeof document === \"undefined\" ? null : document.createElement(\"div\"),\n [],\n );\n\n // Parents pass a new options object on every render: keep the previous\n // one while it describes the same chart, so the engine isn't rebuilt\n // (state derived during render, the pattern React documents for it)\n const [stable, setStable] = useState(options);\n if (stable !== options && !sameOptions(stable, options)) setStable(options);\n // the render callback reads the latest `renderTooltip` through a ref: only\n // its presence matters here (inline callbacks change on every render)\n const hasTooltip = !!renderTooltip;\n\n const resolved = useMemo((): ChartOptions => {\n if (!hasTooltip || !tipHost || stable.tooltip === false) return stable;\n const base = typeof stable.tooltip === \"object\" ? stable.tooltip : {};\n return {\n ...stable,\n tooltip: {\n ...base,\n render: (event) => {\n if (!tooltipRef.current) return null;\n // render synchronously so the engine measures the final size;\n // pointer moves over the same points keep the rendered content\n if (!sameTooltipEvent(tipEventRef.current, event)) {\n tipEventRef.current = event;\n flushSync(() => setTipEvent(event));\n }\n return tipHost;\n },\n },\n };\n }, [stable, hasTooltip, tipHost]);\n const optionsRef = useRef(resolved);\n\n useEffect(() => {\n handlersRef.current = handlers;\n tooltipRef.current = renderTooltip;\n });\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const chart = createChart(container, optionsRef.current);\n chartRef.current = chart;\n const offs = [\n chart.on(\"hover\", (e) => handlersRef.current.onHover?.(e)),\n chart.on(\"click\", (e) => handlersRef.current.onPointClick?.(e)),\n chart.on(\"plotClick\", (e) => handlersRef.current.onPlotClick?.(e)),\n chart.on(\"zoom\", (v) => handlersRef.current.onZoom?.(v)),\n chart.on(\"renderer\", (r) => handlersRef.current.onRendererChange?.(r)),\n chart.on(\"drag\", (e) => handlersRef.current.onDrag?.(e)),\n chart.on(\"drop\", (e) => handlersRef.current.onDrop?.(e)),\n chart.on(\"layout\", (rect) => setPlot(rect)),\n ];\n return () => {\n offs.forEach((off) => off());\n chart.destroy();\n chartRef.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (optionsRef.current === resolved) return;\n optionsRef.current = resolved;\n chartRef.current?.setOptions(resolved);\n }, [resolved]);\n\n useImperativeHandle(\n handleRef,\n () => ({\n resetZoom: () => chartRef.current?.resetZoom(),\n getView: () => chartRef.current?.getView() ?? null,\n setView: (view) => chartRef.current?.setView(view),\n getRenderer: () => chartRef.current?.getRenderer() ?? null,\n getInstance: () => chartRef.current,\n }),\n [],\n );\n\n return (\n <div\n className={className}\n style={{\n position: \"relative\",\n width: size(width, \"100%\"),\n height: size(height, \"320px\"),\n ...style,\n }}\n >\n <div ref={containerRef} style={{ position: \"absolute\", inset: 0 }} />\n {overlay && plot && (\n <div\n className=\"minerva-chart-overlay\"\n style={{\n position: \"absolute\",\n left: plot.x,\n top: plot.y,\n width: plot.width,\n height: plot.height,\n pointerEvents: \"none\",\n }}\n >\n {overlay(plot)}\n </div>\n )}\n {tipHost &&\n tipEvent &&\n renderTooltip &&\n createPortal(renderTooltip(tipEvent), tipHost)}\n </div>\n );\n}\n\n/**\n * GPU chart (WebGPU, then WebGL2, then Canvas2D) mixing line, area, bar and\n * scatter series; zoomable, keyboard accessible and themed by the Minerva\n * CSS variables.\n */\nexport function Chart(props: ChartProps) {\n const {\n height,\n width,\n className,\n style,\n ref,\n onHover,\n onPointClick,\n onPlotClick,\n onZoom,\n onRendererChange,\n renderTooltip,\n } = props;\n return (\n <ChartBase\n options={engineOptions(props)}\n height={height}\n width={width}\n className={className}\n style={style}\n handleRef={ref}\n onHover={onHover}\n onPointClick={onPointClick}\n onPlotClick={onPlotClick}\n onZoom={onZoom}\n onRendererChange={onRendererChange}\n renderTooltip={renderTooltip}\n />\n );\n}\n"],"mappings":";;;;;;AAiCA,IAAMA,KAAQ,GAAoC,MAChDC,MAAU,KAAA,IACNC,IACA,OAAOD,KAAU,WACf,GAAGA,EAAM,MACTA,GAGKE,KACX,OAekB;CAClB,QAAQC,EAAM;CACd,OAAOA,EAAM;CACb,OAAOA,EAAM;CACb,UAAUA,EAAM;CAChB,QAAQA,EAAM;CACd,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,aAAaA,EAAM;CACnB,aAAaA,EAAM;CACnB,SAASA,EAAM;CACf,SAASA,EAAM;CACf,WAAWA,EAAM;CACjB,WAAWA,EAAM;AACnB,IAeMC,KAAiB,MAAqD;CAC1E,IAAI,OAAOJ,KAAU,aAA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ACV,kBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,UAAU;KACV,MAAMA,EAAK;KACX,KAAKA,EAAK;KACV,OAAOA,EAAK;KACZ,QAAQA,EAAK;KACb,eAAe;IACjB;IAEC,UAAA2B,EAAQ3B,CAAI;GACV,CAAA;GAENE,KACCL,KACAF,KACAiC,EAAajC,EAAcE,CAAQ,GAAGK,CAAO;EAC5C;;AAET;AAOA,SAAgB2B,EAAM,GAAmB;CACvC,IAAM,EACJ,WACA,UACA,cACA,UACA,QACA,YACA,iBACA,gBACA,WACA,qBACA,qBACE1D;CACJ,OACE,kBAACiB,GAAD;EACE,SAASlB,EAAcC,CAAK;EACpB;EACD;EACI;EACJ;EACP,WAAW2D;EACF;EACK;EACD;EACL;EACU;EACH;CAChB,CAAA;AAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("./Chart.cjs"),t=require("../engine/presets.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=e=>({height:e.height,width:e.width,className:e.className,style:e.style,handleRef:e.ref,onHover:e.onHover,onPointClick:e.onPointClick,onPlotClick:e.onPlotClick,onZoom:e.onZoom,onRendererChange:e.onRendererChange,renderTooltip:e.renderTooltip});function a(a){let{series:o,area:s=!1}=a,
|
|
1
|
+
"use client";const e=require("./Chart.cjs"),t=require("../engine/presets.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=e=>({height:e.height,width:e.width,className:e.className,style:e.style,handleRef:e.ref,onHover:e.onHover,onPointClick:e.onPointClick,onPlotClick:e.onPlotClick,onZoom:e.onZoom,onRendererChange:e.onRendererChange,renderTooltip:e.renderTooltip});function a(a){let{series:o,area:s=!1,curve:c,stacked:l=!1,percent:u=!1}=a,d=(0,n.useMemo)(()=>t.lineSeries(o,s,{curve:c,stacked:l||u}),[o,s,c,l,u]);return(0,r.jsx)(e.ChartBase,{options:e.engineOptions({...a,series:d,stackMode:u?`percent`:void 0}),...i(a)})}function o(a){let{series:o,curve:s=`smooth`,stacked:c=!1,percent:l=!1}=a,u=(0,n.useMemo)(()=>t.areaSeries(o,{curve:s,stacked:c||l}),[o,s,c,l]);return(0,r.jsx)(e.ChartBase,{options:e.engineOptions({...a,series:u,stackMode:l?`percent`:void 0}),...i(a)})}function s(a){let{series:o,stacked:s=!1,percent:c=!1,labels:l=!1}=a,u=(0,n.useMemo)(()=>t.barSeries(o,s||c,l),[o,s,c,l]);return(0,r.jsx)(e.ChartBase,{options:e.engineOptions({...a,series:u,stackMode:c?`percent`:void 0}),...i(a)})}function c(a){let{series:o}=a,s=(0,n.useMemo)(()=>t.candlestickSeries(o),[o]);return(0,r.jsx)(e.ChartBase,{options:e.engineOptions({...a,series:s}),...i(a)})}function l(a){let{data:o,xCategories:s,yCategories:c,colorScale:l,valueRange:u,name:d,radius:f,format:p}=a,m=(0,n.useMemo)(()=>t.heatmapChartOptions({data:o,xCategories:s,yCategories:c,colorScale:l,valueRange:u,name:d,radius:f,format:p}).series,[o,s,c,l,u,d,f,p]),h=e.engineOptions({...a,series:m});return(0,r.jsx)(e.ChartBase,{options:{...t.heatmapChartOptions({data:o,xCategories:s,yCategories:c},{...h,legend:a.legend,interaction:a.interaction,tooltip:a.tooltip}),series:m},...i(a)})}function u(i){let{data:a,type:o,color:s,curve:c,name:l,reference:u,format:d,height:f=48,width:p,renderer:m,tooltip:h,palette:g,ariaLabel:_,className:v,style:y,ref:b,onHover:x,renderTooltip:S}=i,C=(0,n.useMemo)(()=>t.sparklineOptions({data:a,type:o,color:s,curve:c,name:l,reference:u,format:d},{renderer:m,tooltip:h,palette:g,ariaLabel:_}),[a,o,s,c,l,u,d,m,h,g,_]);return(0,r.jsx)(e.ChartBase,{options:C,height:f,width:p,className:v,style:y,handleRef:b,onHover:x,renderTooltip:S})}function d(a){let{series:o}=a,s=(0,n.useMemo)(()=>t.scatterSeries(o),[o]);return(0,r.jsx)(e.ChartBase,{options:e.engineOptions({...a,series:s}),...i(a)})}var f=[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`],p=(e,t,n)=>{let r=e.endsWith(`Left`),i=e.startsWith(`top`);return{position:`absolute`,left:r?0:n.x-t.x,top:i?0:n.y-t.y,width:r?n.x-t.x:t.x+t.width-n.x,height:i?n.y-t.y:t.y+t.height-n.y,pointerEvents:`none`}};function m(n){let{points:a,xDomain:o,yDomain:s,xSplit:c,ySplit:l,quadrants:u,xLabel:d,yLabel:m,axisLabels:h,showTicks:g,reverseX:_,showLabels:v,pointSize:y,name:b,draggable:x,onPointClick:S,onPointDrop:C,onQuadrantClick:w,renderTooltip:T,quadrantContent:E}=n,D={xDomain:o,yDomain:s,xSplit:c,ySplit:l,reverseX:_},O=t.quadrantChartOptions({points:a,xDomain:o,yDomain:s,xSplit:c,ySplit:l,quadrants:u,xLabel:d,yLabel:m,axisLabels:h,showTicks:g,reverseX:_,showLabels:v,pointSize:y,name:b,draggable:x??!!C},e.engineOptions({...n,series:[]})),k=E?e=>{let[t,n]=o??[0,10],[i,a]=s??[0,10],u=c??(t+n)/2,d=l??(i+a)/2,m=(u-t)/(n-t||1),h=(d-i)/(a-i||1),g={x:e.x+e.width*(_?1-m:m),y:e.y+e.height*(1-h)};return f.map(t=>E[t]?(0,r.jsx)(`div`,{className:`minerva-chart-quadrant minerva-chart-quadrant-${t}`,style:p(t,e,g),children:E[t]},t):null)}:void 0;return(0,r.jsx)(e.ChartBase,{options:O,...i({...n,onPointClick:void 0,renderTooltip:void 0}),overlay:k,onPointClick:S?e=>{let t=e.items[0]?.index;t!==void 0&&a[t]&&S(a[t],t)}:void 0,onPlotClick:w?e=>w(t.quadrantOf(D,e.x,e.y),e):void 0,onDrop:C?e=>{let n=e.item.index;a[n]&&C(a[n],n,{x:e.x,y:e.y,quadrant:t.quadrantOf(D,e.x,e.y)})}:void 0,renderTooltip:T?e=>{let t=e.items[0]?.index;return t!==void 0&&a[t]?T(a[t],t):null}:void 0})}exports.AreaChart=o,exports.BarChart=s,exports.CandlestickChart=c,exports.HeatmapChart=l,exports.LineChart=a,exports.QuadrantChart=m,exports.ScatterChart=d,exports.Sparkline=u;
|
|
2
2
|
//# sourceMappingURL=charts.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.cjs","names":["useMemo","lineSeries","ChartBase","engineOptions","barSeries","scatterSeries","quadrantChartOptions","quadrantOf","require_Chart","require_presets","react","react_jsx_runtime","frameProps","props","LineChart","input","series","area","BarChart","stacked","ScatterChart","CORNERS","cornerStyle","left","corner","top","split","plot","QuadrantChart","geometry","options","draggable","onPointDrop","overlay","quadrantContent","x0","x1","xDomain","y0","y1","yDomain","xs","xSplit","ys","ySplit","fx","fy","reverseX","onPointClick","index","event","points","onQuadrantClick","at","renderTooltip"],"sources":["../../../../charts/src/react/charts.tsx"],"sourcesContent":["import { useMemo, type CSSProperties } from \"react\";\nimport {\n barSeries,\n lineSeries,\n quadrantChartOptions,\n quadrantOf,\n scatterSeries,\n type QuadrantCorner,\n} from \"../engine/presets\";\nimport type { ChartRect } from \"../engine/types\";\nimport { ChartBase, engineOptions } from \"./Chart\";\nimport type {\n BarChartProps,\n ChartCommonProps,\n LineChartProps,\n QuadrantChartProps,\n ScatterChartProps,\n} from \"./types\";\n\nconst frameProps = (props: ChartCommonProps) => ({\n height: props.height,\n width: props.width,\n className: props.className,\n style: props.style,\n handleRef: props.ref,\n onHover: props.onHover,\n onPointClick: props.onPointClick,\n onPlotClick: props.onPlotClick,\n onZoom: props.onZoom,\n onRendererChange: props.onRendererChange,\n renderTooltip: props.renderTooltip,\n});\n\n/** Line (or area) chart; handles millions of points on the GPU */\nexport function LineChart(props: LineChartProps) {\n const { series: input, area = false } = props;\n const series = useMemo(() => lineSeries(input, area), [input, area]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Bar chart: grouped side by side, or stacked */\nexport function BarChart(props: BarChartProps) {\n const { series: input, stacked = false } = props;\n const series = useMemo(() => barSeries(input, stacked), [input, stacked]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Scatter chart: zooms on both axes, hit testing through a spatial index */\nexport function ScatterChart(props: ScatterChartProps) {\n const { series: input } = props;\n const series = useMemo(() => scatterSeries(input), [input]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\nconst CORNERS: QuadrantCorner[] = [\n \"topLeft\",\n \"topRight\",\n \"bottomLeft\",\n \"bottomRight\",\n];\n\nconst cornerStyle = (\n corner: QuadrantCorner,\n plot: ChartRect,\n split: { x: number; y: number },\n): CSSProperties => {\n const left = corner.endsWith(\"Left\");\n const top = corner.startsWith(\"top\");\n return {\n position: \"absolute\",\n left: left ? 0 : split.x - plot.x,\n top: top ? 0 : split.y - plot.y,\n width: left ? split.x - plot.x : plot.x + plot.width - split.x,\n height: top ? split.y - plot.y : plot.y + plot.height - split.y,\n pointerEvents: \"none\",\n };\n};\n\n/**\n * Four-quadrant matrix (priority matrix, Eisenhower, BCG, ...): tinted\n * quadrants with titles, dividers, and labelled dots placed without\n * overlapping labels. Dots can be dragged to another quadrant.\n */\nexport function QuadrantChart(props: QuadrantChartProps) {\n const {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable,\n onPointClick,\n onPointDrop,\n onQuadrantClick,\n renderTooltip,\n quadrantContent,\n } = props;\n const geometry = { xDomain, yDomain, xSplit, ySplit, reverseX };\n\n const options = quadrantChartOptions(\n {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable: draggable ?? !!onPointDrop,\n },\n engineOptions({ ...props, series: [] }),\n );\n\n const overlay = quadrantContent\n ? (plot: ChartRect) => {\n const [x0, x1] = xDomain ?? [0, 10];\n const [y0, y1] = yDomain ?? [0, 10];\n const xs = xSplit ?? (x0 + x1) / 2;\n const ys = ySplit ?? (y0 + y1) / 2;\n const fx = (xs - x0) / (x1 - x0 || 1);\n const fy = (ys - y0) / (y1 - y0 || 1);\n const split = {\n x: plot.x + plot.width * (reverseX ? 1 - fx : fx),\n y: plot.y + plot.height * (1 - fy),\n };\n return CORNERS.map((corner) =>\n quadrantContent[corner] ? (\n <div\n key={corner}\n className={`minerva-chart-quadrant minerva-chart-quadrant-${corner}`}\n style={cornerStyle(corner, plot, split)}\n >\n {quadrantContent[corner]}\n </div>\n ) : null,\n );\n }\n : undefined;\n\n return (\n <ChartBase\n options={options}\n {...frameProps({\n ...props,\n onPointClick: undefined,\n renderTooltip: undefined,\n })}\n overlay={overlay}\n onPointClick={\n onPointClick\n ? (event) => {\n const index = event.items[0]?.index;\n if (index !== undefined && points[index])\n onPointClick(points[index], index);\n }\n : undefined\n }\n onPlotClick={\n onQuadrantClick\n ? (at) => onQuadrantClick(quadrantOf(geometry, at.x, at.y), at)\n : undefined\n }\n onDrop={\n onPointDrop\n ? (event) => {\n const index = event.item.index;\n if (!points[index]) return;\n onPointDrop(points[index], index, {\n x: event.x,\n y: event.y,\n quadrant: quadrantOf(geometry, event.x, event.y),\n });\n }\n : undefined\n }\n renderTooltip={\n renderTooltip\n ? (event) => {\n const index = event.items[0]?.index;\n return index !== undefined && points[index]\n ? renderTooltip(points[index], index)\n : null;\n }\n : undefined\n }\n />\n );\n}\n"],"mappings":"qIAmBA,IAAMY,EAAc,IAA6B,CAC/C,OAAQC,EAAM,OACd,MAAOA,EAAM,MACb,UAAWA,EAAM,UACjB,MAAOA,EAAM,MACb,UAAWA,EAAM,IACjB,QAASA,EAAM,QACf,aAAcA,EAAM,aACpB,YAAaA,EAAM,YACnB,OAAQA,EAAM,OACd,iBAAkBA,EAAM,iBACxB,cAAeA,EAAM,aACvB,GAGA,SAAgBC,EAAU,EAAuB,CAC/C,GAAM,CAAE,OAAQC,EAAO,OAAO,IAAUF,EAClCG,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IAAA,EACjB,CAAC,EACQ,UACT,aACEmC,EACK,GAAU,CACT,IAAMC,EAAQC,EAAM,MAAM,EAAE,EAAE,MAC1BD,IAAU,IAAA,IAAaE,EAAOF,IAChCD,EAAaG,EAAOF,GAAQA,CAAK,CACrC,EACA,IAAA,GAEN,YACEG,EACK,GAAOA,EAAgB7C,EAAAA,WAAWsB,EAAUwB,EAAG,EAAGA,EAAG,CAAC,EAAGA,CAAE,EAC5D,IAAA,GAEN,OACErB,EACK,GAAU,CACT,IAAMiB,EAAQC,EAAM,KAAK,MACpBC,EAAOF,IACZjB,EAAYmB,EAAOF,GAAQA,EAAO,CAChC,EAAGC,EAAM,EACT,EAAGA,EAAM,EACT,SAAU3C,EAAAA,WAAWsB,EAAUqB,EAAM,EAAGA,EAAM,CAAC,CACjD,CAAC,CACH,EACA,IAAA,GAEN,cACEI,EACK,GAAU,CACT,IAAML,EAAQC,EAAM,MAAM,EAAE,EAAE,MAC9B,OAAOD,IAAU,IAAA,IAAaE,EAAOF,GACjCK,EAAcH,EAAOF,GAAQA,CAAK,EAClC,IACN,EACA,IAAA,EAEP,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"charts.cjs","names":["useMemo","lineSeries","ChartBase","engineOptions","areaSeries","barSeries","candlestickSeries","heatmapChartOptions","sparklineOptions","scatterSeries","quadrantChartOptions","quadrantOf","require_Chart","require_presets","react","react_jsx_runtime","frameProps","props","LineChart","input","series","area","stacked","percent","curve","AreaChart","BarChart","labels","CandlestickChart","HeatmapChart","data","xCategories","yCategories","colorScale","valueRange","name","radius","format","base","Sparkline","options","type","color","reference","renderer","tooltip","palette","ariaLabel","ref","ScatterChart","CORNERS","cornerStyle","left","corner","top","split","plot","QuadrantChart","geometry","draggable","onPointDrop","overlay","quadrantContent","x0","x1","xDomain","y0","y1","yDomain","xs","xSplit","ys","ySplit","fx","fy","reverseX","onPointClick","index","event","points","onQuadrantClick","at","renderTooltip"],"sources":["../../../../charts/src/react/charts.tsx"],"sourcesContent":["import { useMemo, type CSSProperties } from \"react\";\nimport {\n areaSeries,\n barSeries,\n candlestickSeries,\n heatmapChartOptions,\n lineSeries,\n quadrantChartOptions,\n quadrantOf,\n scatterSeries,\n sparklineOptions,\n type QuadrantCorner,\n} from \"../engine/presets\";\nimport type { ChartRect } from \"../engine/types\";\nimport { ChartBase, engineOptions } from \"./Chart\";\nimport type {\n AreaChartProps,\n BarChartProps,\n CandlestickChartProps,\n ChartCommonProps,\n HeatmapChartProps,\n LineChartProps,\n QuadrantChartProps,\n ScatterChartProps,\n SparklineProps,\n} from \"./types\";\n\nconst frameProps = (props: ChartCommonProps) => ({\n height: props.height,\n width: props.width,\n className: props.className,\n style: props.style,\n handleRef: props.ref,\n onHover: props.onHover,\n onPointClick: props.onPointClick,\n onPlotClick: props.onPlotClick,\n onZoom: props.onZoom,\n onRendererChange: props.onRendererChange,\n renderTooltip: props.renderTooltip,\n});\n\n/** Line (or area) chart; handles millions of points on the GPU */\nexport function LineChart(props: LineChartProps) {\n const {\n series: input,\n area = false,\n curve,\n stacked = false,\n percent = false,\n } = props;\n const series = useMemo(\n () => lineSeries(input, area, { curve, stacked: stacked || percent }),\n [input, area, curve, stacked, percent],\n );\n return (\n <ChartBase\n options={engineOptions({\n ...props,\n series,\n stackMode: percent ? \"percent\" : undefined,\n })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Area chart: smooth by default, stacked or 100% stacked */\nexport function AreaChart(props: AreaChartProps) {\n const {\n series: input,\n curve = \"smooth\",\n stacked = false,\n percent = false,\n } = props;\n const series = useMemo(\n () => areaSeries(input, { curve, stacked: stacked || percent }),\n [input, curve, stacked, percent],\n );\n return (\n <ChartBase\n options={engineOptions({\n ...props,\n series,\n stackMode: percent ? \"percent\" : undefined,\n })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Bar chart: grouped side by side, stacked or 100% stacked, with optional value labels */\nexport function BarChart(props: BarChartProps) {\n const {\n series: input,\n stacked = false,\n percent = false,\n labels = false,\n } = props;\n const series = useMemo(\n () => barSeries(input, stacked || percent, labels),\n [input, stacked, percent, labels],\n );\n return (\n <ChartBase\n options={engineOptions({\n ...props,\n series,\n stackMode: percent ? \"percent\" : undefined,\n })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Candlestick (OHLC) chart: rising and falling candles, zoomable on the GPU */\nexport function CandlestickChart(props: CandlestickChartProps) {\n const { series: input } = props;\n const series = useMemo(() => candlestickSeries(input), [input]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Heatmap: a grid of cells colored by value (categories or numbers on both axes) */\nexport function HeatmapChart(props: HeatmapChartProps) {\n const {\n data,\n xCategories,\n yCategories,\n colorScale,\n valueRange,\n name,\n radius,\n format,\n } = props;\n const series = useMemo(\n () =>\n heatmapChartOptions({\n data,\n xCategories,\n yCategories,\n colorScale,\n valueRange,\n name,\n radius,\n format,\n }).series,\n [\n data,\n xCategories,\n yCategories,\n colorScale,\n valueRange,\n name,\n radius,\n format,\n ],\n );\n const base = engineOptions({ ...props, series });\n return (\n <ChartBase\n options={{\n ...heatmapChartOptions(\n { data, xCategories, yCategories },\n {\n ...base,\n legend: props.legend,\n interaction: props.interaction,\n tooltip: props.tooltip,\n },\n ),\n series,\n }}\n {...frameProps(props)}\n />\n );\n}\n\n/** Word-sized chart without axes: a trend in a table cell, a KPI card, ... */\nexport function Sparkline(props: SparklineProps) {\n const {\n data,\n type,\n color,\n curve,\n name,\n reference,\n format,\n height = 48,\n width,\n renderer,\n tooltip,\n palette,\n ariaLabel,\n className,\n style,\n ref,\n onHover,\n renderTooltip,\n } = props;\n const options = useMemo(\n () =>\n sparklineOptions(\n { data, type, color, curve, name, reference, format },\n { renderer, tooltip, palette, ariaLabel },\n ),\n [\n data,\n type,\n color,\n curve,\n name,\n reference,\n format,\n renderer,\n tooltip,\n palette,\n ariaLabel,\n ],\n );\n return (\n <ChartBase\n options={options}\n height={height}\n width={width}\n className={className}\n style={style}\n handleRef={ref}\n onHover={onHover}\n renderTooltip={renderTooltip}\n />\n );\n}\n\n/** Scatter chart: zooms on both axes, hit testing through a spatial index */\nexport function ScatterChart(props: ScatterChartProps) {\n const { series: input } = props;\n const series = useMemo(() => scatterSeries(input), [input]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\nconst CORNERS: QuadrantCorner[] = [\n \"topLeft\",\n \"topRight\",\n \"bottomLeft\",\n \"bottomRight\",\n];\n\nconst cornerStyle = (\n corner: QuadrantCorner,\n plot: ChartRect,\n split: { x: number; y: number },\n): CSSProperties => {\n const left = corner.endsWith(\"Left\");\n const top = corner.startsWith(\"top\");\n return {\n position: \"absolute\",\n left: left ? 0 : split.x - plot.x,\n top: top ? 0 : split.y - plot.y,\n width: left ? split.x - plot.x : plot.x + plot.width - split.x,\n height: top ? split.y - plot.y : plot.y + plot.height - split.y,\n pointerEvents: \"none\",\n };\n};\n\n/**\n * Four-quadrant matrix (priority matrix, Eisenhower, BCG, ...): tinted\n * quadrants with titles, dividers, and labelled dots placed without\n * overlapping labels. Dots can be dragged to another quadrant.\n */\nexport function QuadrantChart(props: QuadrantChartProps) {\n const {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable,\n onPointClick,\n onPointDrop,\n onQuadrantClick,\n renderTooltip,\n quadrantContent,\n } = props;\n const geometry = { xDomain, yDomain, xSplit, ySplit, reverseX };\n\n const options = quadrantChartOptions(\n {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable: draggable ?? !!onPointDrop,\n },\n engineOptions({ ...props, series: [] }),\n );\n\n const overlay = quadrantContent\n ? (plot: ChartRect) => {\n const [x0, x1] = xDomain ?? [0, 10];\n const [y0, y1] = yDomain ?? [0, 10];\n const xs = xSplit ?? (x0 + x1) / 2;\n const ys = ySplit ?? (y0 + y1) / 2;\n const fx = (xs - x0) / (x1 - x0 || 1);\n const fy = (ys - y0) / (y1 - y0 || 1);\n const split = {\n x: plot.x + plot.width * (reverseX ? 1 - fx : fx),\n y: plot.y + plot.height * (1 - fy),\n };\n return CORNERS.map((corner) =>\n quadrantContent[corner] ? (\n <div\n key={corner}\n className={`minerva-chart-quadrant minerva-chart-quadrant-${corner}`}\n style={cornerStyle(corner, plot, split)}\n >\n {quadrantContent[corner]}\n </div>\n ) : null,\n );\n }\n : undefined;\n\n return (\n <ChartBase\n options={options}\n {...frameProps({\n ...props,\n onPointClick: undefined,\n renderTooltip: undefined,\n })}\n overlay={overlay}\n onPointClick={\n onPointClick\n ? (event) => {\n const index = event.items[0]?.index;\n if (index !== undefined && points[index])\n onPointClick(points[index], index);\n }\n : undefined\n }\n onPlotClick={\n onQuadrantClick\n ? (at) => onQuadrantClick(quadrantOf(geometry, at.x, at.y), at)\n : undefined\n }\n onDrop={\n onPointDrop\n ? (event) => {\n const index = event.item.index;\n if (!points[index]) return;\n onPointDrop(points[index], index, {\n x: event.x,\n y: event.y,\n quadrant: quadrantOf(geometry, event.x, event.y),\n });\n }\n : undefined\n }\n renderTooltip={\n renderTooltip\n ? (event) => {\n const index = event.items[0]?.index;\n return index !== undefined && points[index]\n ? renderTooltip(points[index], index)\n : null;\n }\n : undefined\n }\n />\n );\n}\n"],"mappings":"qIA2BA,IAAMgB,EAAc,IAA6B,CAC/C,OAAQC,EAAM,OACd,MAAOA,EAAM,MACb,UAAWA,EAAM,UACjB,MAAOA,EAAM,MACb,UAAWA,EAAM,IACjB,QAASA,EAAM,QACf,aAAcA,EAAM,aACpB,YAAaA,EAAM,YACnB,OAAQA,EAAM,OACd,iBAAkBA,EAAM,iBACxB,cAAeA,EAAM,aACvB,GAGA,SAAgBC,EAAU,EAAuB,CAC/C,GAAM,CACJ,OAAQC,EACR,OAAO,GACP,QACA,UAAU,GACV,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D,CAAC,CACH,EACA,IAAA,GAEN,cACEI,EACK,GAAU,CACT,IAAML,EAAQC,EAAM,MAAM,EAAE,EAAE,MAC9B,OAAOD,IAAU,IAAA,IAAaE,EAAOF,GACjCK,EAAcH,EAAOF,GAAQA,CAAK,EAClC,IACN,EACA,IAAA,EAEP,CAAA,CAEL"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { BarChartProps, LineChartProps, QuadrantChartProps, ScatterChartProps } from './types.cjs';
|
|
1
|
+
import { AreaChartProps, BarChartProps, CandlestickChartProps, HeatmapChartProps, LineChartProps, QuadrantChartProps, ScatterChartProps, SparklineProps } from './types.cjs';
|
|
2
2
|
/** Line (or area) chart; handles millions of points on the GPU */
|
|
3
3
|
export declare function LineChart(props: LineChartProps): import('react').JSX.Element;
|
|
4
|
-
/**
|
|
4
|
+
/** Area chart: smooth by default, stacked or 100% stacked */
|
|
5
|
+
export declare function AreaChart(props: AreaChartProps): import('react').JSX.Element;
|
|
6
|
+
/** Bar chart: grouped side by side, stacked or 100% stacked, with optional value labels */
|
|
5
7
|
export declare function BarChart(props: BarChartProps): import('react').JSX.Element;
|
|
8
|
+
/** Candlestick (OHLC) chart: rising and falling candles, zoomable on the GPU */
|
|
9
|
+
export declare function CandlestickChart(props: CandlestickChartProps): import('react').JSX.Element;
|
|
10
|
+
/** Heatmap: a grid of cells colored by value (categories or numbers on both axes) */
|
|
11
|
+
export declare function HeatmapChart(props: HeatmapChartProps): import('react').JSX.Element;
|
|
12
|
+
/** Word-sized chart without axes: a trend in a table cell, a KPI card, ... */
|
|
13
|
+
export declare function Sparkline(props: SparklineProps): import('react').JSX.Element;
|
|
6
14
|
/** Scatter chart: zooms on both axes, hit testing through a spatial index */
|
|
7
15
|
export declare function ScatterChart(props: ScatterChartProps): import('react').JSX.Element;
|
|
8
16
|
/**
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { BarChartProps, LineChartProps, QuadrantChartProps, ScatterChartProps } from './types.js';
|
|
1
|
+
import { AreaChartProps, BarChartProps, CandlestickChartProps, HeatmapChartProps, LineChartProps, QuadrantChartProps, ScatterChartProps, SparklineProps } from './types.js';
|
|
2
2
|
/** Line (or area) chart; handles millions of points on the GPU */
|
|
3
3
|
export declare function LineChart(props: LineChartProps): import('react').JSX.Element;
|
|
4
|
-
/**
|
|
4
|
+
/** Area chart: smooth by default, stacked or 100% stacked */
|
|
5
|
+
export declare function AreaChart(props: AreaChartProps): import('react').JSX.Element;
|
|
6
|
+
/** Bar chart: grouped side by side, stacked or 100% stacked, with optional value labels */
|
|
5
7
|
export declare function BarChart(props: BarChartProps): import('react').JSX.Element;
|
|
8
|
+
/** Candlestick (OHLC) chart: rising and falling candles, zoomable on the GPU */
|
|
9
|
+
export declare function CandlestickChart(props: CandlestickChartProps): import('react').JSX.Element;
|
|
10
|
+
/** Heatmap: a grid of cells colored by value (categories or numbers on both axes) */
|
|
11
|
+
export declare function HeatmapChart(props: HeatmapChartProps): import('react').JSX.Element;
|
|
12
|
+
/** Word-sized chart without axes: a trend in a table cell, a KPI card, ... */
|
|
13
|
+
export declare function Sparkline(props: SparklineProps): import('react').JSX.Element;
|
|
6
14
|
/** Scatter chart: zooms on both axes, hit testing through a spatial index */
|
|
7
15
|
export declare function ScatterChart(props: ScatterChartProps): import('react').JSX.Element;
|
|
8
16
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ChartBase as e, engineOptions as t } from "./Chart.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { jsx as
|
|
3
|
+
import { areaSeries as n, barSeries as r, candlestickSeries as i, heatmapChartOptions as a, lineSeries as o, quadrantChartOptions as s, quadrantOf as c, scatterSeries as l, sparklineOptions as u } from "../engine/presets.js";
|
|
4
|
+
import { useMemo as d } from "react";
|
|
5
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/charts.tsx
|
|
7
|
-
var
|
|
7
|
+
var p = (e) => ({
|
|
8
8
|
height: e.height,
|
|
9
9
|
width: e.width,
|
|
10
10
|
className: e.className,
|
|
@@ -17,42 +17,165 @@ var l = (e) => ({
|
|
|
17
17
|
onRendererChange: e.onRendererChange,
|
|
18
18
|
renderTooltip: e.renderTooltip
|
|
19
19
|
});
|
|
20
|
-
function
|
|
21
|
-
let { series:
|
|
22
|
-
|
|
20
|
+
function m(n) {
|
|
21
|
+
let { series: r, area: i = !1, curve: a, stacked: s = !1, percent: c = !1 } = n, l = d(() => o(r, i, {
|
|
22
|
+
curve: a,
|
|
23
|
+
stacked: s || c
|
|
24
|
+
}), [
|
|
25
|
+
r,
|
|
26
|
+
i,
|
|
27
|
+
a,
|
|
28
|
+
s,
|
|
29
|
+
c
|
|
30
|
+
]);
|
|
31
|
+
return /* @__PURE__ */ f(e, {
|
|
23
32
|
options: t({
|
|
24
33
|
...n,
|
|
25
|
-
series:
|
|
34
|
+
series: l,
|
|
35
|
+
stackMode: c ? "percent" : void 0
|
|
26
36
|
}),
|
|
27
|
-
...
|
|
37
|
+
...p(n)
|
|
28
38
|
});
|
|
29
39
|
}
|
|
30
|
-
function
|
|
31
|
-
let { series: i,
|
|
32
|
-
|
|
40
|
+
function h(r) {
|
|
41
|
+
let { series: i, curve: a = "smooth", stacked: o = !1, percent: s = !1 } = r, c = d(() => n(i, {
|
|
42
|
+
curve: a,
|
|
43
|
+
stacked: o || s
|
|
44
|
+
}), [
|
|
45
|
+
i,
|
|
46
|
+
a,
|
|
47
|
+
o,
|
|
48
|
+
s
|
|
49
|
+
]);
|
|
50
|
+
return /* @__PURE__ */ f(e, {
|
|
33
51
|
options: t({
|
|
34
52
|
...r,
|
|
35
|
-
series:
|
|
53
|
+
series: c,
|
|
54
|
+
stackMode: s ? "percent" : void 0
|
|
36
55
|
}),
|
|
37
|
-
...
|
|
56
|
+
...p(r)
|
|
38
57
|
});
|
|
39
58
|
}
|
|
40
|
-
function
|
|
41
|
-
let { series:
|
|
42
|
-
|
|
59
|
+
function g(n) {
|
|
60
|
+
let { series: i, stacked: a = !1, percent: o = !1, labels: s = !1 } = n, c = d(() => r(i, a || o, s), [
|
|
61
|
+
i,
|
|
62
|
+
a,
|
|
63
|
+
o,
|
|
64
|
+
s
|
|
65
|
+
]);
|
|
66
|
+
return /* @__PURE__ */ f(e, {
|
|
67
|
+
options: t({
|
|
68
|
+
...n,
|
|
69
|
+
series: c,
|
|
70
|
+
stackMode: o ? "percent" : void 0
|
|
71
|
+
}),
|
|
72
|
+
...p(n)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function _(n) {
|
|
76
|
+
let { series: r } = n, a = d(() => i(r), [r]);
|
|
77
|
+
return /* @__PURE__ */ f(e, {
|
|
78
|
+
options: t({
|
|
79
|
+
...n,
|
|
80
|
+
series: a
|
|
81
|
+
}),
|
|
82
|
+
...p(n)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function v(n) {
|
|
86
|
+
let { data: r, xCategories: i, yCategories: o, colorScale: s, valueRange: c, name: l, radius: u, format: m } = n, h = d(() => a({
|
|
87
|
+
data: r,
|
|
88
|
+
xCategories: i,
|
|
89
|
+
yCategories: o,
|
|
90
|
+
colorScale: s,
|
|
91
|
+
valueRange: c,
|
|
92
|
+
name: l,
|
|
93
|
+
radius: u,
|
|
94
|
+
format: m
|
|
95
|
+
}).series, [
|
|
96
|
+
r,
|
|
97
|
+
i,
|
|
98
|
+
o,
|
|
99
|
+
s,
|
|
100
|
+
c,
|
|
101
|
+
l,
|
|
102
|
+
u,
|
|
103
|
+
m
|
|
104
|
+
]), g = t({
|
|
105
|
+
...n,
|
|
106
|
+
series: h
|
|
107
|
+
});
|
|
108
|
+
return /* @__PURE__ */ f(e, {
|
|
109
|
+
options: {
|
|
110
|
+
...a({
|
|
111
|
+
data: r,
|
|
112
|
+
xCategories: i,
|
|
113
|
+
yCategories: o
|
|
114
|
+
}, {
|
|
115
|
+
...g,
|
|
116
|
+
legend: n.legend,
|
|
117
|
+
interaction: n.interaction,
|
|
118
|
+
tooltip: n.tooltip
|
|
119
|
+
}),
|
|
120
|
+
series: h
|
|
121
|
+
},
|
|
122
|
+
...p(n)
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function y(t) {
|
|
126
|
+
let { data: n, type: r, color: i, curve: a, name: o, reference: s, format: c, height: l = 48, width: p, renderer: m, tooltip: h, palette: g, ariaLabel: _, className: v, style: y, ref: b, onHover: x, renderTooltip: S } = t, C = d(() => u({
|
|
127
|
+
data: n,
|
|
128
|
+
type: r,
|
|
129
|
+
color: i,
|
|
130
|
+
curve: a,
|
|
131
|
+
name: o,
|
|
132
|
+
reference: s,
|
|
133
|
+
format: c
|
|
134
|
+
}, {
|
|
135
|
+
renderer: m,
|
|
136
|
+
tooltip: h,
|
|
137
|
+
palette: g,
|
|
138
|
+
ariaLabel: _
|
|
139
|
+
}), [
|
|
140
|
+
n,
|
|
141
|
+
r,
|
|
142
|
+
i,
|
|
143
|
+
a,
|
|
144
|
+
o,
|
|
145
|
+
s,
|
|
146
|
+
c,
|
|
147
|
+
m,
|
|
148
|
+
h,
|
|
149
|
+
g,
|
|
150
|
+
_
|
|
151
|
+
]);
|
|
152
|
+
return /* @__PURE__ */ f(e, {
|
|
153
|
+
options: C,
|
|
154
|
+
height: l,
|
|
155
|
+
width: p,
|
|
156
|
+
className: v,
|
|
157
|
+
style: y,
|
|
158
|
+
handleRef: b,
|
|
159
|
+
onHover: x,
|
|
160
|
+
renderTooltip: S
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function b(n) {
|
|
164
|
+
let { series: r } = n, i = d(() => l(r), [r]);
|
|
165
|
+
return /* @__PURE__ */ f(e, {
|
|
43
166
|
options: t({
|
|
44
167
|
...n,
|
|
45
168
|
series: i
|
|
46
169
|
}),
|
|
47
|
-
...
|
|
170
|
+
...p(n)
|
|
48
171
|
});
|
|
49
172
|
}
|
|
50
|
-
var
|
|
173
|
+
var x = [
|
|
51
174
|
"topLeft",
|
|
52
175
|
"topRight",
|
|
53
176
|
"bottomLeft",
|
|
54
177
|
"bottomRight"
|
|
55
|
-
],
|
|
178
|
+
], S = (e, t, n) => {
|
|
56
179
|
let r = e.endsWith("Left"), i = e.startsWith("top");
|
|
57
180
|
return {
|
|
58
181
|
position: "absolute",
|
|
@@ -63,46 +186,46 @@ var p = [
|
|
|
63
186
|
pointerEvents: "none"
|
|
64
187
|
};
|
|
65
188
|
};
|
|
66
|
-
function
|
|
67
|
-
let { points: r, xDomain:
|
|
68
|
-
xDomain:
|
|
69
|
-
yDomain:
|
|
70
|
-
xSplit:
|
|
71
|
-
ySplit:
|
|
72
|
-
reverseX:
|
|
73
|
-
}, A =
|
|
189
|
+
function C(n) {
|
|
190
|
+
let { points: r, xDomain: i, yDomain: a, xSplit: o, ySplit: l, quadrants: u, xLabel: d, yLabel: m, axisLabels: h, showTicks: g, reverseX: _, showLabels: v, pointSize: y, name: b, draggable: C, onPointClick: w, onPointDrop: T, onQuadrantClick: E, renderTooltip: D, quadrantContent: O } = n, k = {
|
|
191
|
+
xDomain: i,
|
|
192
|
+
yDomain: a,
|
|
193
|
+
xSplit: o,
|
|
194
|
+
ySplit: l,
|
|
195
|
+
reverseX: _
|
|
196
|
+
}, A = s({
|
|
74
197
|
points: r,
|
|
75
|
-
xDomain:
|
|
76
|
-
yDomain:
|
|
77
|
-
xSplit:
|
|
78
|
-
ySplit:
|
|
79
|
-
quadrants:
|
|
80
|
-
xLabel:
|
|
81
|
-
yLabel:
|
|
82
|
-
axisLabels:
|
|
83
|
-
showTicks:
|
|
84
|
-
reverseX:
|
|
85
|
-
showLabels:
|
|
86
|
-
pointSize:
|
|
87
|
-
name:
|
|
198
|
+
xDomain: i,
|
|
199
|
+
yDomain: a,
|
|
200
|
+
xSplit: o,
|
|
201
|
+
ySplit: l,
|
|
202
|
+
quadrants: u,
|
|
203
|
+
xLabel: d,
|
|
204
|
+
yLabel: m,
|
|
205
|
+
axisLabels: h,
|
|
206
|
+
showTicks: g,
|
|
207
|
+
reverseX: _,
|
|
208
|
+
showLabels: v,
|
|
209
|
+
pointSize: y,
|
|
210
|
+
name: b,
|
|
88
211
|
draggable: C ?? !!T
|
|
89
212
|
}, t({
|
|
90
213
|
...n,
|
|
91
214
|
series: []
|
|
92
215
|
})), j = O ? (e) => {
|
|
93
|
-
let [t, n] =
|
|
94
|
-
x: e.x + e.width * (
|
|
95
|
-
y: e.y + e.height * (1 -
|
|
216
|
+
let [t, n] = i ?? [0, 10], [r, s] = a ?? [0, 10], c = o ?? (t + n) / 2, u = l ?? (r + s) / 2, d = (c - t) / (n - t || 1), p = (u - r) / (s - r || 1), m = {
|
|
217
|
+
x: e.x + e.width * (_ ? 1 - d : d),
|
|
218
|
+
y: e.y + e.height * (1 - p)
|
|
96
219
|
};
|
|
97
|
-
return
|
|
220
|
+
return x.map((t) => O[t] ? /* @__PURE__ */ f("div", {
|
|
98
221
|
className: `minerva-chart-quadrant minerva-chart-quadrant-${t}`,
|
|
99
|
-
style:
|
|
222
|
+
style: S(t, e, m),
|
|
100
223
|
children: O[t]
|
|
101
224
|
}, t) : null);
|
|
102
225
|
} : void 0;
|
|
103
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ f(e, {
|
|
104
227
|
options: A,
|
|
105
|
-
...
|
|
228
|
+
...p({
|
|
106
229
|
...n,
|
|
107
230
|
onPointClick: void 0,
|
|
108
231
|
renderTooltip: void 0
|
|
@@ -112,13 +235,13 @@ function h(n) {
|
|
|
112
235
|
let t = e.items[0]?.index;
|
|
113
236
|
t !== void 0 && r[t] && w(r[t], t);
|
|
114
237
|
} : void 0,
|
|
115
|
-
onPlotClick: E ? (e) => E(
|
|
238
|
+
onPlotClick: E ? (e) => E(c(k, e.x, e.y), e) : void 0,
|
|
116
239
|
onDrop: T ? (e) => {
|
|
117
240
|
let t = e.item.index;
|
|
118
241
|
r[t] && T(r[t], t, {
|
|
119
242
|
x: e.x,
|
|
120
243
|
y: e.y,
|
|
121
|
-
quadrant:
|
|
244
|
+
quadrant: c(k, e.x, e.y)
|
|
122
245
|
});
|
|
123
246
|
} : void 0,
|
|
124
247
|
renderTooltip: D ? (e) => {
|
|
@@ -128,6 +251,6 @@ function h(n) {
|
|
|
128
251
|
});
|
|
129
252
|
}
|
|
130
253
|
//#endregion
|
|
131
|
-
export {
|
|
254
|
+
export { h as AreaChart, g as BarChart, _ as CandlestickChart, v as HeatmapChart, m as LineChart, C as QuadrantChart, b as ScatterChart, y as Sparkline };
|
|
132
255
|
|
|
133
256
|
//# sourceMappingURL=charts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.js","names":["frameProps","props","LineChart","input","series","useMemo","lineSeries","area","ChartBase","engineOptions","BarChart","barSeries","stacked","ScatterChart","scatterSeries","CORNERS","cornerStyle","left","corner","top","split","plot","QuadrantChart","geometry","options","quadrantChartOptions","draggable","onPointDrop","overlay","quadrantContent","x0","x1","xDomain","y0","y1","yDomain","xs","xSplit","ys","ySplit","fx","fy","reverseX","onPointClick","index","event","points","onQuadrantClick","quadrantOf","at","renderTooltip"],"sources":["../../../../charts/src/react/charts.tsx"],"sourcesContent":["import { useMemo, type CSSProperties } from \"react\";\nimport {\n barSeries,\n lineSeries,\n quadrantChartOptions,\n quadrantOf,\n scatterSeries,\n type QuadrantCorner,\n} from \"../engine/presets\";\nimport type { ChartRect } from \"../engine/types\";\nimport { ChartBase, engineOptions } from \"./Chart\";\nimport type {\n BarChartProps,\n ChartCommonProps,\n LineChartProps,\n QuadrantChartProps,\n ScatterChartProps,\n} from \"./types\";\n\nconst frameProps = (props: ChartCommonProps) => ({\n height: props.height,\n width: props.width,\n className: props.className,\n style: props.style,\n handleRef: props.ref,\n onHover: props.onHover,\n onPointClick: props.onPointClick,\n onPlotClick: props.onPlotClick,\n onZoom: props.onZoom,\n onRendererChange: props.onRendererChange,\n renderTooltip: props.renderTooltip,\n});\n\n/** Line (or area) chart; handles millions of points on the GPU */\nexport function LineChart(props: LineChartProps) {\n const { series: input, area = false } = props;\n const series = useMemo(() => lineSeries(input, area), [input, area]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Bar chart: grouped side by side, or stacked */\nexport function BarChart(props: BarChartProps) {\n const { series: input, stacked = false } = props;\n const series = useMemo(() => barSeries(input, stacked), [input, stacked]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Scatter chart: zooms on both axes, hit testing through a spatial index */\nexport function ScatterChart(props: ScatterChartProps) {\n const { series: input } = props;\n const series = useMemo(() => scatterSeries(input), [input]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\nconst CORNERS: QuadrantCorner[] = [\n \"topLeft\",\n \"topRight\",\n \"bottomLeft\",\n \"bottomRight\",\n];\n\nconst cornerStyle = (\n corner: QuadrantCorner,\n plot: ChartRect,\n split: { x: number; y: number },\n): CSSProperties => {\n const left = corner.endsWith(\"Left\");\n const top = corner.startsWith(\"top\");\n return {\n position: \"absolute\",\n left: left ? 0 : split.x - plot.x,\n top: top ? 0 : split.y - plot.y,\n width: left ? split.x - plot.x : plot.x + plot.width - split.x,\n height: top ? split.y - plot.y : plot.y + plot.height - split.y,\n pointerEvents: \"none\",\n };\n};\n\n/**\n * Four-quadrant matrix (priority matrix, Eisenhower, BCG, ...): tinted\n * quadrants with titles, dividers, and labelled dots placed without\n * overlapping labels. Dots can be dragged to another quadrant.\n */\nexport function QuadrantChart(props: QuadrantChartProps) {\n const {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable,\n onPointClick,\n onPointDrop,\n onQuadrantClick,\n renderTooltip,\n quadrantContent,\n } = props;\n const geometry = { xDomain, yDomain, xSplit, ySplit, reverseX };\n\n const options = quadrantChartOptions(\n {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable: draggable ?? !!onPointDrop,\n },\n engineOptions({ ...props, series: [] }),\n );\n\n const overlay = quadrantContent\n ? (plot: ChartRect) => {\n const [x0, x1] = xDomain ?? [0, 10];\n const [y0, y1] = yDomain ?? [0, 10];\n const xs = xSplit ?? (x0 + x1) / 2;\n const ys = ySplit ?? (y0 + y1) / 2;\n const fx = (xs - x0) / (x1 - x0 || 1);\n const fy = (ys - y0) / (y1 - y0 || 1);\n const split = {\n x: plot.x + plot.width * (reverseX ? 1 - fx : fx),\n y: plot.y + plot.height * (1 - fy),\n };\n return CORNERS.map((corner) =>\n quadrantContent[corner] ? (\n <div\n key={corner}\n className={`minerva-chart-quadrant minerva-chart-quadrant-${corner}`}\n style={cornerStyle(corner, plot, split)}\n >\n {quadrantContent[corner]}\n </div>\n ) : null,\n );\n }\n : undefined;\n\n return (\n <ChartBase\n options={options}\n {...frameProps({\n ...props,\n onPointClick: undefined,\n renderTooltip: undefined,\n })}\n overlay={overlay}\n onPointClick={\n onPointClick\n ? (event) => {\n const index = event.items[0]?.index;\n if (index !== undefined && points[index])\n onPointClick(points[index], index);\n }\n : undefined\n }\n onPlotClick={\n onQuadrantClick\n ? (at) => onQuadrantClick(quadrantOf(geometry, at.x, at.y), at)\n : undefined\n }\n onDrop={\n onPointDrop\n ? (event) => {\n const index = event.item.index;\n if (!points[index]) return;\n onPointDrop(points[index], index, {\n x: event.x,\n y: event.y,\n quadrant: quadrantOf(geometry, event.x, event.y),\n });\n }\n : undefined\n }\n renderTooltip={\n renderTooltip\n ? (event) => {\n const index = event.items[0]?.index;\n return index !== undefined && points[index]\n ? renderTooltip(points[index], index)\n : null;\n }\n : undefined\n }\n />\n );\n}\n"],"mappings":";;;;;;AAmBA,IAAMA,KAAc,OAA6B;CAC/C,QAAQC,EAAM;CACd,OAAOA,EAAM;CACb,WAAWA,EAAM;CAC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jB,CAAC;EACQ;EACT,cACE0C,KACK,MAAU;GACT,IAAMC,IAAQC,EAAM,MAAM,EAAE,EAAE;GAC9B,AAAID,MAAU,KAAA,KAAaE,EAAOF,MAChCD,EAAaG,EAAOF,IAAQA,CAAK;EACrC,IACA,KAAA;EAEN,aACEG,KACK,MAAOA,EAAgBC,EAAWzB,GAAU0B,EAAG,GAAGA,EAAG,CAAC,GAAGA,CAAE,IAC5D,KAAA;EAEN,QACEtB,KACK,MAAU;GACT,IAAMiB,IAAQC,EAAM,KAAK;GACzB,AAAKC,EAAOF,MACZjB,EAAYmB,EAAOF,IAAQA,GAAO;IAChC,GAAGC,EAAM;IACT,GAAGA,EAAM;IACT,UAAUG,EAAWzB,GAAUsB,EAAM,GAAGA,EAAM,CAAC;GACjD,CAAC;EACH,IACA,KAAA;EAEN,eACEK,KACK,MAAU;GACT,IAAMN,IAAQC,EAAM,MAAM,EAAE,EAAE;GAC9B,OAAOD,MAAU,KAAA,KAAaE,EAAOF,KACjCM,EAAcJ,EAAOF,IAAQA,CAAK,IAClC;EACN,IACA,KAAA;CAEP,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"charts.js","names":["frameProps","props","LineChart","input","series","useMemo","lineSeries","area","stacked","percent","curve","ChartBase","engineOptions","AreaChart","areaSeries","BarChart","barSeries","labels","CandlestickChart","candlestickSeries","HeatmapChart","heatmapChartOptions","data","xCategories","yCategories","colorScale","valueRange","name","radius","format","base","Sparkline","options","sparklineOptions","type","color","reference","renderer","tooltip","palette","ariaLabel","ref","ScatterChart","scatterSeries","CORNERS","cornerStyle","left","corner","top","split","plot","QuadrantChart","geometry","quadrantChartOptions","draggable","onPointDrop","overlay","quadrantContent","x0","x1","xDomain","y0","y1","yDomain","xs","xSplit","ys","ySplit","fx","fy","reverseX","onPointClick","index","event","points","onQuadrantClick","quadrantOf","at","renderTooltip"],"sources":["../../../../charts/src/react/charts.tsx"],"sourcesContent":["import { useMemo, type CSSProperties } from \"react\";\nimport {\n areaSeries,\n barSeries,\n candlestickSeries,\n heatmapChartOptions,\n lineSeries,\n quadrantChartOptions,\n quadrantOf,\n scatterSeries,\n sparklineOptions,\n type QuadrantCorner,\n} from \"../engine/presets\";\nimport type { ChartRect } from \"../engine/types\";\nimport { ChartBase, engineOptions } from \"./Chart\";\nimport type {\n AreaChartProps,\n BarChartProps,\n CandlestickChartProps,\n ChartCommonProps,\n HeatmapChartProps,\n LineChartProps,\n QuadrantChartProps,\n ScatterChartProps,\n SparklineProps,\n} from \"./types\";\n\nconst frameProps = (props: ChartCommonProps) => ({\n height: props.height,\n width: props.width,\n className: props.className,\n style: props.style,\n handleRef: props.ref,\n onHover: props.onHover,\n onPointClick: props.onPointClick,\n onPlotClick: props.onPlotClick,\n onZoom: props.onZoom,\n onRendererChange: props.onRendererChange,\n renderTooltip: props.renderTooltip,\n});\n\n/** Line (or area) chart; handles millions of points on the GPU */\nexport function LineChart(props: LineChartProps) {\n const {\n series: input,\n area = false,\n curve,\n stacked = false,\n percent = false,\n } = props;\n const series = useMemo(\n () => lineSeries(input, area, { curve, stacked: stacked || percent }),\n [input, area, curve, stacked, percent],\n );\n return (\n <ChartBase\n options={engineOptions({\n ...props,\n series,\n stackMode: percent ? \"percent\" : undefined,\n })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Area chart: smooth by default, stacked or 100% stacked */\nexport function AreaChart(props: AreaChartProps) {\n const {\n series: input,\n curve = \"smooth\",\n stacked = false,\n percent = false,\n } = props;\n const series = useMemo(\n () => areaSeries(input, { curve, stacked: stacked || percent }),\n [input, curve, stacked, percent],\n );\n return (\n <ChartBase\n options={engineOptions({\n ...props,\n series,\n stackMode: percent ? \"percent\" : undefined,\n })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Bar chart: grouped side by side, stacked or 100% stacked, with optional value labels */\nexport function BarChart(props: BarChartProps) {\n const {\n series: input,\n stacked = false,\n percent = false,\n labels = false,\n } = props;\n const series = useMemo(\n () => barSeries(input, stacked || percent, labels),\n [input, stacked, percent, labels],\n );\n return (\n <ChartBase\n options={engineOptions({\n ...props,\n series,\n stackMode: percent ? \"percent\" : undefined,\n })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Candlestick (OHLC) chart: rising and falling candles, zoomable on the GPU */\nexport function CandlestickChart(props: CandlestickChartProps) {\n const { series: input } = props;\n const series = useMemo(() => candlestickSeries(input), [input]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\n/** Heatmap: a grid of cells colored by value (categories or numbers on both axes) */\nexport function HeatmapChart(props: HeatmapChartProps) {\n const {\n data,\n xCategories,\n yCategories,\n colorScale,\n valueRange,\n name,\n radius,\n format,\n } = props;\n const series = useMemo(\n () =>\n heatmapChartOptions({\n data,\n xCategories,\n yCategories,\n colorScale,\n valueRange,\n name,\n radius,\n format,\n }).series,\n [\n data,\n xCategories,\n yCategories,\n colorScale,\n valueRange,\n name,\n radius,\n format,\n ],\n );\n const base = engineOptions({ ...props, series });\n return (\n <ChartBase\n options={{\n ...heatmapChartOptions(\n { data, xCategories, yCategories },\n {\n ...base,\n legend: props.legend,\n interaction: props.interaction,\n tooltip: props.tooltip,\n },\n ),\n series,\n }}\n {...frameProps(props)}\n />\n );\n}\n\n/** Word-sized chart without axes: a trend in a table cell, a KPI card, ... */\nexport function Sparkline(props: SparklineProps) {\n const {\n data,\n type,\n color,\n curve,\n name,\n reference,\n format,\n height = 48,\n width,\n renderer,\n tooltip,\n palette,\n ariaLabel,\n className,\n style,\n ref,\n onHover,\n renderTooltip,\n } = props;\n const options = useMemo(\n () =>\n sparklineOptions(\n { data, type, color, curve, name, reference, format },\n { renderer, tooltip, palette, ariaLabel },\n ),\n [\n data,\n type,\n color,\n curve,\n name,\n reference,\n format,\n renderer,\n tooltip,\n palette,\n ariaLabel,\n ],\n );\n return (\n <ChartBase\n options={options}\n height={height}\n width={width}\n className={className}\n style={style}\n handleRef={ref}\n onHover={onHover}\n renderTooltip={renderTooltip}\n />\n );\n}\n\n/** Scatter chart: zooms on both axes, hit testing through a spatial index */\nexport function ScatterChart(props: ScatterChartProps) {\n const { series: input } = props;\n const series = useMemo(() => scatterSeries(input), [input]);\n return (\n <ChartBase\n options={engineOptions({ ...props, series })}\n {...frameProps(props)}\n />\n );\n}\n\nconst CORNERS: QuadrantCorner[] = [\n \"topLeft\",\n \"topRight\",\n \"bottomLeft\",\n \"bottomRight\",\n];\n\nconst cornerStyle = (\n corner: QuadrantCorner,\n plot: ChartRect,\n split: { x: number; y: number },\n): CSSProperties => {\n const left = corner.endsWith(\"Left\");\n const top = corner.startsWith(\"top\");\n return {\n position: \"absolute\",\n left: left ? 0 : split.x - plot.x,\n top: top ? 0 : split.y - plot.y,\n width: left ? split.x - plot.x : plot.x + plot.width - split.x,\n height: top ? split.y - plot.y : plot.y + plot.height - split.y,\n pointerEvents: \"none\",\n };\n};\n\n/**\n * Four-quadrant matrix (priority matrix, Eisenhower, BCG, ...): tinted\n * quadrants with titles, dividers, and labelled dots placed without\n * overlapping labels. Dots can be dragged to another quadrant.\n */\nexport function QuadrantChart(props: QuadrantChartProps) {\n const {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable,\n onPointClick,\n onPointDrop,\n onQuadrantClick,\n renderTooltip,\n quadrantContent,\n } = props;\n const geometry = { xDomain, yDomain, xSplit, ySplit, reverseX };\n\n const options = quadrantChartOptions(\n {\n points,\n xDomain,\n yDomain,\n xSplit,\n ySplit,\n quadrants,\n xLabel,\n yLabel,\n axisLabels,\n showTicks,\n reverseX,\n showLabels,\n pointSize,\n name,\n draggable: draggable ?? !!onPointDrop,\n },\n engineOptions({ ...props, series: [] }),\n );\n\n const overlay = quadrantContent\n ? (plot: ChartRect) => {\n const [x0, x1] = xDomain ?? [0, 10];\n const [y0, y1] = yDomain ?? [0, 10];\n const xs = xSplit ?? (x0 + x1) / 2;\n const ys = ySplit ?? (y0 + y1) / 2;\n const fx = (xs - x0) / (x1 - x0 || 1);\n const fy = (ys - y0) / (y1 - y0 || 1);\n const split = {\n x: plot.x + plot.width * (reverseX ? 1 - fx : fx),\n y: plot.y + plot.height * (1 - fy),\n };\n return CORNERS.map((corner) =>\n quadrantContent[corner] ? (\n <div\n key={corner}\n className={`minerva-chart-quadrant minerva-chart-quadrant-${corner}`}\n style={cornerStyle(corner, plot, split)}\n >\n {quadrantContent[corner]}\n </div>\n ) : null,\n );\n }\n : undefined;\n\n return (\n <ChartBase\n options={options}\n {...frameProps({\n ...props,\n onPointClick: undefined,\n renderTooltip: undefined,\n })}\n overlay={overlay}\n onPointClick={\n onPointClick\n ? (event) => {\n const index = event.items[0]?.index;\n if (index !== undefined && points[index])\n onPointClick(points[index], index);\n }\n : undefined\n }\n onPlotClick={\n onQuadrantClick\n ? (at) => onQuadrantClick(quadrantOf(geometry, at.x, at.y), at)\n : undefined\n }\n onDrop={\n onPointDrop\n ? (event) => {\n const index = event.item.index;\n if (!points[index]) return;\n onPointDrop(points[index], index, {\n x: event.x,\n y: event.y,\n quadrant: quadrantOf(geometry, event.x, event.y),\n });\n }\n : undefined\n }\n renderTooltip={\n renderTooltip\n ? (event) => {\n const index = event.items[0]?.index;\n return index !== undefined && points[index]\n ? renderTooltip(points[index], index)\n : null;\n }\n : undefined\n }\n />\n );\n}\n"],"mappings":";;;;;;AA2BA,IAAMA,KAAc,OAA6B;CAC/C,QAAQC,EAAM;CACd,OAAOA,EAAM;CACb,WAAWA,EAAM;CACjB,OAAOA,EAAM;CACb,WAAWA,EAAM;CACjB,SAASA,EAAM;CACf,cAAcA,EAAM;CACpB,aAAaA,EAAM;CACnB,QAAQA,EAAM;CACd,kBAAkBA,EAAM;CACxB,eAAeA,EAAM;AACvB;AAGA,SAAgBC,EAAU,GAAuB;CAC/C,IAAM,EACJ,QAAQC,GACR,UAAO,IACP,UACA,aAAU,IACV,aAAU,OACRF,GACEG,IAASC,QACPC,EAAWH,G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BACA,gBACA,eACA,eACA,SACA,WACA,cACEnB,GACEG,IAASC,QAEXgB,EAAoB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,CAAC,QACL;EACEC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;EACAC;CACF,CACF,GACMC,IAAOlB,EAAc;EAAE,GAAGX;EAAO;CAAO,CAAC;CAC/C,OACE,kBAACU,GAAD;EACE,SAAS;GACP,GAAGU,EACD;IAAE;IAAM;IAAa;GAAY,GACjC;IACE,GAAGS;IACH,QAAQ7B,EAAM;IACd,aAAaA,EAAM;IACnB,SAASA,EAAM;GACjB,CACF;GACA;EACF;EACA,GAAID,EAAWC,CAAK;CACrB,CAAA;AAEL;AAGA,SAAgB8B,EAAU,GAAuB;CAC/C,IAAM,EACJ,SACA,SACA,UACA,UACA,SACA,cACA,WACA,YAAS,IACT,UACA,aACA,YACA,YACA,cACA,cACA,UACA,QACA,YACA,qBACE9B,GACE+B,IAAU3B,QAEZ4B,EACE;EAAE;EAAM;EAAM;EAAO;EAAO;EAAM;EAAW;CAAO,GACpD;EAAE;EAAU;EAAS;EAAS;CAAU,CAC1C,GACF;EACEX;EACAY;EACAC;EACAzB;EACAiB;EACAS;EACAP;EACAQ;EACAC;EACAC;EACAC;CACF,CACF;CACA,OACE,kBAAC7B,GAAD;EACW;EACD;EACD;EACI;EACJ;EACP,WAAW8B;EACF;EACM;CAChB,CAAA;AAEL;AAGA,SAAgBC,EAAa,GAA0B;CACrD,IAAM,EAAE,QAAQvC,MAAUF,GACpBG,IAASC,QAAcsC,EAAcxC,CAAK,GAAG,CAACA,CAAK,CAAC;CAC1D,OACE,kBAACQ,GAAD;EACE,SAASC,EAAc;GAAE,GAAGX;GAAO;EAAO,CAAC;EAC3C,GAAID,EAAWC,CAAK;CACrB,CAAA;AAEL;AAEA,IAAM2C,IAA4B;CAChC;CACA;CACA;CACA;AACF,GAEMC,KACJ,GACA,GACA,MACkB;CAClB,IAAMC,IAAO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AEE,WAAW,iDAAiDA;GAC5D,OAAOF,EAAYE,GAAQG,GAAMD,CAAK;GAErC,UAAAQ,EAAgBV;EACd,GALEA,CAKF,IACH,IACN;CACF,IACA,KAAA;CAEJ,OACE,kBAACpC,GAAD;EACW;EACT,GAAIX,EAAW;GACb,GAAGC;GACH,cAAc,KAAA;GACd,eAAe,KAAA;EACjB,CAAC;EACQ;EACT,cACEsE,KACK,MAAU;GACT,IAAMC,IAAQC,EAAM,MAAM,EAAE,EAAE;GAC9B,AAAID,MAAU,KAAA,KAAaE,EAAOF,MAChCD,EAAaG,EAAOF,IAAQA,CAAK;EACrC,IACA,KAAA;EAEN,aACEG,KACK,MAAOA,EAAgBC,EAAWxB,GAAUyB,EAAG,GAAGA,EAAG,CAAC,GAAGA,CAAE,IAC5D,KAAA;EAEN,QACEtB,KACK,MAAU;GACT,IAAMiB,IAAQC,EAAM,KAAK;GACzB,AAAKC,EAAOF,MACZjB,EAAYmB,EAAOF,IAAQA,GAAO;IAChC,GAAGC,EAAM;IACT,GAAGA,EAAM;IACT,UAAUG,EAAWxB,GAAUqB,EAAM,GAAGA,EAAM,CAAC;GACjD,CAAC;EACH,IACA,KAAA;EAEN,eACEK,KACK,MAAU;GACT,IAAMN,IAAQC,EAAM,MAAM,EAAE,EAAE;GAC9B,OAAOD,MAAU,KAAA,KAAaE,EAAOF,KACjCM,EAAcJ,EAAOF,IAAQA,CAAK,IAClC;EACN,IACA,KAAA;CAEP,CAAA;AAEL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";const e=require("../engine/shapes/chart.cjs");let t=require("react"),n=require("react-dom"),r=require("react/jsx-runtime");var i=(e,t)=>e===void 0?t:typeof e==`number`?`${e}px`:e,a=({palette:e,legend:n,tooltip:r,format:i,percentFormat:a,hidden:o,animation:s,padding:c,ariaLabel:l})=>{let u=o?o.join(`,`):null,d=(0,t.useMemo)(()=>u===null?void 0:u?u.split(`,`).map(Number):[],[u]);return(0,t.useMemo)(()=>({palette:e,legend:n,tooltip:r,format:i,percentFormat:a,hidden:d,animation:s,padding:c,ariaLabel:l}),[e,n,r,i,a,d,s,c,l])};function o({options:a,height:o,width:s,className:c,style:l,handleRef:u,renderTooltip:d,...f}){let p=(0,t.useRef)(null),m=(0,t.useRef)(null),h=(0,t.useRef)(f),g=(0,t.useRef)(d),[_,v]=(0,t.useState)(null),y=(0,t.useMemo)(()=>typeof document>`u`?null:document.createElement(`div`),[]),b=!!d,x=(0,t.useMemo)(()=>{if(!b||!y||a.tooltip===!1)return a;let e=typeof a.tooltip==`object`?a.tooltip:{};return{...a,tooltip:{...e,render:e=>g.current?((0,n.flushSync)(()=>v(e)),y):null}}},[a,b,y]),S=(0,t.useRef)(x);return(0,t.useEffect)(()=>{h.current=f,g.current=d}),(0,t.useEffect)(()=>{let t=p.current;if(!t)return;let n=e.createShapeChart(t,S.current);m.current=n;let r=[n.on(`hover`,e=>h.current.onHover?.(e)),n.on(`click`,e=>h.current.onClick?.(e)),n.on(`toggle`,e=>h.current.onToggle?.(e))];return()=>{r.forEach(e=>e()),n.destroy(),m.current=null}},[]),(0,t.useEffect)(()=>{S.current!==x&&(S.current=x,m.current?.setOptions(x))},[x]),(0,t.useImperativeHandle)(u,()=>({getInstance:()=>m.current}),[]),(0,r.jsxs)(`div`,{className:c,style:{position:`relative`,width:i(s,`100%`),height:i(o,`320px`),...l},children:[(0,r.jsx)(`div`,{ref:p,style:{position:`absolute`,inset:0}}),y&&_&&d&&(0,n.createPortal)(d(_),y)]})}function s(e){return(0,r.jsx)(l,{...e,defaultInner:0})}function c(e){return(0,r.jsx)(l,{...e,defaultInner:.62})}function l(e){let{data:n,innerRadius:i,startAngle:o,padAngle:s,cornerRadius:c,rose:l,labels:u,labelContent:d,centerValue:f,centerLabel:p,defaultInner:h}=e,g=a(e),_=(0,t.useMemo)(()=>({...g,type:`pie`,data:n,innerRadius:i??h,startAngle:o,padAngle:s,cornerRadius:c,rose:l,labels:u,labelContent:d,centerValue:f,centerLabel:p}),[g,n,i,h,o,s,c,l,u,d,f,p]);return(0,r.jsx)(m,{props:e,options:_,defaultHeight:320})}function u(e){let{indicators:n,series:i,shape:o,levels:s,dots:c}=e,l=a(e),u=(0,t.useMemo)(()=>({...l,type:`radar`,indicators:n,series:i,shape:o,levels:s,dots:c}),[l,n,i,o,s,c]);return(0,r.jsx)(m,{props:e,options:u,defaultHeight:320})}function d(e){let{value:n,min:i,max:o,label:s,sweep:c,thickness:l,bands:u,color:d,needle:f,ticks:p}=e,h=a(e),g=(0,t.useMemo)(()=>({...h,type:`gauge`,value:n,min:i,max:o,label:s,sweep:c,thickness:l,bands:u,color:d,needle:f,ticks:p}),[h,n,i,o,s,c,l,u,d,f,p]);return(0,r.jsx)(m,{props:e,options:g,defaultHeight:240})}function f(e){let{data:n,sort:i,gap:o,conversion:s,shape:c}=e,l=a(e),u=(0,t.useMemo)(()=>({...l,type:`funnel`,data:n,sort:i,gap:o,conversion:s,shape:c}),[l,n,i,o,s,c]);return(0,r.jsx)(m,{props:e,options:u,defaultHeight:320})}function p(e){let{data:n,gap:i,headers:o}=e,s=a(e),c=(0,t.useMemo)(()=>({...s,type:`treemap`,data:n,gap:i,headers:o}),[s,n,i,o]);return(0,r.jsx)(m,{props:e,options:c,defaultHeight:320})}function m({props:e,options:t,defaultHeight:n}){return(0,r.jsx)(o,{options:t,height:e.height??n,width:e.width,className:e.className,style:e.style,handleRef:e.ref,onHover:e.onHover,onClick:e.onClick,onToggle:e.onToggle,renderTooltip:e.renderTooltip})}exports.DonutChart=c,exports.FunnelChart=f,exports.GaugeChart=d,exports.PieChart=s,exports.RadarChart=u,exports.TreemapChart=p;
|
|
2
|
+
//# sourceMappingURL=shapes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.cjs","names":["useMemo","useRef","useState","createShapeChart","createPortal","require_chart","react","react_dom","react_jsx_runtime","size","value","fallback","useCommonOptions","hiddenKey","hidden","stableHidden","palette","legend","tooltip","format","percentFormat","animation","padding","ariaLabel","ShapeChartBase","handlers","containerRef","chartRef","handlersRef","tooltipRef","renderTooltip","tipEvent","setTipEvent","tipHost","customTooltip","resolved","options","base","event","optionsRef","container","chart","offs","off","handleRef","width","height","style","PieChart","PieBase","props","DonutChart","common","innerRadius","defaultInner","data","startAngle","padAngle","cornerRadius","rose","labels","labelContent","centerValue","centerLabel","ShapeHost","RadarChart","indicators","series","shape","levels","dots","GaugeChart","min","max","label","sweep","thickness","bands","color","needle","ticks","FunnelChart","sort","gap","conversion","TreemapChart","headers","defaultHeight"],"sources":["../../../../charts/src/react/shapes.tsx"],"sourcesContent":["import {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport type { ChartPadding } from \"../engine/types\";\nimport { createShapeChart } from \"../engine/shapes/chart\";\nimport type {\n FunnelChartOptions,\n GaugeBand,\n GaugeChartOptions,\n PieChartOptions,\n RadarChartOptions,\n RadarIndicator,\n RadarSeries,\n ShapeChartCommonOptions,\n ShapeChartInstance,\n ShapeChartOptions,\n ShapeDatum,\n ShapeHoverEvent,\n ShapeLegendOptions,\n ShapeToggleEvent,\n ShapeTooltipOptions,\n TreemapChartOptions,\n TreemapNode,\n} from \"../engine/shapes/types\";\n\n/** Imperative handle of the shape chart components (`ref`) */\nexport interface ShapeChartHandle {\n /** The underlying engine instance (minerva-design/charts/core) */\n getInstance(): ShapeChartInstance | null;\n}\n\n/** Props shared by PieChart, DonutChart, RadarChart, GaugeChart, FunnelChart and TreemapChart */\nexport interface ShapeChartCommonProps {\n /**\n * Height of the chart (the legend included); numbers are pixels\n * @default 320 (GaugeChart: 240)\n */\n height?: number | string;\n /**\n * Width of the chart; numbers are pixels\n * @default \"100%\"\n */\n width?: number | string;\n /** Colors of the marks without `color` (defaults to the `--chart-series-1..8` CSS variables, then the theme colors) */\n palette?: readonly string[];\n /**\n * Legend; clicking an item hides / shows its slice, stage or series\n * @default shown for pie, donut, funnel and multi-series radar charts\n */\n legend?: boolean | ShapeLegendOptions;\n /**\n * Tooltip; `false` disables it\n * @default true\n */\n tooltip?: boolean | ShapeTooltipOptions;\n /**\n * Formats the values of the labels and the tooltip\n * @default compact numbers (1.2k, 3.4M)\n */\n format?: (value: number) => string;\n /**\n * Formats the shares (labels, conversion rates, tooltip); `share` is 0-1\n * @default one decimal, e.g. \"40.0%\"\n */\n percentFormat?: (share: number) => string;\n /**\n * Hidden slices / stages / radar series / top-level treemap nodes, by\n * index. Makes the visibility controlled: legend clicks then only call\n * `onToggle`, whose `hiddenIndexes` should be stored and passed back.\n * Leave undefined to let the legend hide / show entries by itself.\n */\n hidden?: readonly number[];\n /**\n * Called when a legend item is clicked (or the instance's `toggle()` is\n * called), with the toggled index and every hidden index after the toggle\n */\n onToggle?: (event: ShapeToggleEvent) => void;\n /**\n * Entry and update animations (skipped when the user prefers reduced motion)\n * @default true\n */\n animation?: boolean;\n /**\n * Space around the drawing, in pixels\n * @default 8 on every side\n */\n padding?: ChartPadding;\n /**\n * Accessible name of the chart\n * @default the chart type, e.g. \"Donut chart\"\n */\n ariaLabel?: string;\n /** Called when the hovered (or keyboard-focused) mark changes */\n onHover?: (event: ShapeHoverEvent | null) => void;\n /** Called when a mark is clicked, tapped or activated with Enter */\n onClick?: (event: ShapeHoverEvent) => void;\n /** React content of the tooltip (replaces the default content) */\n renderTooltip?: (event: ShapeHoverEvent) => ReactNode;\n /** Additional class name of the root element */\n className?: string;\n /** Inline styles of the root element */\n style?: CSSProperties;\n /** Imperative handle */\n ref?: Ref<ShapeChartHandle>;\n}\n\n/** Props of PieChart */\nexport interface PieChartProps extends ShapeChartCommonProps {\n /** Slices: a name, a value (negative values count as 0) and an optional color */\n data: readonly ShapeDatum[];\n /**\n * Inner radius as a fraction of the outer radius: 0 = pie, 0.6 = donut\n * @default 0\n */\n innerRadius?: number;\n /**\n * Angle of the first slice, degrees clockwise from 12 o'clock\n * @default 0\n */\n startAngle?: number;\n /**\n * Gap between the slices, in pixels\n * @default 1 (pie), 2 (donut)\n */\n padAngle?: number;\n /**\n * Corner radius of the slices, in pixels\n * @default 0 (pie), 4 (donut)\n */\n cornerRadius?: number;\n /**\n * Nightingale rose: the radius (instead of the angle) shows the value\n * @default false\n */\n rose?: boolean;\n /**\n * Slice labels: `outside` with leader lines, `inside` the slices, or none\n * @default \"outside\" (up to 12 slices), \"none\" otherwise\n */\n labels?: \"outside\" | \"inside\" | \"none\";\n /**\n * What a label shows: name, value, percent (combinable)\n * @default [\"name\", \"percent\"]\n */\n labelContent?: readonly (\"name\" | \"value\" | \"percent\")[];\n /** Big text in the hole of a donut (e.g. the total) */\n centerValue?: string;\n /** Small text under `centerValue` */\n centerLabel?: string;\n}\n\n/** Props of DonutChart: a PieChart with a hole */\nexport interface DonutChartProps extends PieChartProps {\n /**\n * Inner radius as a fraction of the outer radius\n * @default 0.62\n */\n innerRadius?: number;\n}\n\n/** Props of RadarChart */\nexport interface RadarChartProps extends ShapeChartCommonProps {\n /** Axes of the chart, clockwise from 12 o'clock */\n indicators: readonly RadarIndicator[];\n /** Polygons: one value per indicator */\n series: readonly RadarSeries[];\n /**\n * Grid shape\n * @default \"polygon\"\n */\n shape?: \"polygon\" | \"circle\";\n /**\n * Number of grid rings\n * @default 4\n */\n levels?: number;\n /**\n * Dots on the vertices\n * @default true\n */\n dots?: boolean;\n}\n\n/** Props of GaugeChart */\nexport interface GaugeChartProps extends ShapeChartCommonProps {\n /** Value shown by the arc (clamped to `min` - `max` for the drawing) */\n value: number;\n /**\n * Value at the start of the arc\n * @default 0\n */\n min?: number;\n /**\n * Value at the end of the arc\n * @default 100\n */\n max?: number;\n /** Caption under the value */\n label?: string;\n /**\n * Total angle of the arc, degrees\n * @default 240\n */\n sweep?: number;\n /**\n * Thickness of the arc as a fraction of the radius\n * @default 0.16\n */\n thickness?: number;\n /** Colored ranges of the track; the value arc takes the color of its band */\n bands?: readonly GaugeBand[];\n /**\n * Color of the value arc (when there are no bands)\n * @default the first palette color\n */\n color?: string;\n /**\n * Draws a needle in addition to the value arc\n * @default false\n */\n needle?: boolean;\n /**\n * Tick labels at the ends (and at the band bounds)\n * @default true\n */\n ticks?: boolean;\n}\n\n/** Props of FunnelChart */\nexport interface FunnelChartProps extends ShapeChartCommonProps {\n /** Stages: a name, a value and an optional color */\n data: readonly ShapeDatum[];\n /**\n * Order of the stages\n * @default \"none\" (data order)\n */\n sort?: \"descending\" | \"ascending\" | \"none\";\n /**\n * Vertical gap between the stages, in pixels\n * @default 4\n */\n gap?: number;\n /**\n * Shows the conversion rate from the previous stage\n * @default true\n */\n conversion?: boolean;\n /**\n * Shape of the stages: trapezoids that narrow to the next stage, or centered bars\n * @default \"trapezoid\"\n */\n shape?: \"trapezoid\" | \"bar\";\n}\n\n/** Props of TreemapChart */\nexport interface TreemapChartProps extends ShapeChartCommonProps {\n /** Nodes: leaves carry a value, parents sum their children */\n data: readonly TreemapNode[];\n /**\n * Gap between the cells, in pixels\n * @default 2\n */\n gap?: number;\n /**\n * Draws the names of the parents above their children\n * @default true\n */\n headers?: boolean;\n}\n\ninterface Handlers {\n onHover?: (event: ShapeHoverEvent | null) => void;\n onClick?: (event: ShapeHoverEvent) => void;\n onToggle?: (event: ShapeToggleEvent) => void;\n}\n\ninterface ShapeChartBaseProps extends Handlers {\n options: ShapeChartOptions;\n height: number | string;\n width?: number | string;\n className?: string;\n style?: CSSProperties;\n handleRef?: Ref<ShapeChartHandle>;\n renderTooltip?: (event: ShapeHoverEvent) => ReactNode;\n}\n\nconst size = (value: number | string | undefined, fallback: string) =>\n value === undefined\n ? fallback\n : typeof value === \"number\"\n ? `${value}px`\n : value;\n\n/** Engine options shared by every type, stable while the props are equal */\nconst useCommonOptions = ({\n palette,\n legend,\n tooltip,\n format,\n percentFormat,\n hidden,\n animation,\n padding,\n ariaLabel,\n}: ShapeChartCommonProps): ShapeChartCommonOptions => {\n // a new array with the same indexes keeps the options (and the animation)\n const hiddenKey = hidden ? hidden.join(\",\") : null;\n const stableHidden = useMemo(\n () =>\n hiddenKey === null\n ? undefined\n : hiddenKey\n ? hiddenKey.split(\",\").map(Number)\n : [],\n [hiddenKey],\n );\n return useMemo(\n () => ({\n palette,\n legend,\n tooltip,\n format,\n percentFormat,\n hidden: stableHidden,\n animation,\n padding,\n ariaLabel,\n }),\n [\n palette,\n legend,\n tooltip,\n format,\n percentFormat,\n stableHidden,\n animation,\n padding,\n ariaLabel,\n ],\n );\n};\n\n/** Mounts the engine in a sized <div> and forwards option / handler changes */\nfunction ShapeChartBase({\n options,\n height,\n width,\n className,\n style,\n handleRef,\n renderTooltip,\n ...handlers\n}: ShapeChartBaseProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const chartRef = useRef<ShapeChartInstance | null>(null);\n const handlersRef = useRef<Handlers>(handlers);\n const tooltipRef = useRef(renderTooltip);\n const [tipEvent, setTipEvent] = useState<ShapeHoverEvent | null>(null);\n const tipHost = useMemo(\n () =>\n typeof document === \"undefined\" ? null : document.createElement(\"div\"),\n [],\n );\n const customTooltip = !!renderTooltip;\n\n const resolved = useMemo((): ShapeChartOptions => {\n if (!customTooltip || !tipHost || options.tooltip === false) return options;\n const base = typeof options.tooltip === \"object\" ? options.tooltip : {};\n return {\n ...options,\n tooltip: {\n ...base,\n render: (event) => {\n if (!tooltipRef.current) return null;\n // render synchronously so the engine measures the final size\n flushSync(() => setTipEvent(event));\n return tipHost;\n },\n },\n };\n }, [options, customTooltip, tipHost]);\n const optionsRef = useRef(resolved);\n\n useEffect(() => {\n handlersRef.current = handlers;\n tooltipRef.current = renderTooltip;\n });\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const chart = createShapeChart(container, optionsRef.current);\n chartRef.current = chart;\n const offs = [\n chart.on(\"hover\", (e) => handlersRef.current.onHover?.(e)),\n chart.on(\"click\", (e) => handlersRef.current.onClick?.(e)),\n chart.on(\"toggle\", (e) => handlersRef.current.onToggle?.(e)),\n ];\n return () => {\n offs.forEach((off) => off());\n chart.destroy();\n chartRef.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (optionsRef.current === resolved) return;\n optionsRef.current = resolved;\n chartRef.current?.setOptions(resolved);\n }, [resolved]);\n\n useImperativeHandle(\n handleRef,\n () => ({ getInstance: () => chartRef.current }),\n [],\n );\n\n return (\n <div\n className={className}\n style={{\n position: \"relative\",\n width: size(width, \"100%\"),\n height: size(height, \"320px\"),\n ...style,\n }}\n >\n <div ref={containerRef} style={{ position: \"absolute\", inset: 0 }} />\n {tipHost &&\n tipEvent &&\n renderTooltip &&\n createPortal(renderTooltip(tipEvent), tipHost)}\n </div>\n );\n}\n\n/**\n * Pie chart (or a donut with `innerRadius`, or a Nightingale rose with\n * `rose`): slices with gaps, outside labels with leader lines, legend toggles.\n */\nexport function PieChart(props: PieChartProps) {\n return <PieBase {...props} defaultInner={0} />;\n}\n\n/** Donut chart: a PieChart with a hole and optional center texts */\nexport function DonutChart(props: DonutChartProps) {\n return <PieBase {...props} defaultInner={0.62} />;\n}\n\nfunction PieBase(props: PieChartProps & { defaultInner: number }) {\n const {\n data,\n innerRadius,\n startAngle,\n padAngle,\n cornerRadius,\n rose,\n labels,\n labelContent,\n centerValue,\n centerLabel,\n defaultInner,\n } = props;\n const common = useCommonOptions(props);\n const options = useMemo(\n (): PieChartOptions => ({\n ...common,\n type: \"pie\",\n data,\n innerRadius: innerRadius ?? defaultInner,\n startAngle,\n padAngle,\n cornerRadius,\n rose,\n labels,\n labelContent,\n centerValue,\n centerLabel,\n }),\n [\n common,\n data,\n innerRadius,\n defaultInner,\n startAngle,\n padAngle,\n cornerRadius,\n rose,\n labels,\n labelContent,\n centerValue,\n centerLabel,\n ],\n );\n return <ShapeHost props={props} options={options} defaultHeight={320} />;\n}\n\n/** Radar (spider) chart comparing series over several indicators */\nexport function RadarChart(props: RadarChartProps) {\n const { indicators, series, shape, levels, dots } = props;\n const common = useCommonOptions(props);\n const options = useMemo(\n (): RadarChartOptions => ({\n ...common,\n type: \"radar\",\n indicators,\n series,\n shape,\n levels,\n dots,\n }),\n [common, indicators, series, shape, levels, dots],\n );\n return <ShapeHost props={props} options={options} defaultHeight={320} />;\n}\n\n/** Gauge (speedometer) showing one value on an arc, with colored bands */\nexport function GaugeChart(props: GaugeChartProps) {\n const {\n value,\n min,\n max,\n label,\n sweep,\n thickness,\n bands,\n color,\n needle,\n ticks,\n } = props;\n const common = useCommonOptions(props);\n const options = useMemo(\n (): GaugeChartOptions => ({\n ...common,\n type: \"gauge\",\n value,\n min,\n max,\n label,\n sweep,\n thickness,\n bands,\n color,\n needle,\n ticks,\n }),\n [\n common,\n value,\n min,\n max,\n label,\n sweep,\n thickness,\n bands,\n color,\n needle,\n ticks,\n ],\n );\n return <ShapeHost props={props} options={options} defaultHeight={240} />;\n}\n\n/** Funnel chart of the stages of a process, with conversion rates */\nexport function FunnelChart(props: FunnelChartProps) {\n const { data, sort, gap, conversion, shape } = props;\n const common = useCommonOptions(props);\n const options = useMemo(\n (): FunnelChartOptions => ({\n ...common,\n type: \"funnel\",\n data,\n sort,\n gap,\n conversion,\n shape,\n }),\n [common, data, sort, gap, conversion, shape],\n );\n return <ShapeHost props={props} options={options} defaultHeight={320} />;\n}\n\n/** Treemap: nested rectangles of areas proportional to the values */\nexport function TreemapChart(props: TreemapChartProps) {\n const { data, gap, headers } = props;\n const common = useCommonOptions(props);\n const options = useMemo(\n (): TreemapChartOptions => ({\n ...common,\n type: \"treemap\",\n data,\n gap,\n headers,\n }),\n [common, data, gap, headers],\n );\n return <ShapeHost props={props} options={options} defaultHeight={320} />;\n}\n\nfunction ShapeHost({\n props,\n options,\n defaultHeight,\n}: {\n props: ShapeChartCommonProps;\n options: ShapeChartOptions;\n defaultHeight: number;\n}) {\n return (\n <ShapeChartBase\n options={options}\n height={props.height ?? defaultHeight}\n width={props.width}\n className={props.className}\n style={props.style}\n handleRef={props.ref}\n onHover={props.onHover}\n onClick={props.onClick}\n onToggle={props.onToggle}\n renderTooltip={props.renderTooltip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