p1-charts 0.3.0 → 0.4.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 +26 -0
- package/README.md +58 -2
- package/dist/CategoryBarChart-KYzsjGwg.js +715 -0
- package/dist/CategoryBarChart-KYzsjGwg.js.map +1 -0
- package/dist/{ChartFrame-B1bVFM2E.js → ChartFrame-DOEsou-R.js} +2 -2
- package/dist/{ChartFrame-B1bVFM2E.js.map → ChartFrame-DOEsou-R.js.map} +1 -1
- package/dist/ChartLegend-B8ZmIG2y.js +46 -0
- package/dist/ChartLegend-B8ZmIG2y.js.map +1 -0
- package/dist/{Heatmap-CFC753mV.js → Heatmap-Bwhf305C.js} +2 -2
- package/dist/{Heatmap-CFC753mV.js.map → Heatmap-Bwhf305C.js.map} +1 -1
- package/dist/{PieLegend-CbpjaOJH.js → PieLegend-16E6W10x.js} +3 -3
- package/dist/{PieLegend-CbpjaOJH.js.map → PieLegend-16E6W10x.js.map} +1 -1
- package/dist/PolarChart-C_vPz-3K.js +489 -0
- package/dist/PolarChart-C_vPz-3K.js.map +1 -0
- package/dist/{TimeSeriesChart-BzeHEtQl.js → TimeSeriesChart-BZMLERDZ.js} +451 -451
- package/dist/{TimeSeriesChart-BzeHEtQl.js.map → TimeSeriesChart-BZMLERDZ.js.map} +1 -1
- package/dist/category.d.ts +4 -1
- package/dist/category.d.ts.map +1 -1
- package/dist/category.js +4 -3
- package/dist/charts/CategoryBarChart/index.d.ts +3 -1
- package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
- package/dist/charts/ScatterChart/index.d.ts +1 -1
- package/dist/charts/ScatterChart/index.d.ts.map +1 -1
- package/dist/components/ChartLegend/index.d.ts +13 -0
- package/dist/components/ChartLegend/index.d.ts.map +1 -0
- package/dist/{css-BtFQ2bM4.js → css-BTZA9hea.js} +2 -2
- package/dist/{css-BtFQ2bM4.js.map → css-BTZA9hea.js.map} +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -63
- package/dist/index.js.map +1 -1
- package/dist/pie.js +1 -1
- package/dist/scatter.d.ts +4 -1
- package/dist/scatter.d.ts.map +1 -1
- package/dist/scatter.js +3 -2
- package/dist/series.js +1 -1
- package/dist/standalone/p1-charts.standalone.js +13 -0
- package/dist/standalone.d.ts +27 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/story.js +2 -2
- package/dist/theme.js +2 -2
- package/dist/{theme.utils-DgmWROoe.js → theme.utils-DF_e8LxQ.js} +118 -119
- package/dist/theme.utils-DF_e8LxQ.js.map +1 -0
- package/dist/types/category.d.ts +16 -0
- package/dist/types/category.d.ts.map +1 -1
- package/dist/types/scatter.d.ts +31 -0
- package/dist/types/scatter.d.ts.map +1 -1
- package/dist/{useChartTheme-KKtc1C4K.js → useChartTheme-D0bQ3LQq.js} +2 -2
- package/dist/{useChartTheme-KKtc1C4K.js.map → useChartTheme-D0bQ3LQq.js.map} +1 -1
- package/dist/utils/category.utils.d.ts +13 -1
- package/dist/utils/category.utils.d.ts.map +1 -1
- package/dist/utils/scatter.utils.d.ts +17 -1
- package/dist/utils/scatter.utils.d.ts.map +1 -1
- package/dist/utils/theme.utils.d.ts +1 -1
- package/dist/utils/theme.utils.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/category.ts +4 -1
- package/src/charts/CategoryBarChart/index.tsx +108 -19
- package/src/charts/ScatterChart/index.tsx +73 -10
- package/src/components/ChartLegend/index.tsx +46 -0
- package/src/index.ts +5 -1
- package/src/scatter.ts +4 -1
- package/src/standalone.tsx +68 -0
- package/src/types/category.ts +16 -0
- package/src/types/scatter.ts +20 -0
- package/src/utils/category.utils.ts +89 -2
- package/src/utils/scatter.utils.ts +22 -5
- package/src/utils/theme.utils.ts +18 -15
- package/dist/CategoryBarChart-1Kn3Vozc.js +0 -580
- package/dist/CategoryBarChart-1Kn3Vozc.js.map +0 -1
- package/dist/PolarChart-hcNTWKfJ.js +0 -450
- package/dist/PolarChart-hcNTWKfJ.js.map +0 -1
- package/dist/theme.utils-DgmWROoe.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryBarChart-1Kn3Vozc.js","names":["HEATMAP_SVG","useChartTheme","useTween","useMarkMemory","VERTICAL_PAD","HORIZONTAL_PAD","scaleOf","series","extentOf","mine","item","scale","min","max","category","categories","positive","negative","value","mode","pin","pins","next","domain","presentAt","placeVertical","options","plotH","height","pad","plotW","width","yFor","extent","right","left","span","slot","rects","present","inner","origin","gap","barW","yOf","y","index","start","end","placeHorizontal","xFor","barH","xOf","x","acrossLine","orientation","categoryFrame","pinsFor","categoryLayout","axisTicks","count","step","sortOrder","order","sort","totals","data","sum","sign","a","b","WIDTH","HEIGHT","NO_REFERENCES","NO_BANDS","ink","color","categorical","readDatum","datum","seriesColor","CategoryBarChart","sourceCategories","sourceSeries","useMemo","shownActive","activeIndex","resolved","text","grid","hasRight","valueLabel","lines","reference","references","frame","line","bands","band","focus","setFocus","useState","active","rows","formatValue","horizontal","slotAt","ticksFor","valuePos","across","target","bars","labels","label","rect","key","entry","tick","baseline","toBaseline","w","h","base","memory","previousAcross","useRef","valueTick","raw","drawn","animate","at","tickMemory","fade","opacity","leavingBars","categoryTicks","valueTicks","tickLabel","formatTick","choose","onSelect","classes","className","ariaLabel","forward","back","event","bandWidth","bandHeight","placed","gone","renderTooltip","row"],"sources":["../src/utils/category.utils.ts","../src/charts/CategoryBarChart/index.tsx"],"sourcesContent":["export type CategoryBarMode = \"group\" | \"stack\" | \"overlay\";\nexport type CategoryOrientation = \"vertical\" | \"horizontal\";\nexport type CategoryScale = \"left\" | \"right\";\n\nexport interface CategorySeriesInput {\n id: string;\n data: readonly number[];\n scale?: CategoryScale;\n}\n\nexport interface CategoryRect {\n series: string;\n category: number;\n x: number;\n y: number;\n width: number;\n height: number;\n value: number;\n}\n\nexport interface CategoryPad {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface CategoryExtent {\n min: number;\n max: number;\n}\n\nexport interface CategoryDomain {\n min?: number;\n max?: number;\n}\n\nexport interface CategoryLayoutOptions {\n mode: CategoryBarMode;\n series: readonly CategorySeriesInput[];\n categories: number;\n width: number;\n height: number;\n pad?: CategoryPad;\n orientation?: CategoryOrientation;\n domain?: CategoryDomain;\n rightDomain?: CategoryDomain;\n /** Values the axis must contain, such as a threshold the bars have not reached. */\n pins?: readonly { value: number; scale?: CategoryScale }[];\n}\n\nexport interface CategoryLine {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n}\n\nexport interface CategoryFrame {\n rects: CategoryRect[];\n orientation: CategoryOrientation;\n pad: CategoryPad;\n left: CategoryExtent;\n right: CategoryExtent | null;\n /** A line across the plot at one value. Horizontal charts draw it upright. */\n across: (value: number, scale?: CategoryScale) => CategoryLine;\n}\n\nconst VERTICAL_PAD: CategoryPad = { top: 16, right: 12, bottom: 28, left: 36 };\nconst HORIZONTAL_PAD: CategoryPad = { top: 12, right: 56, bottom: 28, left: 96 };\n\ninterface PresentBar {\n id: string;\n value: number;\n scale: CategoryScale;\n}\n\nfunction scaleOf(series: CategorySeriesInput): CategoryScale {\n return series.scale ?? \"left\";\n}\n\nfunction extentOf(\n mode: CategoryBarMode,\n series: readonly CategorySeriesInput[],\n categories: number,\n scale: CategoryScale,\n domain?: CategoryDomain,\n pins?: readonly number[],\n): CategoryExtent | null {\n const mine = series.filter((item) => scaleOf(item) === scale);\n\n if (mine.length === 0) return null;\n\n let min = 0;\n let max = 0;\n\n for (let category = 0; category < categories; category += 1) {\n let positive = 0;\n let negative = 0;\n\n for (const item of mine) {\n const value = item.data[category];\n\n if (typeof value !== \"number\" || !Number.isFinite(value)) continue;\n\n if (mode === \"stack\") {\n if (value >= 0) positive += value;\n else negative += value;\n } else {\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n }\n\n if (mode === \"stack\") {\n min = Math.min(min, negative);\n max = Math.max(max, positive);\n }\n }\n\n for (const pin of pins ?? []) {\n if (!Number.isFinite(pin)) continue;\n\n min = Math.min(min, pin);\n max = Math.max(max, pin);\n }\n\n const next = {\n min: domain?.min ?? min,\n max: domain?.max ?? max,\n };\n\n return { min: next.min, max: next.max === next.min ? next.max + 1 : next.max };\n}\n\nfunction presentAt(\n series: readonly CategorySeriesInput[],\n category: number,\n): PresentBar[] {\n return series.flatMap((item) => {\n const value = item.data[category];\n\n return typeof value === \"number\" && Number.isFinite(value)\n ? [{ id: item.id, value, scale: scaleOf(item) }]\n : [];\n });\n}\n\nfunction placeVertical(\n options: CategoryLayoutOptions,\n pad: CategoryPad,\n left: CategoryExtent,\n right: CategoryExtent | null,\n): CategoryRect[] {\n const { mode, series, categories, width, height } = options;\n const plotH = Math.max(0, height - pad.top - pad.bottom);\n const plotW = Math.max(0, width - pad.left - pad.right);\n const yFor = (scale: CategoryScale) => {\n const extent = scale === \"right\" && right ? right : left;\n const span = extent.max - extent.min || 1;\n\n return (value: number) => pad.top + ((extent.max - value) / span) * plotH;\n };\n const slot = plotW / categories;\n const rects: CategoryRect[] = [];\n\n for (let category = 0; category < categories; category += 1) {\n const present = presentAt(series, category);\n\n if (present.length === 0) continue;\n\n const inner = slot * 0.72;\n const origin = pad.left + category * slot + (slot - inner) / 2;\n\n if (mode === \"group\") {\n const gap = present.length > 1 ? 2 : 0;\n const barW = (inner - gap * (present.length - 1)) / present.length;\n\n present.forEach((item, index) => {\n const yOf = yFor(item.scale);\n const y = Math.min(yOf(item.value), yOf(0));\n\n rects.push({\n series: item.id,\n category,\n x: origin + index * (barW + gap),\n y,\n width: barW,\n height: Math.abs(yOf(item.value) - yOf(0)),\n value: item.value,\n });\n });\n continue;\n }\n\n if (mode === \"overlay\") {\n present.forEach((item) => {\n const yOf = yFor(item.scale);\n const y = Math.min(yOf(item.value), yOf(0));\n\n rects.push({\n series: item.id,\n category,\n x: origin,\n y,\n width: inner,\n height: Math.abs(yOf(item.value) - yOf(0)),\n value: item.value,\n });\n });\n continue;\n }\n\n for (const scale of [\"left\", \"right\"] as const) {\n let positive = 0;\n let negative = 0;\n const yOf = yFor(scale);\n\n for (const item of present) {\n if (item.scale !== scale) continue;\n\n const start = item.value >= 0 ? positive : negative;\n const end = start + item.value;\n\n if (item.value >= 0) positive = end;\n else negative = end;\n\n const y = Math.min(yOf(start), yOf(end));\n\n rects.push({\n series: item.id,\n category,\n x: origin,\n y,\n width: inner,\n height: Math.abs(yOf(end) - yOf(start)),\n value: item.value,\n });\n }\n }\n }\n\n return rects;\n}\n\nfunction placeHorizontal(\n options: CategoryLayoutOptions,\n pad: CategoryPad,\n left: CategoryExtent,\n right: CategoryExtent | null,\n): CategoryRect[] {\n const { mode, series, categories, width, height } = options;\n const plotW = Math.max(0, width - pad.left - pad.right);\n const plotH = Math.max(0, height - pad.top - pad.bottom);\n const xFor = (scale: CategoryScale) => {\n const extent = scale === \"right\" && right ? right : left;\n const span = extent.max - extent.min || 1;\n\n return (value: number) => pad.left + ((value - extent.min) / span) * plotW;\n };\n const slot = plotH / categories;\n const rects: CategoryRect[] = [];\n\n for (let category = 0; category < categories; category += 1) {\n const present = presentAt(series, category);\n\n if (present.length === 0) continue;\n\n const inner = slot * 0.72;\n const origin = pad.top + category * slot + (slot - inner) / 2;\n\n if (mode === \"group\") {\n const gap = present.length > 1 ? 2 : 0;\n const barH = (inner - gap * (present.length - 1)) / present.length;\n\n present.forEach((item, index) => {\n const xOf = xFor(item.scale);\n const x = Math.min(xOf(item.value), xOf(0));\n\n rects.push({\n series: item.id,\n category,\n x,\n y: origin + index * (barH + gap),\n width: Math.abs(xOf(item.value) - xOf(0)),\n height: barH,\n value: item.value,\n });\n });\n continue;\n }\n\n if (mode === \"overlay\") {\n present.forEach((item) => {\n const xOf = xFor(item.scale);\n const x = Math.min(xOf(item.value), xOf(0));\n\n rects.push({\n series: item.id,\n category,\n x,\n y: origin,\n width: Math.abs(xOf(item.value) - xOf(0)),\n height: inner,\n value: item.value,\n });\n });\n continue;\n }\n\n for (const scale of [\"left\", \"right\"] as const) {\n let positive = 0;\n let negative = 0;\n const xOf = xFor(scale);\n\n for (const item of present) {\n if (item.scale !== scale) continue;\n\n const start = item.value >= 0 ? positive : negative;\n const end = start + item.value;\n\n if (item.value >= 0) positive = end;\n else negative = end;\n\n const x = Math.min(xOf(start), xOf(end));\n\n rects.push({\n series: item.id,\n category,\n x,\n y: origin,\n width: Math.abs(xOf(end) - xOf(start)),\n height: inner,\n value: item.value,\n });\n }\n }\n }\n\n return rects;\n}\n\nfunction acrossLine(\n orientation: CategoryOrientation,\n pad: CategoryPad,\n width: number,\n height: number,\n left: CategoryExtent,\n right: CategoryExtent | null,\n value: number,\n scale: CategoryScale,\n): CategoryLine {\n const extent = scale === \"right\" && right ? right : left;\n const span = extent.max - extent.min || 1;\n\n if (orientation === \"horizontal\") {\n const plotW = Math.max(0, width - pad.left - pad.right);\n const x = pad.left + ((value - extent.min) / span) * plotW;\n\n return { x1: x, y1: pad.top, x2: x, y2: height - pad.bottom };\n }\n\n const plotH = Math.max(0, height - pad.top - pad.bottom);\n const y = pad.top + ((extent.max - value) / span) * plotH;\n\n return { x1: pad.left, y1: y, x2: width - pad.right, y2: y };\n}\n\n/** Bar rectangles, the value extents, and a helper for a reference line. */\nexport function categoryFrame(options: CategoryLayoutOptions): CategoryFrame {\n const orientation = options.orientation ?? \"vertical\";\n const pad = options.pad ?? (orientation === \"horizontal\" ? HORIZONTAL_PAD : VERTICAL_PAD);\n const pinsFor = (scale: CategoryScale) =>\n (options.pins ?? []).flatMap((pin) =>\n (pin.scale ?? \"left\") === scale && Number.isFinite(pin.value) ? [pin.value] : [],\n );\n const left = extentOf(\n options.mode,\n options.series,\n options.categories,\n \"left\",\n options.domain,\n pinsFor(\"left\"),\n ) ?? {\n min: 0,\n max: 1,\n };\n const right = extentOf(\n options.mode,\n options.series,\n options.categories,\n \"right\",\n options.rightDomain,\n pinsFor(\"right\"),\n );\n const rects =\n options.categories <= 0 || options.series.length === 0\n ? []\n : orientation === \"horizontal\"\n ? placeHorizontal(options, pad, left, right)\n : placeVertical(options, pad, left, right);\n\n return {\n rects,\n orientation,\n pad,\n left,\n right,\n across: (value, scale = \"left\") =>\n acrossLine(\n orientation,\n pad,\n options.width,\n options.height,\n left,\n right,\n value,\n scale,\n ),\n };\n}\n\n/** Bar rectangles for grouped, stacked, or overlaid category columns. */\nexport function categoryLayout(options: CategoryLayoutOptions): CategoryRect[] {\n return categoryFrame(options).rects;\n}\n\n/** Even ticks from `min` to `max`, including both ends. */\nexport function axisTicks(min: number, max: number, count = 4): number[] {\n if (!(max > min) || count < 1) return [min];\n\n const step = (max - min) / count;\n\n return Array.from({ length: count + 1 }, (_, index) =>\n Number((min + step * index).toPrecision(6)),\n );\n}\n\n/** Display order of categories, by each category's total across series. Stable on ties. */\nexport function sortOrder(\n count: number,\n series: readonly (readonly number[])[],\n sort: \"none\" | \"ascending\" | \"descending\",\n): number[] {\n const order = Array.from({ length: count }, (_, index) => index);\n\n if (sort === \"none\") return order;\n\n const total = (index: number) =>\n series.reduce((sum, data) => {\n const value = data[index];\n\n return sum + (value !== undefined && Number.isFinite(value) ? value : 0);\n }, 0);\n const totals = order.map(total);\n const sign = sort === \"ascending\" ? 1 : -1;\n\n return order.sort((a, b) => sign * (totals[a]! - totals[b]!) || a - b);\n}\n","import { useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent } from \"react\";\nimport type {\n CategoryBand,\n CategoryBarDatum,\n CategoryBarChartProps,\n CategoryBarSeries,\n CategoryReference,\n} from \"../../types/category.js\";\nimport { useChartTheme } from \"../../hooks/useChartTheme.js\";\nimport {\n axisTicks,\n categoryFrame,\n type CategoryFrame,\n type CategoryScale,\n} from \"../../utils/category.utils.js\";\nimport { classes } from \"../../utils/dom.utils.js\";\nimport { useTween } from \"../../hooks/useTween.js\";\nimport { useMarkMemory } from \"../../hooks/useMarkMemory.js\";\nimport { sortOrder } from \"../../utils/category.utils.js\";\nimport { HEATMAP_SVG } from \"../../styles/heatmap.js\";\n\nconst WIDTH = 640;\nconst HEIGHT = 320;\nconst NO_REFERENCES: readonly CategoryReference[] = [];\nconst NO_BANDS: readonly CategoryBand[] = [];\n\nfunction ink(categorical: readonly string[], index: number, color?: string) {\n return color ?? categorical[index % Math.max(1, categorical.length)] ?? \"currentColor\";\n}\n\nfunction readDatum(datum: CategoryBarDatum | undefined): {\n value: number | undefined;\n color?: string;\n label?: string;\n} {\n if (typeof datum === \"number\") {\n return { value: Number.isFinite(datum) ? datum : undefined };\n }\n\n if (datum && typeof datum.value === \"number\" && Number.isFinite(datum.value)) {\n return { value: datum.value, color: datum.color, label: datum.label };\n }\n\n return { value: undefined };\n}\n\ninterface BarMemory {\n series: string;\n label: string;\n scale: CategoryScale;\n color: string;\n}\n\nfunction seriesColor(item: CategoryBarSeries | undefined, categorical: readonly string[], index: number) {\n return ink(categorical, index, item?.color);\n}\n\nexport function CategoryBarChart({\n categories: sourceCategories,\n series: sourceSeries,\n sort = \"none\",\n animate = true,\n mode = \"group\",\n orientation = \"vertical\",\n domain,\n rightDomain,\n reference,\n references = NO_REFERENCES,\n bands = NO_BANDS,\n activeIndex,\n valueLabel,\n width = WIDTH,\n height = HEIGHT,\n className,\n ariaLabel = \"Bar chart\",\n formatValue,\n formatTick,\n renderTooltip,\n onSelect,\n theme,\n unstyled,\n}: CategoryBarChartProps) {\n const order = useMemo(\n () =>\n sortOrder(\n sourceCategories.length,\n sourceSeries.map((item) => item.data.map((datum) => readDatum(datum).value ?? Number.NaN)),\n sort,\n ),\n [sourceCategories.length, sourceSeries, sort],\n );\n const categories = useMemo(\n () => order.map((index) => sourceCategories[index]!),\n [order, sourceCategories],\n );\n const series = useMemo(\n () =>\n sort === \"none\"\n ? sourceSeries\n : sourceSeries.map((item) => ({ ...item, data: order.map((index) => item.data[index]!) })),\n [order, sourceSeries, sort],\n );\n const shownActive = activeIndex === undefined ? undefined : order.indexOf(activeIndex);\n const resolved = useChartTheme({ theme, unstyled });\n const categorical = resolved?.palette.categorical ?? [];\n const text = resolved?.palette.text;\n const grid = resolved?.palette.grid;\n const hasRight = series.some((item) => item.scale === \"right\");\n const pad =\n orientation === \"horizontal\"\n ? { top: 12, right: hasRight ? 48 : 64, bottom: valueLabel ? 36 : 28, left: 108 }\n : { top: 16, right: hasRight ? 48 : 12, bottom: valueLabel ? 40 : 28, left: 44 };\n const lines = reference ? [reference, ...references] : references;\n const frame = categoryFrame({\n mode,\n orientation,\n domain,\n rightDomain,\n pad,\n width,\n height,\n categories: categories.length,\n pins: [\n ...lines.map((line) => ({ value: line.value, scale: line.scale })),\n ...bands.flatMap((band) => [\n { value: band.from, scale: band.scale },\n { value: band.to, scale: band.scale },\n ]),\n ],\n series: series.map((item) => ({\n id: item.id,\n scale: item.scale,\n data: item.data.map((datum) => readDatum(datum).value ?? Number.NaN),\n })),\n });\n const [focus, setFocus] = useState<number | null>(null);\n const active = focus ?? (shownActive !== undefined && shownActive >= 0 ? shownActive : 0);\n const category = categories[active] ?? categories[0];\n const rows = series.flatMap((item, index) => {\n const datum = category === undefined ? undefined : readDatum(item.data[active]);\n\n return datum?.value === undefined\n ? []\n : [\n {\n label: item.name,\n value: formatValue?.(item.id, datum.value) ?? String(datum.value),\n color: datum.color ?? seriesColor(item, categorical, index),\n },\n ];\n });\n const horizontal = orientation === \"horizontal\";\n const slot = horizontal\n ? (height - pad.top - pad.bottom) / Math.max(1, categories.length)\n : (width - pad.left - pad.right) / Math.max(1, categories.length);\n const slotAt = (index: number) =>\n (horizontal ? pad.top : pad.left) + (index + 0.5) * slot;\n const ticksFor = (extent: { min: number; max: number }, scale: CategoryScale) =>\n axisTicks(extent.min, extent.max).map((value) => ({\n value,\n at: frame.across(value, scale),\n }));\n const valuePos = (across: CategoryFrame[\"across\"], value: number, scale: CategoryScale) => {\n const line = across(value, scale);\n\n return horizontal ? line.x1 : line.y1;\n };\n const target: Record<string, number[]> = {};\n const bars = new Map<string, BarMemory>();\n const labels = new Map<string, string>();\n\n frame.rects.forEach((rect) => {\n const label = categories[rect.category]!;\n const key = `bar:${rect.series}:${label}`;\n const index = series.findIndex((entry) => entry.id === rect.series);\n const item = series[index];\n\n target[key] = [rect.x, rect.y, rect.width, rect.height];\n bars.set(key, {\n series: rect.series,\n label,\n scale: item?.scale ?? \"left\",\n color: readDatum(item?.data[rect.category]).color ?? seriesColor(item, categorical, index),\n });\n });\n categories.forEach((label, index) => {\n target[`tick:${label}`] = [slotAt(index), 1];\n labels.set(`tick:${label}`, label);\n });\n ticksFor(frame.left, \"left\").forEach((tick) => {\n target[`v:left:${tick.value}`] = [horizontal ? tick.at.x1 : tick.at.y1, 1];\n });\n if (frame.right) {\n ticksFor(frame.right, \"right\").forEach((tick) => {\n target[`v:right:${tick.value}`] = [tick.at.y1, 1];\n });\n }\n\n const baseline = (scale: CategoryScale) => {\n const extent = scale === \"right\" && frame.right ? frame.right : frame.left;\n\n return frame.across(Math.max(extent.min, Math.min(extent.max, 0)), scale);\n };\n const toBaseline = (memory: BarMemory | undefined, [x, y, w, h]: readonly number[]) => {\n const base = baseline(memory?.scale ?? \"left\");\n\n return horizontal ? [base.x1, y!, 0, h!] : [x!, base.y1, w!, 0];\n };\n const previousAcross = useRef(frame.across);\n const memory = useRef<ReadonlyMap<string, BarMemory>>(bars);\n const valueTick = (key: string) => {\n const [, scale, raw] = key.split(\":\") as [string, CategoryScale, string];\n\n return { scale, value: Number(raw) };\n };\n const drawn = useTween(target, animate, {\n enter: (key, value) => {\n if (key.startsWith(\"bar:\")) return toBaseline(bars.get(key), value);\n if (key.startsWith(\"v:\")) {\n const { scale, value: at } = valueTick(key);\n\n return [valuePos(previousAcross.current, at, scale), 0];\n }\n return [value[0]!, 0];\n },\n exit: (key, value) => {\n if (key.startsWith(\"bar:\")) return toBaseline(memory.current.get(key), value);\n if (key.startsWith(\"v:\")) {\n const { scale, value: at } = valueTick(key);\n\n return [valuePos(frame.across, at, scale), 0];\n }\n return [value[0]!, 0];\n },\n });\n\n memory.current = useMarkMemory(bars, drawn);\n const tickMemory = useMarkMemory(labels, drawn);\n useLayoutEffect(() => {\n previousAcross.current = frame.across;\n });\n\n const fade = (key: string) => {\n const opacity = drawn[key]?.[1] ?? 1;\n\n return opacity < 1 ? Math.max(0, opacity) : undefined;\n };\n const leavingBars = Object.keys(drawn).filter((key) => key.startsWith(\"bar:\") && !(key in target));\n const categoryTicks = Object.keys(drawn).filter((key) => key.startsWith(\"tick:\"));\n const valueTicks = (scale: CategoryScale) =>\n Object.keys(drawn)\n .filter((key) => key.startsWith(`v:${scale}:`))\n .map((key) => ({ key, value: valueTick(key).value, at: drawn[key]![0]!, opacity: fade(key) }));\n const tickLabel = (value: number) => formatTick?.(value) ?? String(value);\n const choose = (index: number) => {\n setFocus(index);\n const label = categories[index];\n\n if (label !== undefined) onSelect?.(label, order[index] ?? index);\n };\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n const forward = orientation === \"horizontal\" ? \"ArrowDown\" : \"ArrowRight\";\n const back = orientation === \"horizontal\" ? \"ArrowUp\" : \"ArrowLeft\";\n\n if (event.key !== forward && event.key !== back) return;\n\n event.preventDefault();\n const next = event.key === forward ? active + 1 : active - 1;\n\n choose(Math.max(0, Math.min(categories.length - 1, next)));\n };\n\n return (\n <div\n className={classes(className)}\n data-mode={mode}\n data-orientation={orientation}\n style={{ position: \"relative\" }}\n >\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n tabIndex={0}\n viewBox={`0 0 ${width} ${height}`}\n style={HEATMAP_SVG}\n onKeyDown={onKey}\n onPointerLeave={() => setFocus(null)}\n >\n {orientation === \"horizontal\" ? (\n <line\n data-part=\"axis\"\n x1={pad.left}\n y1={pad.top}\n x2={pad.left}\n y2={height - pad.bottom}\n stroke={grid}\n />\n ) : (\n <line\n data-part=\"axis\"\n x1={pad.left}\n y1={height - pad.bottom}\n x2={width - pad.right}\n y2={height - pad.bottom}\n stroke={grid}\n />\n )}\n {categoryTicks.map((key) => {\n const label = tickMemory.get(key) ?? key.slice(5);\n const at = drawn[key]![0]!;\n\n return orientation === \"horizontal\" ? (\n <text\n key={key}\n data-part=\"tick\"\n x={pad.left - 8}\n y={at}\n opacity={fade(key)}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n fill={text}\n fontSize={11}\n >\n {label}\n </text>\n ) : (\n <text\n key={key}\n data-part=\"tick\"\n x={at}\n y={height - pad.bottom + 14}\n opacity={fade(key)}\n textAnchor=\"middle\"\n fill={text}\n fontSize={11}\n >\n {label}\n </text>\n );\n })}\n {valueTicks(\"left\").map((tick) =>\n orientation === \"horizontal\" ? (\n <text\n key={tick.key}\n data-part=\"value-tick\"\n x={tick.at}\n y={height - pad.bottom + 14}\n opacity={tick.opacity}\n textAnchor=\"middle\"\n fill={text}\n fontSize={11}\n >\n {tickLabel(tick.value)}\n </text>\n ) : (\n <text\n key={tick.key}\n data-part=\"value-tick\"\n x={pad.left - 6}\n y={tick.at}\n opacity={tick.opacity}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n fill={text}\n fontSize={11}\n >\n {tickLabel(tick.value)}\n </text>\n ),\n )}\n {valueTicks(\"right\").map((tick) => (\n <text\n key={tick.key}\n data-part=\"value-tick\"\n data-scale=\"right\"\n x={width - pad.right + 6}\n y={tick.at}\n opacity={tick.opacity}\n dominantBaseline=\"middle\"\n fill={text}\n fontSize={11}\n >\n {tickLabel(tick.value)}\n </text>\n ))}\n {valueLabel && (\n <text\n data-part=\"axis-label\"\n x={orientation === \"horizontal\" ? (pad.left + width - pad.right) / 2 : pad.left}\n y={height - 4}\n textAnchor={orientation === \"horizontal\" ? \"middle\" : \"start\"}\n fill={text}\n fontSize={11}\n >\n {valueLabel}\n </text>\n )}\n {bands.map((band, index) => {\n const start = frame.across(band.from, band.scale);\n const end = frame.across(band.to, band.scale);\n const horizontal = orientation === \"horizontal\";\n const x = horizontal ? Math.min(start.x1, end.x1) : pad.left;\n const y = horizontal ? pad.top : Math.min(start.y1, end.y1);\n const bandWidth = horizontal\n ? Math.abs(start.x1 - end.x1)\n : width - pad.left - pad.right;\n const bandHeight = horizontal\n ? height - pad.top - pad.bottom\n : Math.abs(start.y1 - end.y1);\n\n return (\n <rect\n key={`band-${index}`}\n data-part=\"band\"\n x={x}\n y={y}\n width={bandWidth}\n height={bandHeight}\n fill={band.color ?? grid}\n />\n );\n })}\n {lines.map((line, index) => {\n const at = frame.across(line.value, line.scale);\n\n return (\n <g key={`ref-${line.label ?? line.value}-${index}`}>\n <line\n data-part=\"reference\"\n {...at}\n stroke={line.color ?? grid}\n strokeDasharray=\"4 3\"\n />\n {line.label && (\n <text\n data-part=\"reference-label\"\n x={at.x1 + 4}\n y={pad.top + 10 + index * 12}\n fill={line.color ?? text}\n fontSize={10}\n >\n {line.label}\n </text>\n )}\n </g>\n );\n })}\n {frame.rects.map((placed) => {\n const label = categories[placed.category];\n const [x, y, w, h] = drawn[`bar:${placed.series}:${label}`] ?? [];\n const rect = {\n ...placed,\n x: x ?? placed.x,\n y: y ?? placed.y,\n width: w ?? placed.width,\n height: h ?? placed.height,\n };\n const item = series.find((entry) => entry.id === rect.series);\n const index = series.findIndex((entry) => entry.id === rect.series);\n const datum = readDatum(item?.data[rect.category]);\n\n return (\n <g key={`${rect.series}:${label}`}>\n <rect\n data-part=\"bar\"\n data-key={label}\n data-series={rect.series}\n data-category={rect.category}\n data-active={rect.category === active ? \"\" : undefined}\n x={rect.x}\n y={rect.y}\n width={rect.width}\n height={Math.max(rect.height, rect.value === 0 ? 0 : 1)}\n fill={datum?.color ?? seriesColor(item, categorical, index)}\n opacity={mode === \"overlay\" ? 0.72 : 1}\n onPointerEnter={() => setFocus(rect.category)}\n onClick={() => choose(rect.category)}\n />\n {datum?.label && (\n <text\n data-part=\"bar-label\"\n data-series={rect.series}\n x={orientation === \"horizontal\" ? rect.x + rect.width + 4 : rect.x + rect.width / 2}\n y={orientation === \"horizontal\" ? rect.y + rect.height / 2 : rect.y - 4}\n textAnchor={orientation === \"horizontal\" ? \"start\" : \"middle\"}\n dominantBaseline={orientation === \"horizontal\" ? \"middle\" : \"auto\"}\n fill={text}\n fontSize={10}\n >\n {datum.label}\n </text>\n )}\n </g>\n );\n })}\n {leavingBars.map((key) => {\n const [x, y, w, h] = drawn[key]!;\n const gone = memory.current.get(key);\n\n return (\n <rect\n key={key}\n data-part=\"bar\"\n data-leaving=\"\"\n data-key={gone?.label}\n data-series={gone?.series}\n x={x}\n y={y}\n width={Math.max(0, w!)}\n height={Math.max(0, h!)}\n fill={gone?.color}\n opacity={mode === \"overlay\" ? 0.72 : 1}\n pointerEvents=\"none\"\n />\n );\n })}\n </svg>\n {category !== undefined &&\n (renderTooltip?.(category, rows) ?? (\n <div data-part=\"tooltip\">\n <div data-part=\"tooltip-time\">{category}</div>\n {rows.map((row) => (\n <div key={row.label} data-part=\"tooltip-row\">\n {row.label} {row.value}\n </div>\n ))}\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAoEA,IAAMI,IAA4B;CAAE,KAAK;CAAI,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAG,GACvEC,IAA8B;CAAE,KAAK;CAAI,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAG;AAQ/E,SAASC,EAAQ,GAA4C;CAC3D,OAAOC,EAAO,SAAS;AACzB;AAEA,SAASC,EACP,GACA,GACA,GACA,GACA,GACA,GACuB;CACvB,IAAMC,IAAOF,EAAO,QAAQ,MAASD,EAAQI,CAAI,MAAMC,CAAK;CAE5D,IAAIF,EAAK,WAAW,GAAG,OAAO;CAE9B,IAAIG,IAAM,GACNC,IAAM;CAEV,KAAK,IAAIC,IAAW,GAAGA,IAAWC,GAAY,KAAY,GAAG;EAC3D,IAAIC,IAAW,GACXC,IAAW;EAEf,KAAK,IAAMP,KAAQD,GAAM;GACvB,IAAMS,IAAQR,EAAK,KAAKI;GAExB,AAAI,OAAOI,KAAU,YAAa,OAAO,SAASA,CAAK,MAEnDC,MAAS,UACPD,KAAS,IAAG,KAAYA,IACvB,KAAYA,KAEjB,IAAM,KAAK,IAA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IAAIA,EAAK,SAAS,IAAIA,EAAK,IAAI;MACtE,YAAY3D,MAAgB,eAAe,UAAU;MACrD,kBAAkBA,MAAgB,eAAe,WAAW;MAC5D,MAAMiC;MACN,UAAU;MAET,UAAAT,EAAM;KACH,CAAA,CAEP,EAAA,GA9BK,GAAGmC,EAAK,OAAO,GAAGD,GA8BvB;IAEP,CAAC;IACAqB,GAAY,KAAK,MAAQ;KACxB,IAAM,CAACjF,GAAGR,GAAG2E,GAAGC,KAAKO,EAAMb,IACrBmC,IAAO3B,EAAO,QAAQ,IAAIR,CAAG;KAEnC,OACE,kBAAC,QAAD;MAEE,aAAU;MACV,gBAAa;MACb,YAAUmC,GAAM;MAChB,eAAaA,GAAM;MAChB;MACA;MACH,OAAO,KAAK,IAAI,GAAG9B,CAAE;MACrB,QAAQ,KAAK,IAAI,GAAGC,CAAE;MACtB,MAAM6B,GAAM;MACZ,SAASnI,MAAS,YAAY,MAAO;MACrC,eAAc;KACf,GAZMgG,CAYN;IAEL,CAAC;GACE;EACJ,CAAA,GAAArG,MAAa,KAAA,MACXyI,KAAgBzI,GAAUyF,CAAI,KAC7B,kBAAC,OAAD;GAAK,aAAU;GAAf,UAAA,CACE,kBAAC,OAAD;IAAK,aAAU;IAAgB,UAAAzF;GAAc,CAAA,GAC5CyF,EAAK,KAAK,MACT,kBAAC,OAAD;IAAqB,aAAU;IAA/B,UAAA;KACGiD,EAAI;KAAM;KAAEA,EAAI;IACd;GAFK,GAAAA,EAAI,KAET,CACN,CACE;EAEN,CAAA,EAAA;;AAET"}
|
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { n as e } from "./heatmap-CIBukkjS.js";
|
|
3
|
-
import { t } from "./dom.utils-CKMWLto-.js";
|
|
4
|
-
import { t as n } from "./useChartTheme-KKtc1C4K.js";
|
|
5
|
-
import { t as r } from "./useTween-B0G0CcvM.js";
|
|
6
|
-
import { t as i } from "./useMarkMemory-CLNY6TtT.js";
|
|
7
|
-
import { useLayoutEffect as a, useRef as o, useState as s } from "react";
|
|
8
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
-
//#region src/utils/scatter.utils.ts
|
|
10
|
-
var u = {
|
|
11
|
-
top: 16,
|
|
12
|
-
right: 16,
|
|
13
|
-
bottom: 32,
|
|
14
|
-
left: 40
|
|
15
|
-
};
|
|
16
|
-
function d(e, t) {
|
|
17
|
-
if (!(e > 0)) return 1;
|
|
18
|
-
let n = e / Math.max(1, t), r = 10 ** Math.floor(Math.log10(n)), i = n / r;
|
|
19
|
-
return (i >= 7.5 ? 10 : i >= 3.5 ? 5 : i >= 1.5 ? 2 : 1) * r;
|
|
20
|
-
}
|
|
21
|
-
function f(e, t, n) {
|
|
22
|
-
let r = d(t - e, n), i = Math.ceil(e / r) * r, a = [];
|
|
23
|
-
for (let e = i; e <= t + r * 1e-6; e += r) a.push(Number(e.toPrecision(12)));
|
|
24
|
-
return a.length > 0 ? a : [e, t];
|
|
25
|
-
}
|
|
26
|
-
function p(e, t, n) {
|
|
27
|
-
let r = e.flatMap((e) => e.data.filter((e) => Number.isFinite(e.x) && Number.isFinite(e.y))), i = r.map((e) => e.x), a = r.map((e) => e.y), o = i.length ? Math.min(...i) : 0, s = i.length ? Math.max(...i) : 1, c = a.length ? Math.min(...a) : 0, l = a.length ? Math.max(...a) : 1, d = s - o || 1, p = l - c || 1, m = Math.max(0, t - u.left - u.right), h = Math.max(0, n - u.top - u.bottom), g = (e) => u.left + (e - o) / d * m, _ = (e) => u.top + (l - e) / p * h;
|
|
28
|
-
return {
|
|
29
|
-
points: e.flatMap((e) => e.data.flatMap((t, n) => Number.isFinite(t.x) && Number.isFinite(t.y) ? [{
|
|
30
|
-
series: e.id,
|
|
31
|
-
index: n,
|
|
32
|
-
x: t.x,
|
|
33
|
-
y: t.y,
|
|
34
|
-
px: g(t.x),
|
|
35
|
-
py: _(t.y)
|
|
36
|
-
}] : [])),
|
|
37
|
-
xTicks: f(o, s, 4),
|
|
38
|
-
yTicks: f(c, l, 4),
|
|
39
|
-
xOf: g,
|
|
40
|
-
yOf: _
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/charts/ScatterChart/index.tsx
|
|
45
|
-
var m = 640, h = 360, g = {
|
|
46
|
-
solid: void 0,
|
|
47
|
-
dashed: "5 4",
|
|
48
|
-
dotted: "2 3"
|
|
49
|
-
};
|
|
50
|
-
function _({ series: u, width: d = m, height: f = h, className: _, ariaLabel: v = "Scatter chart", xLabel: y, yLabel: b, animate: x = !0, onSelect: S, renderTooltip: C, theme: w, unstyled: T }) {
|
|
51
|
-
let E = n({
|
|
52
|
-
theme: w,
|
|
53
|
-
unstyled: T
|
|
54
|
-
}), D = E?.palette.categorical ?? [], O = E?.palette.text, k = E?.palette.grid, A = p(u, d, f), j = {}, M = /* @__PURE__ */ new Map();
|
|
55
|
-
A.points.forEach((e) => {
|
|
56
|
-
let t = u.findIndex((t) => t.id === e.series), n = u[t], r = n?.data[e.index], i = `p:${e.series}:${e.index}`;
|
|
57
|
-
j[i] = [
|
|
58
|
-
e.px,
|
|
59
|
-
e.py,
|
|
60
|
-
r?.radius ?? 3.5
|
|
61
|
-
], n?.markers !== !1 && M.set(i, r?.color ?? n?.color ?? D[t % Math.max(1, D.length)]);
|
|
62
|
-
}), A.xTicks.forEach((e) => {
|
|
63
|
-
j[`x:${e}`] = [A.xOf(e), 1];
|
|
64
|
-
}), A.yTicks.forEach((e) => {
|
|
65
|
-
j[`y:${e}`] = [A.yOf(e), 1];
|
|
66
|
-
});
|
|
67
|
-
let N = o(A), P = (e, t) => {
|
|
68
|
-
let n = Number(t.slice(2));
|
|
69
|
-
return t.startsWith("x:") ? e.xOf(n) : e.yOf(n);
|
|
70
|
-
}, F = r(j, x, {
|
|
71
|
-
enter: (e, [t, n]) => e.startsWith("p:") ? [
|
|
72
|
-
t,
|
|
73
|
-
n,
|
|
74
|
-
0
|
|
75
|
-
] : [P(N.current, e), 0],
|
|
76
|
-
exit: (e, [t, n]) => e.startsWith("p:") ? [
|
|
77
|
-
t,
|
|
78
|
-
n,
|
|
79
|
-
0
|
|
80
|
-
] : [P(A, e), 0]
|
|
81
|
-
}), I = i(M, F);
|
|
82
|
-
a(() => {
|
|
83
|
-
N.current = A;
|
|
84
|
-
});
|
|
85
|
-
let L = (e) => Object.keys(F).filter((t) => t.startsWith(`${e}:`)).map((e) => {
|
|
86
|
-
let [t, n] = F[e];
|
|
87
|
-
return {
|
|
88
|
-
key: e,
|
|
89
|
-
value: Number(e.slice(2)),
|
|
90
|
-
at: t,
|
|
91
|
-
opacity: n < 1 ? Math.max(0, n) : void 0
|
|
92
|
-
};
|
|
93
|
-
}), R = Object.keys(F).filter((e) => e.startsWith("p:") && !(e in j) && I.has(e)), z = (e) => {
|
|
94
|
-
let [t, n, r] = F[`p:${e.series}:${e.index}`] ?? [];
|
|
95
|
-
return {
|
|
96
|
-
x: t ?? e.px,
|
|
97
|
-
y: n ?? e.py,
|
|
98
|
-
r
|
|
99
|
-
};
|
|
100
|
-
}, [B, V] = s(0), H = A.points[B], U = u.find((e) => e.id === H?.series);
|
|
101
|
-
return /* @__PURE__ */ l("div", {
|
|
102
|
-
className: t(_),
|
|
103
|
-
style: { position: "relative" },
|
|
104
|
-
children: [/* @__PURE__ */ l("svg", {
|
|
105
|
-
role: "img",
|
|
106
|
-
"aria-label": v,
|
|
107
|
-
tabIndex: 0,
|
|
108
|
-
viewBox: `0 0 ${d} ${f}`,
|
|
109
|
-
style: e,
|
|
110
|
-
onKeyDown: (e) => {
|
|
111
|
-
(e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(), V((t) => {
|
|
112
|
-
let n = e.key === "ArrowRight" ? t + 1 : t - 1;
|
|
113
|
-
return Math.max(0, Math.min(A.points.length - 1, n));
|
|
114
|
-
}));
|
|
115
|
-
},
|
|
116
|
-
children: [
|
|
117
|
-
L("y").map((e) => /* @__PURE__ */ l("g", {
|
|
118
|
-
opacity: e.opacity,
|
|
119
|
-
children: [/* @__PURE__ */ c("line", {
|
|
120
|
-
"data-part": "grid",
|
|
121
|
-
x1: 40,
|
|
122
|
-
x2: d - 16,
|
|
123
|
-
y1: e.at,
|
|
124
|
-
y2: e.at,
|
|
125
|
-
stroke: k
|
|
126
|
-
}), /* @__PURE__ */ c("text", {
|
|
127
|
-
"data-part": "tick",
|
|
128
|
-
x: 36,
|
|
129
|
-
y: e.at,
|
|
130
|
-
textAnchor: "end",
|
|
131
|
-
fill: O,
|
|
132
|
-
fontSize: 11,
|
|
133
|
-
children: e.value
|
|
134
|
-
})]
|
|
135
|
-
}, e.key)),
|
|
136
|
-
L("x").map((e) => /* @__PURE__ */ c("text", {
|
|
137
|
-
"data-part": "tick",
|
|
138
|
-
x: e.at,
|
|
139
|
-
y: f - 12,
|
|
140
|
-
opacity: e.opacity,
|
|
141
|
-
textAnchor: "middle",
|
|
142
|
-
fill: O,
|
|
143
|
-
fontSize: 11,
|
|
144
|
-
children: e.value
|
|
145
|
-
}, e.key)),
|
|
146
|
-
y && /* @__PURE__ */ c("text", {
|
|
147
|
-
"data-part": "axis-label",
|
|
148
|
-
x: d / 2,
|
|
149
|
-
y: f - 1,
|
|
150
|
-
textAnchor: "middle",
|
|
151
|
-
fill: O,
|
|
152
|
-
fontSize: 11,
|
|
153
|
-
children: y
|
|
154
|
-
}),
|
|
155
|
-
b && /* @__PURE__ */ c("text", {
|
|
156
|
-
"data-part": "axis-label",
|
|
157
|
-
x: 12,
|
|
158
|
-
y: 16,
|
|
159
|
-
fill: O,
|
|
160
|
-
fontSize: 11,
|
|
161
|
-
children: b
|
|
162
|
-
}),
|
|
163
|
-
u.map((e) => {
|
|
164
|
-
if (!e.line) return null;
|
|
165
|
-
let t = A.points.filter((t) => t.series === e.id).sort((e, t) => e.index - t.index);
|
|
166
|
-
if (t.length < 2) return null;
|
|
167
|
-
let n = t.map((e, t) => {
|
|
168
|
-
let { x: n, y: r } = z(e);
|
|
169
|
-
return `${t === 0 ? "M" : "L"} ${n} ${r}`;
|
|
170
|
-
}).join(" ");
|
|
171
|
-
return /* @__PURE__ */ c("path", {
|
|
172
|
-
"data-part": "line",
|
|
173
|
-
"data-series": e.id,
|
|
174
|
-
d: n,
|
|
175
|
-
fill: "none",
|
|
176
|
-
stroke: e.color ?? O,
|
|
177
|
-
strokeDasharray: g[e.lineStyle ?? "solid"]
|
|
178
|
-
}, `line-${e.id}`);
|
|
179
|
-
}),
|
|
180
|
-
A.points.map((e, t) => {
|
|
181
|
-
let n = u.findIndex((t) => t.id === e.series), r = u[n];
|
|
182
|
-
if (r?.markers === !1) return null;
|
|
183
|
-
let i = r?.data[e.index], a = i?.color ?? r?.color ?? D[n % Math.max(1, D.length)], o = z(e), s = o.r ?? i?.radius ?? 3.5;
|
|
184
|
-
return /* @__PURE__ */ c("circle", {
|
|
185
|
-
"data-part": "point",
|
|
186
|
-
"data-series": e.series,
|
|
187
|
-
"data-active": t === B ? "" : void 0,
|
|
188
|
-
cx: o.x,
|
|
189
|
-
cy: o.y,
|
|
190
|
-
r: t === B ? 5 : s,
|
|
191
|
-
fill: a,
|
|
192
|
-
onPointerEnter: () => V(t),
|
|
193
|
-
onClick: () => {
|
|
194
|
-
let t = u.find((t) => t.id === e.series), n = t?.data[e.index];
|
|
195
|
-
t && n && S?.({
|
|
196
|
-
series: t,
|
|
197
|
-
point: n,
|
|
198
|
-
index: e.index
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}, `${e.series}:${e.index}`);
|
|
202
|
-
}),
|
|
203
|
-
R.map((e) => {
|
|
204
|
-
let [t, n, r] = F[e];
|
|
205
|
-
return /* @__PURE__ */ c("circle", {
|
|
206
|
-
"data-part": "point",
|
|
207
|
-
"data-leaving": "",
|
|
208
|
-
cx: t,
|
|
209
|
-
cy: n,
|
|
210
|
-
r: Math.max(0, r),
|
|
211
|
-
fill: I.get(e),
|
|
212
|
-
pointerEvents: "none"
|
|
213
|
-
}, e);
|
|
214
|
-
})
|
|
215
|
-
]
|
|
216
|
-
}), H && U && (C?.({
|
|
217
|
-
series: U,
|
|
218
|
-
point: H,
|
|
219
|
-
index: H.index
|
|
220
|
-
}) ?? /* @__PURE__ */ l("div", {
|
|
221
|
-
"data-part": "tooltip",
|
|
222
|
-
children: [
|
|
223
|
-
U.name,
|
|
224
|
-
" ",
|
|
225
|
-
H.x,
|
|
226
|
-
", ",
|
|
227
|
-
H.y
|
|
228
|
-
]
|
|
229
|
-
}))]
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/utils/polar.utils.ts
|
|
234
|
-
var v = Math.PI * 2, y = (e) => Math.round(e * 100) / 100;
|
|
235
|
-
function b(e, t, n, r) {
|
|
236
|
-
return [y(e + n * Math.sin(r)), y(t - n * Math.cos(r))];
|
|
237
|
-
}
|
|
238
|
-
function x(e, t, n, r, i, a) {
|
|
239
|
-
let [o, s] = +(a >= i) == 1 ? [i, a] : [a, i], c = +(Math.abs(s - o) > Math.PI), l = b(e, t, r, o), u = b(e, t, r, s), d = b(e, t, n, s), f = b(e, t, n, o);
|
|
240
|
-
return [
|
|
241
|
-
`M ${l[0]} ${l[1]}`,
|
|
242
|
-
`A ${r} ${r} 0 ${c} 1 ${u[0]} ${u[1]}`,
|
|
243
|
-
`L ${d[0]} ${d[1]}`,
|
|
244
|
-
`A ${n} ${n} 0 ${c} 0 ${f[0]} ${f[1]}`,
|
|
245
|
-
"Z"
|
|
246
|
-
].join(" ");
|
|
247
|
-
}
|
|
248
|
-
function S(e, t, n) {
|
|
249
|
-
let r = v / Math.max(1, t), i = n === "counterclockwise" ? -1 : 1, a = i * e * r;
|
|
250
|
-
return [a, a + i * r];
|
|
251
|
-
}
|
|
252
|
-
function C(e, t, n) {
|
|
253
|
-
return !(t > 0) || !Number.isFinite(e) || e <= 0 ? 0 : e / t * n;
|
|
254
|
-
}
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region src/charts/PolarChart/index.tsx
|
|
257
|
-
var w = 320, T = w / 2, E = 120;
|
|
258
|
-
function D(a) {
|
|
259
|
-
let { className: o, ariaLabel: u = "Polar chart", direction: d = "clockwise", unit: f, animate: p = !0, renderTooltip: m, theme: h, unstyled: g } = a, _ = n({
|
|
260
|
-
theme: h,
|
|
261
|
-
unstyled: g
|
|
262
|
-
}), v = _?.palette.categorical ?? [], y = _?.palette.text, D = _?.palette.grid, [O, k] = s(0), A = a.mode ?? "bar", j = a.mode === "scatter" ? a : null, M = a.mode === "scatter" ? null : a, N = j ? j.series.reduce((e, t) => e + t.data.length, 0) : M?.categories.length ?? 0, P = j ? Math.max(0, ...j.series.flatMap((e) => e.data.map((e) => e.radius))) : Math.max(0, ...M?.series.flatMap((e) => e.data.filter((e) => Number.isFinite(e))) ?? []), F = (e) => {
|
|
263
|
-
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
264
|
-
e.preventDefault();
|
|
265
|
-
let t = e.key === "ArrowRight" ? 1 : -1;
|
|
266
|
-
k((e) => (e + t + Math.max(N, 1)) % Math.max(N, 1));
|
|
267
|
-
}, I = {};
|
|
268
|
-
M?.series.forEach((e) => M.categories.forEach((t, n) => {
|
|
269
|
-
let r = e.data[n];
|
|
270
|
-
typeof r == "number" && r > 0 && (I[`r:${e.id}:${t}`] = [C(r, P, E)]);
|
|
271
|
-
})), j?.series.forEach((e) => e.data.forEach((t, n) => {
|
|
272
|
-
let r = (d === "counterclockwise" ? -1 : 1) * (t.angle * Math.PI) / 180;
|
|
273
|
-
I[`d:${e.id}:${n}`] = b(T, T, C(t.radius, P, E), r);
|
|
274
|
-
}));
|
|
275
|
-
let L = /* @__PURE__ */ new Map();
|
|
276
|
-
A === "bar" && M?.series.forEach((e, t) => M.categories.forEach((n, r) => {
|
|
277
|
-
let [i, a] = S(r, M.categories.length, d);
|
|
278
|
-
L.set(`r:${e.id}:${n}`, {
|
|
279
|
-
series: e.id,
|
|
280
|
-
start: i,
|
|
281
|
-
end: a,
|
|
282
|
-
color: e.color ?? v[t % Math.max(1, v.length)]
|
|
283
|
-
});
|
|
284
|
-
})), j?.series.forEach((e, t) => e.data.forEach((n, r) => {
|
|
285
|
-
L.set(`d:${e.id}:${r}`, {
|
|
286
|
-
series: e.id,
|
|
287
|
-
start: 0,
|
|
288
|
-
end: 0,
|
|
289
|
-
color: e.color ?? v[t % Math.max(1, v.length)]
|
|
290
|
-
});
|
|
291
|
-
}));
|
|
292
|
-
let R = (e, t) => e.startsWith("r:") ? [0] : t.map(() => T), z = r(I, p, {
|
|
293
|
-
enter: R,
|
|
294
|
-
exit: R
|
|
295
|
-
}), B = i(new Map([...L].filter(([e]) => e in I)), z), V = Object.keys(z).filter((e) => !(e in I) && B.has(e)), H = (e, t, n) => z[`r:${e}:${t}`]?.[0] ?? C(n, P, E), U = A === "bar" && M ? M.series.flatMap((e, t) => M.categories.flatMap((n, r) => {
|
|
296
|
-
let i = e.data[r];
|
|
297
|
-
if (typeof i != "number" || !(i > 0)) return [];
|
|
298
|
-
let [a, o] = S(r, M.categories.length, d);
|
|
299
|
-
return [{
|
|
300
|
-
key: `${e.id}:${n}`,
|
|
301
|
-
series: e.id,
|
|
302
|
-
label: n,
|
|
303
|
-
value: String(i),
|
|
304
|
-
d: x(T, T, 0, H(e.id, n, i), a, o),
|
|
305
|
-
color: e.color ?? v[t % Math.max(1, v.length)],
|
|
306
|
-
index: r
|
|
307
|
-
}];
|
|
308
|
-
})) : [], W = j ? j.series.flatMap((e, t) => e.data.map((n, r) => {
|
|
309
|
-
let [i, a] = z[`d:${e.id}:${r}`] ?? [T, T];
|
|
310
|
-
return {
|
|
311
|
-
key: `${e.id}:${r}`,
|
|
312
|
-
series: e.id,
|
|
313
|
-
label: `${n.angle}°`,
|
|
314
|
-
value: String(n.radius),
|
|
315
|
-
x: i,
|
|
316
|
-
y: a,
|
|
317
|
-
color: e.color ?? v[t % Math.max(1, v.length)]
|
|
318
|
-
};
|
|
319
|
-
})) : [], G = A === "line" && M ? M.series.flatMap((e, t) => {
|
|
320
|
-
let n = M.categories.flatMap((t, n) => {
|
|
321
|
-
let r = e.data[n];
|
|
322
|
-
if (typeof r != "number" || !(r > 0)) return [];
|
|
323
|
-
let [i, a] = S(n, M.categories.length, d), o = (i + a) / 2;
|
|
324
|
-
return [b(T, T, H(e.id, t, r), o)];
|
|
325
|
-
});
|
|
326
|
-
return n.length < 2 ? [] : [{
|
|
327
|
-
key: e.id,
|
|
328
|
-
series: e.id,
|
|
329
|
-
label: M.categories[O] ?? e.name,
|
|
330
|
-
value: String(e.data[O] ?? ""),
|
|
331
|
-
d: `M ${n.map((e) => e.join(" ")).join(" L ")} Z`,
|
|
332
|
-
color: e.color ?? v[t % Math.max(1, v.length)]
|
|
333
|
-
}];
|
|
334
|
-
}) : [], K = A === "bar" ? U.find((e) => e.index === O) : A === "line" ? G[0] : W[O];
|
|
335
|
-
return /* @__PURE__ */ l("div", {
|
|
336
|
-
className: t(o),
|
|
337
|
-
"data-mode": A,
|
|
338
|
-
style: { position: "relative" },
|
|
339
|
-
children: [/* @__PURE__ */ l("svg", {
|
|
340
|
-
role: "img",
|
|
341
|
-
"aria-label": u,
|
|
342
|
-
tabIndex: 0,
|
|
343
|
-
viewBox: `0 0 ${w} ${w}`,
|
|
344
|
-
style: e,
|
|
345
|
-
onKeyDown: F,
|
|
346
|
-
children: [
|
|
347
|
-
[
|
|
348
|
-
.25,
|
|
349
|
-
.5,
|
|
350
|
-
.75,
|
|
351
|
-
1
|
|
352
|
-
].map((e) => /* @__PURE__ */ c("circle", {
|
|
353
|
-
"data-part": "ring",
|
|
354
|
-
cx: T,
|
|
355
|
-
cy: T,
|
|
356
|
-
r: E * e,
|
|
357
|
-
fill: "none",
|
|
358
|
-
stroke: D
|
|
359
|
-
}, e)),
|
|
360
|
-
M && M.categories.map((e, t) => {
|
|
361
|
-
let [n] = S(t, M.categories.length, d), [r, i] = b(T, T, 136, n + (d === "counterclockwise" ? -1 : 1) * (Math.PI / M.categories.length));
|
|
362
|
-
return /* @__PURE__ */ c("text", {
|
|
363
|
-
"data-part": "tick",
|
|
364
|
-
x: r,
|
|
365
|
-
y: i,
|
|
366
|
-
textAnchor: "middle",
|
|
367
|
-
fill: y,
|
|
368
|
-
fontSize: 11,
|
|
369
|
-
children: e
|
|
370
|
-
}, e);
|
|
371
|
-
}),
|
|
372
|
-
f && /* @__PURE__ */ c("text", {
|
|
373
|
-
"data-part": "unit",
|
|
374
|
-
x: T,
|
|
375
|
-
y: 156,
|
|
376
|
-
textAnchor: "middle",
|
|
377
|
-
fill: y,
|
|
378
|
-
fontSize: 11,
|
|
379
|
-
children: f
|
|
380
|
-
}),
|
|
381
|
-
G.map((e) => /* @__PURE__ */ c("path", {
|
|
382
|
-
"data-part": "line",
|
|
383
|
-
"data-series": e.series,
|
|
384
|
-
d: e.d,
|
|
385
|
-
fill: e.color,
|
|
386
|
-
fillOpacity: .16,
|
|
387
|
-
stroke: e.color,
|
|
388
|
-
strokeWidth: 1.5
|
|
389
|
-
}, e.key)),
|
|
390
|
-
U.map((e) => /* @__PURE__ */ c("path", {
|
|
391
|
-
"data-part": "sector",
|
|
392
|
-
"data-series": e.series,
|
|
393
|
-
"data-active": e.index === O ? "" : void 0,
|
|
394
|
-
d: e.d,
|
|
395
|
-
fill: e.color,
|
|
396
|
-
opacity: .72,
|
|
397
|
-
onPointerEnter: () => k(e.index)
|
|
398
|
-
}, e.key)),
|
|
399
|
-
W.map((e, t) => /* @__PURE__ */ c("circle", {
|
|
400
|
-
"data-part": "point",
|
|
401
|
-
"data-series": e.series,
|
|
402
|
-
"data-active": t === O ? "" : void 0,
|
|
403
|
-
cx: e.x,
|
|
404
|
-
cy: e.y,
|
|
405
|
-
r: 4,
|
|
406
|
-
fill: e.color,
|
|
407
|
-
onPointerEnter: () => k(t)
|
|
408
|
-
}, e.key)),
|
|
409
|
-
V.map((e) => {
|
|
410
|
-
let t = B.get(e), n = z[e];
|
|
411
|
-
return e.startsWith("r:") ? /* @__PURE__ */ c("path", {
|
|
412
|
-
"data-part": "sector",
|
|
413
|
-
"data-leaving": "",
|
|
414
|
-
"data-series": t.series,
|
|
415
|
-
d: x(T, T, 0, Math.max(0, n[0]), t.start, t.end),
|
|
416
|
-
fill: t.color,
|
|
417
|
-
opacity: .72,
|
|
418
|
-
pointerEvents: "none"
|
|
419
|
-
}, e) : /* @__PURE__ */ c("circle", {
|
|
420
|
-
"data-part": "point",
|
|
421
|
-
"data-leaving": "",
|
|
422
|
-
"data-series": t.series,
|
|
423
|
-
cx: n[0],
|
|
424
|
-
cy: n[1],
|
|
425
|
-
r: 4,
|
|
426
|
-
fill: t.color,
|
|
427
|
-
pointerEvents: "none"
|
|
428
|
-
}, e);
|
|
429
|
-
})
|
|
430
|
-
]
|
|
431
|
-
}), K && (m?.({
|
|
432
|
-
series: K.series,
|
|
433
|
-
label: K.label,
|
|
434
|
-
value: K.value
|
|
435
|
-
}) ?? /* @__PURE__ */ l("div", {
|
|
436
|
-
"data-part": "tooltip",
|
|
437
|
-
children: [
|
|
438
|
-
K.series,
|
|
439
|
-
" ",
|
|
440
|
-
K.label,
|
|
441
|
-
" ",
|
|
442
|
-
K.value
|
|
443
|
-
]
|
|
444
|
-
}))]
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
//#endregion
|
|
448
|
-
export { p as i, x as n, _ as r, D as t };
|
|
449
|
-
|
|
450
|
-
//# sourceMappingURL=PolarChart-hcNTWKfJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PolarChart-hcNTWKfJ.js","names":["HEATMAP_SVG","useChartTheme","useTween","useMarkMemory","PAD","niceStep","span","rough","count","power","error","ticks","step","max","min","start","values","value","scatterLayout","finite","series","item","point","xs","ys","xMin","xMax","yMin","yMax","xSpan","ySpan","plotW","width","plotH","height","xOf","yOf","WIDTH","HEIGHT","DASH","ScatterChart","resolved","categorical","text","grid","frame","target","colors","seriesIndex","entry","spec","source","key","tick","previous","useRef","tickAt","layout","drawn","animate","x","y","memory","axis","at","opacity","leaving","active","setActive","useState","classes","className","ariaLabel","event","next","current","xLabel","yLabel","placed","a","b","d","index","color","place","radius","chosen","onSelect","renderTooltip","TAU","round","polarPoint","cx","angle","cy","sectorPath","from","to","end","large","outerStart","outer","outerEnd","innerEnd","inner","innerStart","wedgeAngles","sign","direction","barRadius","SIZE","CENTER","RADIUS","PolarChart","props","mode","scatter","rose","sum","onKey","label","turn","shapes","toCentre","radiusOf","id","sectors","dots","polygons","points","mid","sector","unit","polygon","dot","shape"],"sources":["../src/utils/scatter.utils.ts","../src/charts/ScatterChart/index.tsx","../src/utils/polar.utils.ts","../src/charts/PolarChart/index.tsx"],"sourcesContent":["export interface ScatterDatum {\n x: number;\n y: number;\n}\n\nexport interface ScatterSeriesInput {\n id: string;\n data: readonly ScatterDatum[];\n}\n\nexport interface PlacedScatterPoint {\n series: string;\n index: number;\n x: number;\n y: number;\n px: number;\n py: number;\n}\n\nexport interface ScatterFrame {\n points: PlacedScatterPoint[];\n xTicks: number[];\n yTicks: number[];\n xOf: (value: number) => number;\n yOf: (value: number) => number;\n}\n\nconst PAD = { top: 16, right: 16, bottom: 32, left: 40 };\n\nfunction niceStep(span: number, count: number): number {\n if (!(span > 0)) return 1;\n\n const rough = span / Math.max(1, count);\n const power = 10 ** Math.floor(Math.log10(rough));\n const error = rough / power;\n const nice = error >= 7.5 ? 10 : error >= 3.5 ? 5 : error >= 1.5 ? 2 : 1;\n\n return nice * power;\n}\n\nfunction ticks(min: number, max: number, count: number): number[] {\n const step = niceStep(max - min, count);\n const start = Math.ceil(min / step) * step;\n const values: number[] = [];\n\n for (let value = start; value <= max + step * 1e-6; value += step)\n values.push(Number(value.toPrecision(12)));\n\n return values.length > 0 ? values : [min, max];\n}\n\nexport function scatterLayout(\n series: readonly ScatterSeriesInput[],\n width: number,\n height: number,\n): ScatterFrame {\n const finite = series.flatMap((item) =>\n item.data.filter(\n (point) => Number.isFinite(point.x) && Number.isFinite(point.y),\n ),\n );\n const xs = finite.map((point) => point.x);\n const ys = finite.map((point) => point.y);\n const xMin = xs.length ? Math.min(...xs) : 0;\n const xMax = xs.length ? Math.max(...xs) : 1;\n const yMin = ys.length ? Math.min(...ys) : 0;\n const yMax = ys.length ? Math.max(...ys) : 1;\n const xSpan = xMax - xMin || 1;\n const ySpan = yMax - yMin || 1;\n const plotW = Math.max(0, width - PAD.left - PAD.right);\n const plotH = Math.max(0, height - PAD.top - PAD.bottom);\n const xOf = (value: number) => PAD.left + ((value - xMin) / xSpan) * plotW;\n const yOf = (value: number) => PAD.top + ((yMax - value) / ySpan) * plotH;\n const points = series.flatMap((item) =>\n item.data.flatMap((point, index) =>\n Number.isFinite(point.x) && Number.isFinite(point.y)\n ? [\n {\n series: item.id,\n index,\n x: point.x,\n y: point.y,\n px: xOf(point.x),\n py: yOf(point.y),\n },\n ]\n : [],\n ),\n );\n\n return {\n points,\n xTicks: ticks(xMin, xMax, 4),\n yTicks: ticks(yMin, yMax, 4),\n xOf,\n yOf,\n };\n}\n","import { useLayoutEffect, useRef, useState, type KeyboardEvent } from \"react\";\nimport type { ScatterChartProps } from \"../../types/scatter.js\";\nimport { useChartTheme } from \"../../hooks/useChartTheme.js\";\nimport { scatterLayout } from \"../../utils/scatter.utils.js\";\nimport { classes } from \"../../utils/dom.utils.js\";\nimport { HEATMAP_SVG } from \"../../styles/heatmap.js\";\nimport { useTween } from \"../../hooks/useTween.js\";\nimport { useMarkMemory } from \"../../hooks/useMarkMemory.js\";\n\nconst WIDTH = 640;\nconst HEIGHT = 360;\n\nconst DASH = { solid: undefined, dashed: \"5 4\", dotted: \"2 3\" } as const;\n\nexport function ScatterChart({\n series,\n width = WIDTH,\n height = HEIGHT,\n className,\n ariaLabel = \"Scatter chart\",\n xLabel,\n yLabel,\n animate = true,\n onSelect,\n renderTooltip,\n theme,\n unstyled,\n}: ScatterChartProps) {\n const resolved = useChartTheme({ theme, unstyled });\n const categorical = resolved?.palette.categorical ?? [];\n const text = resolved?.palette.text;\n const grid = resolved?.palette.grid;\n const frame = scatterLayout(series, width, height);\n const target: Record<string, number[]> = {};\n const colors = new Map<string, string | undefined>();\n\n frame.points.forEach((item) => {\n const seriesIndex = series.findIndex((entry) => entry.id === item.series);\n const spec = series[seriesIndex];\n const source = spec?.data[item.index];\n const key = `p:${item.series}:${item.index}`;\n\n target[key] = [item.px, item.py, source?.radius ?? 3.5];\n if (spec?.markers !== false) {\n colors.set(\n key,\n source?.color ?? spec?.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n );\n }\n });\n frame.xTicks.forEach((tick) => {\n target[`x:${tick}`] = [frame.xOf(tick), 1];\n });\n frame.yTicks.forEach((tick) => {\n target[`y:${tick}`] = [frame.yOf(tick), 1];\n });\n\n const previous = useRef(frame);\n const tickAt = (layout: typeof frame, key: string) => {\n const value = Number(key.slice(2));\n\n return key.startsWith(\"x:\") ? layout.xOf(value) : layout.yOf(value);\n };\n const drawn = useTween(target, animate, {\n enter: (key, [x, y]) =>\n key.startsWith(\"p:\") ? [x!, y!, 0] : [tickAt(previous.current, key), 0],\n exit: (key, [x, y]) => (key.startsWith(\"p:\") ? [x!, y!, 0] : [tickAt(frame, key), 0]),\n });\n\n const memory = useMarkMemory(colors, drawn);\n useLayoutEffect(() => {\n previous.current = frame;\n });\n\n const ticks = (axis: \"x\" | \"y\") =>\n Object.keys(drawn)\n .filter((key) => key.startsWith(`${axis}:`))\n .map((key) => {\n const [at, opacity] = drawn[key]!;\n\n return { key, value: Number(key.slice(2)), at: at!, opacity: opacity! < 1 ? Math.max(0, opacity!) : undefined };\n });\n const leaving = Object.keys(drawn).filter(\n (key) => key.startsWith(\"p:\") && !(key in target) && memory.has(key),\n );\n const at = (item: { series: string; index: number; px: number; py: number }) => {\n const [x, y, r] = drawn[`p:${item.series}:${item.index}`] ?? [];\n\n return { x: x ?? item.px, y: y ?? item.py, r };\n };\n const [active, setActive] = useState(0);\n const point = frame.points[active];\n const spec = series.find((item) => item.id === point?.series);\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n\n event.preventDefault();\n setActive((current) => {\n const next = event.key === \"ArrowRight\" ? current + 1 : current - 1;\n\n return Math.max(0, Math.min(frame.points.length - 1, next));\n });\n };\n\n return (\n <div className={classes(className)} style={{ position: \"relative\" }}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n tabIndex={0}\n viewBox={`0 0 ${width} ${height}`}\n style={HEATMAP_SVG}\n onKeyDown={onKey}\n >\n {ticks(\"y\").map((tick) => (\n <g key={tick.key} opacity={tick.opacity}>\n <line data-part=\"grid\" x1={40} x2={width - 16} y1={tick.at} y2={tick.at} stroke={grid} />\n <text data-part=\"tick\" x={36} y={tick.at} textAnchor=\"end\" fill={text} fontSize={11}>\n {tick.value}\n </text>\n </g>\n ))}\n {ticks(\"x\").map((tick) => (\n <text key={tick.key} data-part=\"tick\" x={tick.at} y={height - 12} opacity={tick.opacity} textAnchor=\"middle\" fill={text} fontSize={11}>\n {tick.value}\n </text>\n ))}\n {xLabel && (\n <text data-part=\"axis-label\" x={width / 2} y={height - 1} textAnchor=\"middle\" fill={text} fontSize={11}>\n {xLabel}\n </text>\n )}\n {yLabel && (\n <text data-part=\"axis-label\" x={12} y={16} fill={text} fontSize={11}>\n {yLabel}\n </text>\n )}\n {series.map((entry) => {\n if (!entry.line) return null;\n\n const placed = frame.points\n .filter((item) => item.series === entry.id)\n .sort((a, b) => a.index - b.index);\n\n if (placed.length < 2) return null;\n\n const d = placed\n .map((item, index) => {\n const { x, y } = at(item);\n\n return `${index === 0 ? \"M\" : \"L\"} ${x} ${y}`;\n })\n .join(\" \");\n\n return (\n <path\n key={`line-${entry.id}`}\n data-part=\"line\"\n data-series={entry.id}\n d={d}\n fill=\"none\"\n stroke={entry.color ?? text}\n strokeDasharray={DASH[entry.lineStyle ?? \"solid\"]}\n />\n );\n })}\n {frame.points.map((item, index) => {\n const seriesIndex = series.findIndex((entry) => entry.id === item.series);\n const spec = series[seriesIndex];\n\n if (spec?.markers === false) return null;\n\n const source = spec?.data[item.index];\n const color =\n source?.color ??\n spec?.color ??\n categorical[seriesIndex % Math.max(1, categorical.length)];\n\n const place = at(item);\n const radius = place.r ?? source?.radius ?? 3.5;\n\n return (\n <circle\n key={`${item.series}:${item.index}`}\n data-part=\"point\"\n data-series={item.series}\n data-active={index === active ? \"\" : undefined}\n cx={place.x}\n cy={place.y}\n r={index === active ? 5 : radius}\n fill={color}\n onPointerEnter={() => setActive(index)}\n onClick={() => {\n const chosen = series.find((entry) => entry.id === item.series);\n const point = chosen?.data[item.index];\n\n if (chosen && point) onSelect?.({ series: chosen, point, index: item.index });\n }}\n />\n );\n })}\n {leaving.map((key) => {\n const [x, y, r] = drawn[key]!;\n\n return (\n <circle\n key={key}\n data-part=\"point\"\n data-leaving=\"\"\n cx={x}\n cy={y}\n r={Math.max(0, r!)}\n fill={memory.get(key)}\n pointerEvents=\"none\"\n />\n );\n })}\n </svg>\n {point && spec &&\n (renderTooltip?.({ series: spec, point, index: point.index }) ?? (\n <div data-part=\"tooltip\">\n {spec.name} {point.x}, {point.y}\n </div>\n ))}\n </div>\n );\n}\n","const TAU = Math.PI * 2;\n\nexport type PolarDirection = \"clockwise\" | \"counterclockwise\";\n\nconst round = (value: number) => Math.round(value * 100) / 100;\n\nexport function polarPoint(\n cx: number,\n cy: number,\n radius: number,\n angle: number,\n): [number, number] {\n return [\n round(cx + radius * Math.sin(angle)),\n round(cy - radius * Math.cos(angle)),\n ];\n}\n\n/** Annular wedge. Angle 0 is north. Clockwise matches a wind rose. */\nexport function sectorPath(\n cx: number,\n cy: number,\n inner: number,\n outer: number,\n start: number,\n end: number,\n): string {\n const sweep = end >= start ? 1 : 0;\n const [from, to] = sweep === 1 ? [start, end] : [end, start];\n const large = Math.abs(to - from) > Math.PI ? 1 : 0;\n const outerStart = polarPoint(cx, cy, outer, from);\n const outerEnd = polarPoint(cx, cy, outer, to);\n const innerEnd = polarPoint(cx, cy, inner, to);\n const innerStart = polarPoint(cx, cy, inner, from);\n\n return [\n `M ${outerStart[0]} ${outerStart[1]}`,\n `A ${outer} ${outer} 0 ${large} 1 ${outerEnd[0]} ${outerEnd[1]}`,\n `L ${innerEnd[0]} ${innerEnd[1]}`,\n `A ${inner} ${inner} 0 ${large} 0 ${innerStart[0]} ${innerStart[1]}`,\n \"Z\",\n ].join(\" \");\n}\n\nexport function wedgeAngles(\n index: number,\n count: number,\n direction: PolarDirection,\n): [number, number] {\n const span = TAU / Math.max(1, count);\n const sign = direction === \"counterclockwise\" ? -1 : 1;\n const start = sign * index * span;\n\n return [start, start + sign * span];\n}\n\nexport function barRadius(value: number, max: number, radius: number): number {\n if (!(max > 0) || !Number.isFinite(value) || value <= 0) return 0;\n\n return (value / max) * radius;\n}\n","import { useState, type KeyboardEvent } from \"react\";\nimport type { PolarChartProps } from \"../../types/polar.js\";\nimport { useChartTheme } from \"../../hooks/useChartTheme.js\";\nimport { barRadius, polarPoint, sectorPath, wedgeAngles } from \"../../utils/polar.utils.js\";\nimport { classes } from \"../../utils/dom.utils.js\";\nimport { HEATMAP_SVG } from \"../../styles/heatmap.js\";\nimport { useTween } from \"../../hooks/useTween.js\";\nimport { useMarkMemory } from \"../../hooks/useMarkMemory.js\";\n\ninterface PolarMemory {\n series: string;\n start: number;\n end: number;\n color: string | undefined;\n}\n\nconst SIZE = 320;\nconst CENTER = SIZE / 2;\nconst RADIUS = 120;\n\nexport function PolarChart(props: PolarChartProps) {\n const {\n className,\n ariaLabel = \"Polar chart\",\n direction = \"clockwise\",\n unit,\n animate = true,\n renderTooltip,\n theme,\n unstyled,\n } = props;\n const resolved = useChartTheme({ theme, unstyled });\n const categorical = resolved?.palette.categorical ?? [];\n const text = resolved?.palette.text;\n const grid = resolved?.palette.grid;\n const [active, setActive] = useState(0);\n const mode = props.mode ?? \"bar\";\n const scatter = props.mode === \"scatter\" ? props : null;\n const rose = props.mode === \"scatter\" ? null : props;\n const count = scatter\n ? scatter.series.reduce((sum, item) => sum + item.data.length, 0)\n : (rose?.categories.length ?? 0);\n const max = scatter\n ? Math.max(0, ...scatter.series.flatMap((item) => item.data.map((point) => point.radius)))\n : Math.max(0, ...(rose?.series.flatMap((item) => item.data.filter((value) => Number.isFinite(value))) ?? []));\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n\n event.preventDefault();\n const step = event.key === \"ArrowRight\" ? 1 : -1;\n\n setActive((current) => (current + step + Math.max(count, 1)) % Math.max(count, 1));\n };\n\n const target: Record<string, number[]> = {};\n\n rose?.series.forEach((item) =>\n rose.categories.forEach((label, index) => {\n const value = item.data[index];\n\n if (typeof value === \"number\" && value > 0) {\n target[`r:${item.id}:${label}`] = [barRadius(value, max, RADIUS)];\n }\n }),\n );\n scatter?.series.forEach((item) =>\n item.data.forEach((point, index) => {\n const turn = (direction === \"counterclockwise\" ? -1 : 1) * (point.angle * Math.PI) / 180;\n\n target[`d:${item.id}:${index}`] = polarPoint(CENTER, CENTER, barRadius(point.radius, max, RADIUS), turn);\n }),\n );\n const shapes = new Map<string, PolarMemory>();\n\n if (mode === \"bar\") {\n rose?.series.forEach((item, seriesIndex) =>\n rose.categories.forEach((label, index) => {\n const [start, end] = wedgeAngles(index, rose.categories.length, direction);\n\n shapes.set(`r:${item.id}:${label}`, {\n series: item.id,\n start,\n end,\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n });\n }),\n );\n }\n scatter?.series.forEach((item, seriesIndex) =>\n item.data.forEach((_point, index) => {\n shapes.set(`d:${item.id}:${index}`, {\n series: item.id,\n start: 0,\n end: 0,\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n });\n }),\n );\n const toCentre = (key: string, value: readonly number[]) =>\n key.startsWith(\"r:\") ? [0] : value.map(() => CENTER);\n const drawn = useTween(target, animate, { enter: toCentre, exit: toCentre });\n const memory = useMarkMemory(\n new Map([...shapes].filter(([key]) => key in target)),\n drawn,\n );\n const leaving = Object.keys(drawn).filter((key) => !(key in target) && memory.has(key));\n const radiusOf = (id: string, label: string, value: number) =>\n drawn[`r:${id}:${label}`]?.[0] ?? barRadius(value, max, RADIUS);\n\n const sectors = mode === \"bar\" && rose\n ? rose.series.flatMap((item, seriesIndex) =>\n rose.categories.flatMap((label, index) => {\n const value = item.data[index];\n\n if (typeof value !== \"number\" || !(value > 0)) return [];\n\n const [start, end] = wedgeAngles(index, rose.categories.length, direction);\n\n return [\n {\n key: `${item.id}:${label}`,\n series: item.id,\n label,\n value: String(value),\n d: sectorPath(CENTER, CENTER, 0, radiusOf(item.id, label, value), start, end),\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n index,\n },\n ];\n }),\n )\n : [];\n const dots = scatter\n ? scatter.series.flatMap((item, seriesIndex) =>\n item.data.map((point, index) => {\n const [x, y] = drawn[`d:${item.id}:${index}`] ?? [CENTER, CENTER];\n\n return {\n key: `${item.id}:${index}`,\n series: item.id,\n label: `${point.angle}°`,\n value: String(point.radius),\n x,\n y,\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n };\n }),\n )\n : [];\n const polygons = mode === \"line\" && rose\n ? rose.series.flatMap((item, seriesIndex) => {\n const points = rose.categories.flatMap((label, index) => {\n const value = item.data[index];\n\n if (typeof value !== \"number\" || !(value > 0)) return [];\n\n const [start, end] = wedgeAngles(index, rose.categories.length, direction);\n const mid = (start + end) / 2;\n\n return [polarPoint(CENTER, CENTER, radiusOf(item.id, label, value), mid)];\n });\n\n if (points.length < 2) return [];\n\n return [\n {\n key: item.id,\n series: item.id,\n label: rose.categories[active] ?? item.name,\n value: String(item.data[active] ?? \"\"),\n d: `M ${points.map((point) => point.join(\" \")).join(\" L \")} Z`,\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n },\n ];\n })\n : [];\n const current = mode === \"bar\"\n ? sectors.find((sector) => sector.index === active)\n : mode === \"line\"\n ? polygons[0]\n : dots[active];\n\n return (\n <div className={classes(className)} data-mode={mode} style={{ position: \"relative\" }}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n tabIndex={0}\n viewBox={`0 0 ${SIZE} ${SIZE}`}\n style={HEATMAP_SVG}\n onKeyDown={onKey}\n >\n {[0.25, 0.5, 0.75, 1].map((step) => (\n <circle\n key={step}\n data-part=\"ring\"\n cx={CENTER}\n cy={CENTER}\n r={RADIUS * step}\n fill=\"none\"\n stroke={grid}\n />\n ))}\n {rose &&\n rose.categories.map((label, index) => {\n const [start] = wedgeAngles(index, rose.categories.length, direction);\n const [x, y] = polarPoint(CENTER, CENTER, RADIUS + 16, start + (direction === \"counterclockwise\" ? -1 : 1) * (Math.PI / rose.categories.length));\n\n return (\n <text key={label} data-part=\"tick\" x={x} y={y} textAnchor=\"middle\" fill={text} fontSize={11}>\n {label}\n </text>\n );\n })}\n {unit && (\n <text data-part=\"unit\" x={CENTER} y={CENTER - 4} textAnchor=\"middle\" fill={text} fontSize={11}>\n {unit}\n </text>\n )}\n {polygons.map((polygon) => (\n <path\n key={polygon.key}\n data-part=\"line\"\n data-series={polygon.series}\n d={polygon.d}\n fill={polygon.color}\n fillOpacity={0.16}\n stroke={polygon.color}\n strokeWidth={1.5}\n />\n ))}\n {sectors.map((sector) => (\n <path\n key={sector.key}\n data-part=\"sector\"\n data-series={sector.series}\n data-active={sector.index === active ? \"\" : undefined}\n d={sector.d}\n fill={sector.color}\n opacity={0.72}\n onPointerEnter={() => setActive(sector.index)}\n />\n ))}\n {dots.map((dot, index) => (\n <circle\n key={dot.key}\n data-part=\"point\"\n data-series={dot.series}\n data-active={index === active ? \"\" : undefined}\n cx={dot.x}\n cy={dot.y}\n r={4}\n fill={dot.color}\n onPointerEnter={() => setActive(index)}\n />\n ))}\n {leaving.map((key) => {\n const shape = memory.get(key)!;\n const value = drawn[key]!;\n\n return key.startsWith(\"r:\") ? (\n <path\n key={key}\n data-part=\"sector\"\n data-leaving=\"\"\n data-series={shape.series}\n d={sectorPath(CENTER, CENTER, 0, Math.max(0, value[0]!), shape.start, shape.end)}\n fill={shape.color}\n opacity={0.72}\n pointerEvents=\"none\"\n />\n ) : (\n <circle\n key={key}\n data-part=\"point\"\n data-leaving=\"\"\n data-series={shape.series}\n cx={value[0]}\n cy={value[1]}\n r={4}\n fill={shape.color}\n pointerEvents=\"none\"\n />\n );\n })}\n </svg>\n {current &&\n (renderTooltip?.({ series: current.series, label: current.label, value: current.value }) ?? (\n <div data-part=\"tooltip\">\n {current.series} {current.label} {current.value}\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAMI,IAAM;CAAE,KAAK;CAAI,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAG;AAEvD,SAASC,EAAS,GAAc,GAAuB;CACrD,IAAI,EAAEC,IAAO,IAAI,OAAO;CAExB,IAAMC,IAAQD,IAAO,KAAK,IAAI,GAAGE,CAAK,GAChCC,IAAQ,MAAM,KAAK,MAAM,KAAK,MAAMF,CAAK,CAAC,GAC1CG,IAAQH,IAAQE;CAGtB,QAFaC,KAAS,MAAM,KAAKA,KAAS,MAAM,IAAIA,KAAS,MAAM,IAAI,KAEzDD;AAChB;AAEA,SAASE,EAAM,GAAa,GAAa,GAAyB;CAChE,IAAMC,IAAOP,EAASQ,IAAMC,GAAKN,CAAK,GAChCO,IAAQ,KAAK,KAAKD,IAAMF,CAAI,IAAIA,GAChCI,IAAmB,CAAC;CAE1B,KAAK,IAAIC,IAAQF,GAAOE,KAASJ,IAAMD,IAAO,MAAM,KAASA,GAC3D,EAAO,KAAK,OAAOK,EAAM,YAAY,EAAE,CAAC,CAAC;CAE3C,OAAOD,EAAO,SAAS,IAAIA,IAAS,CAACF,GAAKD,CAAG;AAC/C;AAEA,SAAgBK,EACd,GACA,GACA,GACc;CACd,IAAMC,IAASC,EAAO,SAAS,MAC7BC,EAAK,KAAK,QACP,MAAU,OAAO,SAASC,EAAM,CAAC,KAAK,OAAO,SAASA,EAAM,CAAC,CAChE,CACF,GACMC,IAAKJ,E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