@carto/ps-react-ui 4.26.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions-DON6fSCh.js +1289 -0
- package/dist/actions-DON6fSCh.js.map +1 -0
- package/dist/category-BoT5FHHp.js +950 -0
- package/dist/category-BoT5FHHp.js.map +1 -0
- package/dist/scale-0elCv3tk.js +29 -0
- package/dist/scale-0elCv3tk.js.map +1 -0
- package/dist/types/widgets-v2/actions/index.d.ts +1 -1
- package/dist/types/widgets-v2/actions/relative-data/index.d.ts +1 -0
- package/dist/types/widgets-v2/actions/relative-data/labels.d.ts +3 -0
- package/dist/types/widgets-v2/actions/relative-data/relative-data.d.ts +16 -2
- package/dist/types/widgets-v2/actions/relative-data/scale.d.ts +26 -0
- package/dist/types/widgets-v2/actions/relative-data/style.d.ts +12 -0
- package/dist/types/widgets-v2/category/category.d.ts +2 -1
- package/dist/types/widgets-v2/index.d.ts +1 -1
- package/dist/widgets-v2/actions.js +1 -1
- package/dist/widgets-v2/bar.js +84 -83
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +1 -1
- package/dist/widgets-v2/histogram.js +108 -107
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +120 -119
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +90 -89
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2.js +2 -2
- package/dist/widgets-v2.js.map +1 -1
- package/package.json +3 -3
- package/src/widgets-v2/actions/index.ts +1 -0
- package/src/widgets-v2/actions/relative-data/index.ts +1 -0
- package/src/widgets-v2/actions/relative-data/labels.ts +6 -0
- package/src/widgets-v2/actions/relative-data/relative-data.test.tsx +78 -1
- package/src/widgets-v2/actions/relative-data/relative-data.tsx +137 -20
- package/src/widgets-v2/actions/relative-data/scale.ts +48 -0
- package/src/widgets-v2/actions/relative-data/style.ts +10 -0
- package/src/widgets-v2/bar/options.test.ts +16 -0
- package/src/widgets-v2/bar/options.ts +6 -2
- package/src/widgets-v2/category/category.relative-data.test.tsx +51 -63
- package/src/widgets-v2/category/category.tsx +25 -11
- package/src/widgets-v2/histogram/options.ts +6 -2
- package/src/widgets-v2/index.ts +1 -0
- package/src/widgets-v2/scatterplot/options.test.ts +12 -0
- package/src/widgets-v2/scatterplot/options.ts +18 -4
- package/src/widgets-v2/timeseries/options.ts +6 -2
- package/dist/actions-DXfQMrll.js +0 -1177
- package/dist/actions-DXfQMrll.js.map +0 -1
- package/dist/category-DuKx_CJX.js +0 -933
- package/dist/category-DuKx_CJX.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scatterplot.js","names":["ScatterplotItem","getScatterplotXY","point","isTuple","x","y","isScatterplotDatum","v","Array","isArray","length","isFiniteNumber","withScatterplotXY","Number","isFinite","EChartsOption","echarts","CallbackDataParams","buildAxisLabelStyle","buildGridConfig","buildLegendConfig","createTooltipFormatter","createTooltipPositioner","niceNum","ZOOM_LAYOUT","OptionFactory","mergeOptions","resolveThemeColor","createItemColorResolver","getScatterplotXY","ScatterplotEChartsOption","ScatterplotOptionFactoryInput","ScatterplotOptionsInput","ScatterplotItem","ScatterplotWidgetData","scatterplotOptions","theme","xFormatter","yFormatter","grid","left","parseInt","spacing","top","right","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","position","formatter","buildScatterTooltipFormatter","legend","hasLegend","labelFormatter","undefined","axisPointer","lineStyle","secondary","main","Object","values","qualitative","bold","Record","xAxis","type","axisLine","show","axisTick","axisLabel","margin","hideOverlap","showMinLabel","showMaxLabel","splitLine","black","divider","yAxis","createScatterplotOptionFactory","options","optionsOverride","series","symbolSize","selection","selectionSet","length","Set","option","data","ctx","structural","Partial","seriesArr","Array","isArray","dataset","baseLegend","baseGrid","baseTooltip","baseXAxis","baseYAxis","reactiveFormatter","niceMinX","niceMaxX","niceMinY","niceMaxY","computeScatterBounds","seriesTemplates","makeDimColor","seriesIdx","datums","baseColor","template","fallback","params","base","key","dataIndex","has","modifyAlpha","dataZoomLayout","layoutDataZoomForScatter","dataZoom","hasXSlider","hasYSlider","fallbackBottom","bottom","baseBottom","gridBottom","sliderHeight","sliderGap","fallbackRight","gridRight","map","s","source","every","i","overrideColor","const","datasetIndex","name","encode","x","y","emphasis","focus","itemStyle","entries","min","max","buildReactiveScatterTooltipFormatter","entry","dz","xAxisIndex","yAxisIndex","targetsY","sliderBottomWithLegend","structuralFormatter","reactiveYFormatter","value","item","formattedX","String","formattedY","marker","seriesName","minX","Infinity","maxX","minY","maxY","point","Number","isFinite","Box","Skeleton","SxProps","Theme","styles","container","display","alignItems","justifyContent","flexDirection","gap","spacing","height","grid","position","flex","width","legend","legendItem","Record","dotSx","top","left","size","borderRadius","ScatterplotSkeletonProps","count","ScatterplotSkeleton","t0","$","_c","t1","undefined","T0","T1","t2","t3","t4","dots","Array","from","length","_temp","map","_temp2","t5","t6","Symbol","for","_temp3","t7","i_1","i","d","i_0","_","buildCsvDownloadItem","buildPngDownloadItem","DownloadContext","DownloadItem","getScatterplotXY","ScatterplotItem","ScatterplotWidgetData","createScatterplotDownloadConfig","args","filename","getData","ctx","seriesNames","getCaptureEl","HTMLElement","pngPixelRatio","pngBackgroundColor","items","push","pixelRatio","backgroundColor","getRows","data","rows","i","series","entries","seriesName","point","x","y","getScatterplotXY","isScatterplotDatum","withScatterplotXY","ScatterplotItem","toRelativeScatterplotData","input","Array","isArray","map","series","isPointArray","total","reduce","acc","p","Math","abs","x","y","v","every","filterScatterplotByLockedPoints","lockedItems","length","locked","Set","String","seriesIndex","filter","_","dataIndex","has"],"sources":["../../src/widgets-v2/scatterplot/points.ts","../../src/widgets-v2/scatterplot/options.ts","../../src/widgets-v2/scatterplot/skeleton.tsx","../../src/widgets-v2/scatterplot/download.ts","../../src/widgets-v2/scatterplot/transforms.ts"],"sourcesContent":["import type { ScatterplotItem } from './types'\n\n/** `[x, y]` of a {@link ScatterplotItem}, whichever form it takes. */\nexport function getScatterplotXY(\n point: ScatterplotItem,\n): readonly [number, number] {\n return isTuple(point) ? point : [point.x, point.y]\n}\n\n/** Whether `v` is a valid {@link ScatterplotItem} with finite coordinates. */\nexport function isScatterplotDatum(v: unknown): v is ScatterplotItem {\n if (Array.isArray(v)) {\n return v.length === 2 && isFiniteNumber(v[0]) && isFiniteNumber(v[1])\n }\n if (v == null || typeof v !== 'object') return false\n const { x, y } = v as { x?: unknown; y?: unknown }\n return isFiniteNumber(x) && isFiniteNumber(y)\n}\n\n/** Same point with new coordinates; keeps the object form (and `color`). */\nexport function withScatterplotXY(\n point: ScatterplotItem,\n x: number,\n y: number,\n): ScatterplotItem {\n return isTuple(point) ? [x, y] : { ...point, x, y }\n}\n\nfunction isTuple(point: ScatterplotItem): point is readonly [number, number] {\n return Array.isArray(point)\n}\n\nfunction isFiniteNumber(v: unknown): v is number {\n return typeof v === 'number' && Number.isFinite(v)\n}\n","import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildAxisLabelStyle,\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { createItemColorResolver } from '../utils/item-color'\nimport { getScatterplotXY } from './points'\nimport type {\n ScatterplotEChartsOption,\n ScatterplotOptionFactoryInput,\n ScatterplotOptionsInput,\n ScatterplotItem,\n ScatterplotWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a scatterplot widget — both\n * axes `type: 'value'` (not category, unlike Bar/Histogram), grid, tooltip\n * triggered per-item rather than per-axis. Intentionally data-agnostic: no\n * series, no dataset, no `legend.show` (those depend on data and are added\n * by {@link createScatterplotOptionFactory}).\n *\n * Styling parity with v1: dark themed tooltip via `createTooltipFormatter`\n * + `createTooltipPositioner`, `buildGridConfig`-based grid, polished\n * axisLine/Tick/splitLine, `overlineDelicate` axis labels, structural\n * legend wired via `buildLegendConfig` (toggled by the merger), and the\n * CARTO `qualitative.bold + secondary` palette — same pattern bar /\n * histogram / pie already use. {@link createScatterplotOptionFactory}\n * wraps this builder in its structural-phase branch.\n */\nexport function scatterplotOptions({\n theme,\n xFormatter,\n yFormatter,\n}: ScatterplotOptionsInput): ScatterplotEChartsOption {\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps `bottom` when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n // Per-point trigger — different from Bar's 'axis' trigger because\n // points don't share an x-coordinate.\n trigger: 'item',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n position: createTooltipPositioner(theme),\n formatter: buildScatterTooltipFormatter(xFormatter, yFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter: undefined }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(xFormatter && { formatter: xFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n yAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(yFormatter && { formatter: yFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n } as ScatterplotEChartsOption\n}\n\n/**\n * Returns the scatterplot widget's {@link OptionFactory} — one closure\n * that owns BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link scatterplotOptions}, optionally merging\n * the consumer-supplied `optionsOverride`. Called once by Provider to\n * seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`ScatterplotWidgetData`) into the option via the dataset API. Each\n * series's `[x, y]` tuples land in `dataset[i].source` as 2-column\n * rows; the series uses positional encoding (`encode: { x: 0, y: 1 }`)\n * and `type: 'scatter'`. niceMin/niceMax are computed over both axes\n * so the chart frames data on rounded extents and numeric jitters\n * don't shift gridlines per render. Reactive `ctx.formatter` (driven\n * by RelativeData) re-derives the y-axis label and tooltip at fusion\n * time; `xFormatter` stays baked at structural-build time (relative\n * is a values-axis concept; x is coordinate-space).\n *\n * When `ZoomToggle` installs a `dataZoom` slider, grid bottom is\n * extended and the slider is positioned above the legend row (if any) —\n * same layout dance bar / histogram / timeseries do.\n */\nexport function createScatterplotOptionFactory(\n options: ScatterplotOptionFactoryInput,\n): OptionFactory {\n const { theme, xFormatter, yFormatter, optionsOverride } = options\n const series = options.series\n const symbolSize = options.symbolSize ?? 8\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0 ? new Set<string>(selection) : null\n return (option, data, ctx) => {\n if (option == null) {\n const structural = scatterplotOptions({ theme, xFormatter, yFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data)\n ? (data as ScatterplotWidgetData<ScatterplotItem>)\n : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseXAxis =\n typeof option.xAxis === 'object' && !Array.isArray(option.xAxis)\n ? option.xAxis\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const reactiveFormatter = ctx?.formatter\n\n const { niceMinX, niceMaxX, niceMinY, niceMaxY } =\n computeScatterBounds(seriesArr)\n\n // Dim non-selected points via `series.itemStyle.color`. The selection\n // key is `${seriesIndex}:${dataIndex}`; we read those off the params\n // ECharts hands to the callback per-data.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and items would stay dimmed forever after an external clear.\n // Keeping the key always-present means a plain setOption merge swaps\n // the callback in place, no `replaceMerge` and no entry-animation\n // flash on selection on/off.\n //\n // The base colour is the point's own `color` (object points), else the\n // template's `itemStyle.color`, else the series colour / palette.\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const makeDimColor = (seriesIdx: number, datums: readonly unknown[]) => {\n const baseColor = createItemColorResolver({\n theme,\n datums,\n template: seriesTemplates[seriesIdx] ?? seriesTemplates[0],\n fallback: (params) => params.color as string,\n })\n return (params: CallbackDataParams) => {\n const base = baseColor(params)\n if (!selectionSet) return base\n const key = `${seriesIdx}:${params.dataIndex}`\n return selectionSet.has(key)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n }\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`,\n // reserve grid space and lift any x-slider above the legend (if\n // present). Scatter supports 2D zoom via `axes: ['x', 'y']` — in\n // that case there's also a vertical y-slider on the right edge, so\n // we reserve `grid.right` separately. Inside-only dataZoom entries\n // (no `type: 'slider'`) take no grid space.\n const dataZoomLayout = layoutDataZoomForScatter(option.dataZoom, hasLegend)\n const hasXSlider = dataZoomLayout?.hasXSlider ?? false\n const hasYSlider = dataZoomLayout?.hasYSlider ?? false\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = hasXSlider\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n const fallbackRight =\n typeof baseGrid.right === 'number' ? baseGrid.right : 8\n const gridRight = hasYSlider\n ? fallbackRight + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : fallbackRight\n\n return {\n ...option,\n // ECharts dataset.source wants a mutable [number, number][] shape; we\n // hold readonly tuples internally, so cast at the boundary. Object\n // points are flattened to `[x, y]` so the positional encode and the\n // tooltip keep reading tuples.\n dataset: seriesArr.map((s) => ({\n source: (s.every(Array.isArray)\n ? s\n : s.map(getScatterplotXY)) as unknown as number[][],\n })),\n series: seriesArr.map((s, i) => {\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n type: 'scatter' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 0, y: 1 },\n symbolSize,\n emphasis: { focus: 'series' },\n itemStyle: { color: makeDimColor(i, s) },\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: { ...baseGrid, bottom: gridBottom, right: gridRight },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout.entries } : {}),\n xAxis: {\n ...baseXAxis,\n min: niceMinX,\n max: niceMaxX,\n } as EChartsOption['xAxis'],\n yAxis: {\n ...baseYAxis,\n min: niceMinY,\n max: niceMaxY,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n // Re-derive the y-axis formatter at fusion time so RelativeData's\n // percent formatter (written to `state.formatter`) flows through\n // without rebuilding the structural option. Falls back to the\n // structural `yFormatter` already baked in `baseYAxis.axisLabel`\n // (which `String(value)` if neither is set).\n ...(reactiveFormatter ? { formatter: reactiveFormatter } : {}),\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n // Rebuild the tooltip formatter so the live y-axis formatter is\n // applied to the y-coordinate in the (x, y) label. xFormatter is\n // structural — relative is a values-axis concept, so xFormatter\n // doesn't change under RelativeData.\n formatter: buildReactiveScatterTooltipFormatter(\n (baseTooltip as { formatter?: unknown }).formatter,\n reactiveFormatter,\n xFormatter,\n ),\n },\n } as EChartsOption\n }\n}\n\n/**\n * Lay out the `dataZoom` array for the scatter chart:\n * - Detect whether any horizontal (x-axis) slider is present — if so\n * lift it above the legend row when a legend is shown.\n * - Detect whether any vertical (y-axis) slider is present — the\n * caller reserves `grid.right` so the slider doesn't overlap the\n * plot area.\n *\n * Returns `null` when there's no `dataZoom` so callers can skip the\n * layout adjustment entirely. An entry is considered an \"x-slider\" if\n * it has `xAxisIndex` set (or no axis index — defaults to x in ECharts).\n * A \"y-slider\" has `yAxisIndex` set.\n */\nfunction layoutDataZoomForScatter(\n dataZoom: unknown,\n hasLegend: boolean,\n): { entries: unknown[]; hasXSlider: boolean; hasYSlider: boolean } | null {\n if (!Array.isArray(dataZoom) || dataZoom.length === 0) return null\n let hasXSlider = false\n let hasYSlider = false\n const entries = dataZoom.map((entry: unknown) => {\n if (entry == null || typeof entry !== 'object') return entry\n const dz = entry as {\n type?: string\n xAxisIndex?: unknown\n yAxisIndex?: unknown\n bottom?: number\n }\n if (dz.type !== 'slider') return dz\n const targetsY = dz.yAxisIndex !== undefined\n if (targetsY) {\n hasYSlider = true\n return dz\n }\n // Either explicit x or defaulted (ECharts defaults sliders to xAxis\n // when no axis index is provided).\n hasXSlider = true\n if (hasLegend) {\n return { ...dz, bottom: ZOOM_LAYOUT.sliderBottomWithLegend }\n }\n return dz\n })\n return { entries, hasXSlider, hasYSlider }\n}\n\n/**\n * If a reactive (store-driven) y formatter is provided, re-build the\n * scatter tooltip formatter using it. Otherwise, return the structural\n * formatter unchanged so the original `xFormatter` / `yFormatter`\n * baked into `scatterplotOptions` still applies. The structural\n * formatter has stable identity per `scatterplotOptions` call, so this\n * path doesn't churn ECharts on every render.\n */\nfunction buildReactiveScatterTooltipFormatter(\n structuralFormatter: unknown,\n reactiveYFormatter: ((value: number) => string) | undefined,\n xFormatter: ((value: number) => string) | undefined,\n) {\n if (!reactiveYFormatter) return structuralFormatter\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? reactiveYFormatter(y) : String(y ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction buildScatterTooltipFormatter(\n xFormatter: ((value: number) => string) | undefined,\n yFormatter: ((value: number) => string) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? (yFormatter ? yFormatter(y) : String(y)) : ''\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction computeScatterBounds(\n seriesArr: ScatterplotWidgetData<ScatterplotItem>,\n): {\n niceMinX: number\n niceMaxX: number\n niceMinY: number\n niceMaxY: number\n} {\n let minX = Infinity\n let maxX = -Infinity\n let minY = Infinity\n let maxY = -Infinity\n for (const series of seriesArr) {\n for (const point of series) {\n if (point == null) continue\n const [x, y] = getScatterplotXY(point)\n if (typeof x === 'number' && Number.isFinite(x)) {\n if (x < minX) minX = x\n if (x > maxX) maxX = x\n }\n if (typeof y === 'number' && Number.isFinite(y)) {\n if (y < minY) minY = y\n if (y > maxY) maxY = y\n }\n }\n }\n // Mirror bar's `computeNiceBounds`: clamp min to 0 when data is\n // non-negative (gridline reads cleanly from zero), apply `niceNum` to\n // negative mins, and floor max=0 to 1 so the chart always has range.\n // Scatter can have free coordinates so we apply this per-axis.\n const niceMaxX = Number.isFinite(maxX) ? (maxX <= 0 ? 1 : niceNum(maxX)) : 1\n const niceMaxY = Number.isFinite(maxY) ? (maxY <= 0 ? 1 : niceNum(maxY)) : 1\n const niceMinX = Number.isFinite(minX) ? (minX < 0 ? niceNum(minX) : 0) : 0\n const niceMinY = Number.isFinite(minY) ? (minY < 0 ? niceNum(minY) : 0) : 0\n return { niceMinX, niceMaxX, niceMinY, niceMaxY }\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n position: 'relative',\n flex: '1 1 auto',\n width: '100%',\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\n// `sx` callback that needs runtime args — extracted at module scope so the\n// `styles` object can satisfy `Record<string, SxProps<Theme>>` cleanly\n// (function `sx`-with-args isn't assignable to plain `SxProps<Theme>`).\nconst dotSx = (top: string, left: string, size: number): SxProps<Theme> => ({\n position: 'absolute',\n top,\n left,\n width: size,\n height: size,\n borderRadius: '50%',\n})\n\nexport interface ScatterplotSkeletonProps {\n /** Number of dots to render. */\n count?: number\n}\n\n/**\n * Loading state for the Scatterplot widget. Mirrors a scatter chart's\n * silhouette — a deterministic spread of small circular dots in the plot\n * area plus a legend stub — so the skeleton reads as \"a scatter chart\"\n * rather than a generic list. Matches bar/histogram/pie skeleton structure\n * (grid stub + legend stub in a flex column).\n */\nexport function ScatterplotSkeleton({ count = 24 }: ScatterplotSkeletonProps) {\n // Deterministic pseudo-scatter positions so the skeleton doesn't flicker.\n const dots = Array.from({ length: count }, (_, i) => {\n const top = 10 + ((i * 37) % 80)\n const left = 5 + ((i * 53) % 90)\n const size = 8 + ((i * 7) % 6)\n return { top: `${top}%`, left: `${left}%`, size }\n })\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadContext,\n type DownloadItem,\n} from '../actions/download'\nimport { getScatterplotXY } from './points'\nimport type { ScatterplotItem, ScatterplotWidgetData } from './types'\n\n/**\n * Download menu items for the Scatterplot widget. Always includes a CSV\n * item with `series, x, y` columns (one row per point). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createScatterplotDownloadConfig(args: {\n filename: string\n getData: (ctx: DownloadContext) => ScatterplotWidgetData<ScatterplotItem>\n seriesNames?: readonly string[]\n getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: (ctx) => {\n const data = args.getData(ctx)\n const rows: unknown[][] = [['series', 'x', 'y']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const point of series) {\n const [x, y] = getScatterplotXY(point)\n rows.push([seriesName, x, y])\n }\n }\n return rows\n },\n }),\n )\n return items\n}\n","import {\n getScatterplotXY,\n isScatterplotDatum,\n withScatterplotXY,\n} from './points'\nimport type { ScatterplotItem } from './types'\n\n/**\n * Scatterplot-specific `RelativeData` transform. Scatter data is\n * `ScatterplotItem[][]` — each series is a list of `[x, y]` tuples or\n * `{ x, y, color? }` points (whose shape is kept).\n * Relative is a values-axis concept, so this rewrites `y` to its\n * share of the series's total `y` (0–100) and leaves `x` raw — x is\n * coordinate space, not part of the cohort total.\n *\n * Pass to `<Widget.RelativeData transform={toRelativeScatterplotData} />`.\n *\n * The denominator is the sum of |y| across the series so mixed-sign\n * y values produce sane signed shares-of-magnitude. A series whose\n * total y-magnitude is zero (all-zero or empty input) is returned\n * unchanged so a stalled or empty data set doesn't show misleading 0%\n * values. Inputs whose shape isn't `ScatterplotItem[]` fall through\n * untouched.\n */\nexport const toRelativeScatterplotData = (input: unknown): unknown => {\n if (!Array.isArray(input)) return input\n return input.map((series: unknown): unknown => {\n if (!isPointArray(series)) return series\n const total = series.reduce(\n (acc, p) => acc + Math.abs(getScatterplotXY(p)[1]),\n 0,\n )\n if (total <= 0) return series\n return series.map((p) => {\n const [x, y] = getScatterplotXY(p)\n return withScatterplotXY(p, x, (y / total) * 100)\n })\n })\n}\n\nfunction isPointArray(v: unknown): v is ScatterplotItem[] {\n return Array.isArray(v) && v.every(isScatterplotDatum)\n}\n\n/**\n * `LockSelection` filter for Scatterplot. Data is `ScatterplotItem[][]` —\n * points have no `name`, so selection (and locking) is keyed on a synthetic\n * `${seriesIndex}:${dataIndex}` string (same format `useChartSelection`'s\n * `keyFromClick`/`keysFromBrush` produce for this widget). Unlike Histogram,\n * a point's position carries no external meaning (no `ticks` to desync from),\n * so non-locked points are removed outright rather than zeroed.\n */\nexport function filterScatterplotByLockedPoints(\n input: unknown,\n lockedItems: readonly (string | number)[],\n): unknown {\n if (lockedItems.length === 0) return input\n if (!Array.isArray(input)) return input\n const locked = new Set<string>(lockedItems.map(String))\n return input.map((series: unknown, seriesIndex: number): unknown => {\n if (!isPointArray(series)) return series\n return series.filter((_, dataIndex) =>\n locked.has(`${seriesIndex}:${dataIndex}`),\n )\n })\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAgBC,EACdC,GAC2B;CAC3B,OAAOC,EAAQD,CAAK,IAAIA,IAAQ,CAACA,EAAME,GAAGF,EAAMG,CAAC;AACnD;AAGA,SAAgBC,EAAmBC,GAAkC;CACnE,IAAIC,MAAMC,QAAQF,CAAC,GACjB,OAAOA,EAAEG,WAAW,KAAKC,EAAeJ,EAAE,EAAE,KAAKI,EAAeJ,EAAE,EAAE;CAEtE,IAAiB,OAAOA,KAAM,aAA1BA,GAAoC,OAAO;CAC/C,IAAM,EAAEH,MAAGC,SAAME;CACjB,OAAOI,EAAeP,CAAC,KAAKO,EAAeN,CAAC;AAC9C;AAGA,SAAgBO,EACdV,GACAE,GACAC,GACiB;CACjB,OAAOF,EAAQD,CAAK,IAAI,CAACE,GAAGC,CAAC,IAAI;EAAE,GAAGH;EAAOE;EAAGC;CAAE;AACpD;AAEA,SAASF,EAAQD,GAA4D;CAC3E,OAAOM,MAAMC,QAAQP,CAAK;AAC5B;AAEA,SAASS,EAAeJ,GAAyB;CAC/C,OAAO,OAAOA,KAAM,YAAYM,OAAOC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B,EACdhB,GACAiB,GACS;CAET,IADIA,EAAYC,WAAW,KACvB,CAACjB,MAAMC,QAAQF,CAAK,GAAG,OAAOA;CAClC,IAAMmB,IAAS,IAAIC,IAAYH,EAAYd,IAAIkB,MAAM,CAAC;CACtD,OAAOrB,EAAMG,KAAKC,GAAiBkB,MAC5BjB,EAAaD,CAAM,IACjBA,EAAOmB,QAAQC,GAAGC,MACvBN,EAAOO,IAAI,GAAGJ,EAAW,GAAIG,GAAW,CAC1C,IAHkCrB,CAInC;AACH"}
|
|
1
|
+
{"version":3,"file":"scatterplot.js","names":["ScatterplotItem","getScatterplotXY","point","isTuple","x","y","isScatterplotDatum","v","Array","isArray","length","isFiniteNumber","withScatterplotXY","Number","isFinite","EChartsOption","echarts","CallbackDataParams","buildAxisLabelStyle","buildGridConfig","buildLegendConfig","createTooltipFormatter","createTooltipPositioner","niceNum","ZOOM_LAYOUT","OptionFactory","mergeOptions","resolveThemeColor","createItemColorResolver","getScatterplotXY","ScatterplotEChartsOption","ScatterplotOptionFactoryInput","ScatterplotOptionsInput","ScatterplotItem","ScatterplotWidgetData","fixedAxisBounds","scatterplotOptions","theme","xFormatter","yFormatter","grid","left","parseInt","spacing","top","right","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","position","formatter","buildScatterTooltipFormatter","legend","hasLegend","labelFormatter","undefined","axisPointer","lineStyle","secondary","main","Object","values","qualitative","bold","Record","xAxis","type","axisLine","show","axisTick","axisLabel","margin","hideOverlap","showMinLabel","showMaxLabel","splitLine","black","divider","yAxis","createScatterplotOptionFactory","options","optionsOverride","series","symbolSize","selection","selectionSet","length","Set","option","data","ctx","structural","Partial","seriesArr","Array","isArray","dataset","baseLegend","baseGrid","baseTooltip","baseXAxis","baseYAxis","reactiveFormatter","niceMinX","niceMaxX","niceMinY","niceMaxY","computeScatterBounds","seriesTemplates","makeDimColor","seriesIdx","datums","baseColor","template","fallback","params","base","key","dataIndex","has","modifyAlpha","dataZoomLayout","layoutDataZoomForScatter","dataZoom","hasXSlider","hasYSlider","fallbackBottom","bottom","baseBottom","gridBottom","sliderHeight","sliderGap","fallbackRight","gridRight","map","s","source","every","i","overrideColor","const","datasetIndex","name","encode","x","y","emphasis","focus","itemStyle","entries","min","max","buildReactiveScatterTooltipFormatter","entry","dz","xAxisIndex","yAxisIndex","targetsY","sliderBottomWithLegend","structuralFormatter","reactiveYFormatter","value","item","formattedX","String","formattedY","marker","seriesName","fixedY","minX","Infinity","maxX","minY","maxY","point","Number","isFinite","Box","Skeleton","SxProps","Theme","styles","container","display","alignItems","justifyContent","flexDirection","gap","spacing","height","grid","position","flex","width","legend","legendItem","Record","dotSx","top","left","size","borderRadius","ScatterplotSkeletonProps","count","ScatterplotSkeleton","t0","$","_c","t1","undefined","T0","T1","t2","t3","t4","dots","Array","from","length","_temp","map","_temp2","t5","t6","Symbol","for","_temp3","t7","i_1","i","d","i_0","_","buildCsvDownloadItem","buildPngDownloadItem","DownloadContext","DownloadItem","getScatterplotXY","ScatterplotItem","ScatterplotWidgetData","createScatterplotDownloadConfig","args","filename","getData","ctx","seriesNames","getCaptureEl","HTMLElement","pngPixelRatio","pngBackgroundColor","items","push","pixelRatio","backgroundColor","getRows","data","rows","i","series","entries","seriesName","point","x","y","getScatterplotXY","isScatterplotDatum","withScatterplotXY","ScatterplotItem","toRelativeScatterplotData","input","Array","isArray","map","series","isPointArray","total","reduce","acc","p","Math","abs","x","y","v","every","filterScatterplotByLockedPoints","lockedItems","length","locked","Set","String","seriesIndex","filter","_","dataIndex","has"],"sources":["../../src/widgets-v2/scatterplot/points.ts","../../src/widgets-v2/scatterplot/options.ts","../../src/widgets-v2/scatterplot/skeleton.tsx","../../src/widgets-v2/scatterplot/download.ts","../../src/widgets-v2/scatterplot/transforms.ts"],"sourcesContent":["import type { ScatterplotItem } from './types'\n\n/** `[x, y]` of a {@link ScatterplotItem}, whichever form it takes. */\nexport function getScatterplotXY(\n point: ScatterplotItem,\n): readonly [number, number] {\n return isTuple(point) ? point : [point.x, point.y]\n}\n\n/** Whether `v` is a valid {@link ScatterplotItem} with finite coordinates. */\nexport function isScatterplotDatum(v: unknown): v is ScatterplotItem {\n if (Array.isArray(v)) {\n return v.length === 2 && isFiniteNumber(v[0]) && isFiniteNumber(v[1])\n }\n if (v == null || typeof v !== 'object') return false\n const { x, y } = v as { x?: unknown; y?: unknown }\n return isFiniteNumber(x) && isFiniteNumber(y)\n}\n\n/** Same point with new coordinates; keeps the object form (and `color`). */\nexport function withScatterplotXY(\n point: ScatterplotItem,\n x: number,\n y: number,\n): ScatterplotItem {\n return isTuple(point) ? [x, y] : { ...point, x, y }\n}\n\nfunction isTuple(point: ScatterplotItem): point is readonly [number, number] {\n return Array.isArray(point)\n}\n\nfunction isFiniteNumber(v: unknown): v is number {\n return typeof v === 'number' && Number.isFinite(v)\n}\n","import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildAxisLabelStyle,\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { createItemColorResolver } from '../utils/item-color'\nimport { getScatterplotXY } from './points'\nimport type {\n ScatterplotEChartsOption,\n ScatterplotOptionFactoryInput,\n ScatterplotOptionsInput,\n ScatterplotItem,\n ScatterplotWidgetData,\n} from './types'\nimport { fixedAxisBounds } from '../actions/relative-data/scale'\n\n/**\n * Builds the **structural** ECharts option for a scatterplot widget — both\n * axes `type: 'value'` (not category, unlike Bar/Histogram), grid, tooltip\n * triggered per-item rather than per-axis. Intentionally data-agnostic: no\n * series, no dataset, no `legend.show` (those depend on data and are added\n * by {@link createScatterplotOptionFactory}).\n *\n * Styling parity with v1: dark themed tooltip via `createTooltipFormatter`\n * + `createTooltipPositioner`, `buildGridConfig`-based grid, polished\n * axisLine/Tick/splitLine, `overlineDelicate` axis labels, structural\n * legend wired via `buildLegendConfig` (toggled by the merger), and the\n * CARTO `qualitative.bold + secondary` palette — same pattern bar /\n * histogram / pie already use. {@link createScatterplotOptionFactory}\n * wraps this builder in its structural-phase branch.\n */\nexport function scatterplotOptions({\n theme,\n xFormatter,\n yFormatter,\n}: ScatterplotOptionsInput): ScatterplotEChartsOption {\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps `bottom` when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n // Per-point trigger — different from Bar's 'axis' trigger because\n // points don't share an x-coordinate.\n trigger: 'item',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n position: createTooltipPositioner(theme),\n formatter: buildScatterTooltipFormatter(xFormatter, yFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter: undefined }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(xFormatter && { formatter: xFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n yAxis: {\n type: 'value',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n ...buildAxisLabelStyle(theme),\n margin: parseInt(theme.spacing(1)),\n hideOverlap: true,\n showMinLabel: true,\n showMaxLabel: true,\n ...(yFormatter && { formatter: yFormatter }),\n },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n },\n } as ScatterplotEChartsOption\n}\n\n/**\n * Returns the scatterplot widget's {@link OptionFactory} — one closure\n * that owns BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link scatterplotOptions}, optionally merging\n * the consumer-supplied `optionsOverride`. Called once by Provider to\n * seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`ScatterplotWidgetData`) into the option via the dataset API. Each\n * series's `[x, y]` tuples land in `dataset[i].source` as 2-column\n * rows; the series uses positional encoding (`encode: { x: 0, y: 1 }`)\n * and `type: 'scatter'`. niceMin/niceMax are computed over both axes\n * so the chart frames data on rounded extents and numeric jitters\n * don't shift gridlines per render. Reactive `ctx.formatter` (driven\n * by RelativeData) re-derives the y-axis label and tooltip at fusion\n * time; `xFormatter` stays baked at structural-build time (relative\n * is a values-axis concept; x is coordinate-space).\n *\n * When `ZoomToggle` installs a `dataZoom` slider, grid bottom is\n * extended and the slider is positioned above the legend row (if any) —\n * same layout dance bar / histogram / timeseries do.\n */\nexport function createScatterplotOptionFactory(\n options: ScatterplotOptionFactoryInput,\n): OptionFactory {\n const { theme, xFormatter, yFormatter, optionsOverride } = options\n const series = options.series\n const symbolSize = options.symbolSize ?? 8\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0 ? new Set<string>(selection) : null\n return (option, data, ctx) => {\n if (option == null) {\n const structural = scatterplotOptions({ theme, xFormatter, yFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data)\n ? (data as ScatterplotWidgetData<ScatterplotItem>)\n : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseXAxis =\n typeof option.xAxis === 'object' && !Array.isArray(option.xAxis)\n ? option.xAxis\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const reactiveFormatter = ctx?.formatter\n\n const { niceMinX, niceMaxX, niceMinY, niceMaxY } = computeScatterBounds(\n seriesArr,\n // A config transform (RelativeData's `'total'` scale) may pin the\n // y ends; each applies only on the side the data reaches.\n fixedAxisBounds(baseYAxis),\n )\n\n // Dim non-selected points via `series.itemStyle.color`. The selection\n // key is `${seriesIndex}:${dataIndex}`; we read those off the params\n // ECharts hands to the callback per-data.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and items would stay dimmed forever after an external clear.\n // Keeping the key always-present means a plain setOption merge swaps\n // the callback in place, no `replaceMerge` and no entry-animation\n // flash on selection on/off.\n //\n // The base colour is the point's own `color` (object points), else the\n // template's `itemStyle.color`, else the series colour / palette.\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const makeDimColor = (seriesIdx: number, datums: readonly unknown[]) => {\n const baseColor = createItemColorResolver({\n theme,\n datums,\n template: seriesTemplates[seriesIdx] ?? seriesTemplates[0],\n fallback: (params) => params.color as string,\n })\n return (params: CallbackDataParams) => {\n const base = baseColor(params)\n if (!selectionSet) return base\n const key = `${seriesIdx}:${params.dataIndex}`\n return selectionSet.has(key)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n }\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`,\n // reserve grid space and lift any x-slider above the legend (if\n // present). Scatter supports 2D zoom via `axes: ['x', 'y']` — in\n // that case there's also a vertical y-slider on the right edge, so\n // we reserve `grid.right` separately. Inside-only dataZoom entries\n // (no `type: 'slider'`) take no grid space.\n const dataZoomLayout = layoutDataZoomForScatter(option.dataZoom, hasLegend)\n const hasXSlider = dataZoomLayout?.hasXSlider ?? false\n const hasYSlider = dataZoomLayout?.hasYSlider ?? false\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = hasXSlider\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n const fallbackRight =\n typeof baseGrid.right === 'number' ? baseGrid.right : 8\n const gridRight = hasYSlider\n ? fallbackRight + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : fallbackRight\n\n return {\n ...option,\n // ECharts dataset.source wants a mutable [number, number][] shape; we\n // hold readonly tuples internally, so cast at the boundary. Object\n // points are flattened to `[x, y]` so the positional encode and the\n // tooltip keep reading tuples.\n dataset: seriesArr.map((s) => ({\n source: (s.every(Array.isArray)\n ? s\n : s.map(getScatterplotXY)) as unknown as number[][],\n })),\n series: seriesArr.map((s, i) => {\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n type: 'scatter' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 0, y: 1 },\n symbolSize,\n emphasis: { focus: 'series' },\n itemStyle: { color: makeDimColor(i, s) },\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: { ...baseGrid, bottom: gridBottom, right: gridRight },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout.entries } : {}),\n xAxis: {\n ...baseXAxis,\n min: niceMinX,\n max: niceMaxX,\n } as EChartsOption['xAxis'],\n yAxis: {\n ...baseYAxis,\n min: niceMinY,\n max: niceMaxY,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n // Re-derive the y-axis formatter at fusion time so RelativeData's\n // percent formatter (written to `state.formatter`) flows through\n // without rebuilding the structural option. Falls back to the\n // structural `yFormatter` already baked in `baseYAxis.axisLabel`\n // (which `String(value)` if neither is set).\n ...(reactiveFormatter ? { formatter: reactiveFormatter } : {}),\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n // Rebuild the tooltip formatter so the live y-axis formatter is\n // applied to the y-coordinate in the (x, y) label. xFormatter is\n // structural — relative is a values-axis concept, so xFormatter\n // doesn't change under RelativeData.\n formatter: buildReactiveScatterTooltipFormatter(\n (baseTooltip as { formatter?: unknown }).formatter,\n reactiveFormatter,\n xFormatter,\n ),\n },\n } as EChartsOption\n }\n}\n\n/**\n * Lay out the `dataZoom` array for the scatter chart:\n * - Detect whether any horizontal (x-axis) slider is present — if so\n * lift it above the legend row when a legend is shown.\n * - Detect whether any vertical (y-axis) slider is present — the\n * caller reserves `grid.right` so the slider doesn't overlap the\n * plot area.\n *\n * Returns `null` when there's no `dataZoom` so callers can skip the\n * layout adjustment entirely. An entry is considered an \"x-slider\" if\n * it has `xAxisIndex` set (or no axis index — defaults to x in ECharts).\n * A \"y-slider\" has `yAxisIndex` set.\n */\nfunction layoutDataZoomForScatter(\n dataZoom: unknown,\n hasLegend: boolean,\n): { entries: unknown[]; hasXSlider: boolean; hasYSlider: boolean } | null {\n if (!Array.isArray(dataZoom) || dataZoom.length === 0) return null\n let hasXSlider = false\n let hasYSlider = false\n const entries = dataZoom.map((entry: unknown) => {\n if (entry == null || typeof entry !== 'object') return entry\n const dz = entry as {\n type?: string\n xAxisIndex?: unknown\n yAxisIndex?: unknown\n bottom?: number\n }\n if (dz.type !== 'slider') return dz\n const targetsY = dz.yAxisIndex !== undefined\n if (targetsY) {\n hasYSlider = true\n return dz\n }\n // Either explicit x or defaulted (ECharts defaults sliders to xAxis\n // when no axis index is provided).\n hasXSlider = true\n if (hasLegend) {\n return { ...dz, bottom: ZOOM_LAYOUT.sliderBottomWithLegend }\n }\n return dz\n })\n return { entries, hasXSlider, hasYSlider }\n}\n\n/**\n * If a reactive (store-driven) y formatter is provided, re-build the\n * scatter tooltip formatter using it. Otherwise, return the structural\n * formatter unchanged so the original `xFormatter` / `yFormatter`\n * baked into `scatterplotOptions` still applies. The structural\n * formatter has stable identity per `scatterplotOptions` call, so this\n * path doesn't churn ECharts on every render.\n */\nfunction buildReactiveScatterTooltipFormatter(\n structuralFormatter: unknown,\n reactiveYFormatter: ((value: number) => string) | undefined,\n xFormatter: ((value: number) => string) | undefined,\n) {\n if (!reactiveYFormatter) return structuralFormatter\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? reactiveYFormatter(y) : String(y ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction buildScatterTooltipFormatter(\n xFormatter: ((value: number) => string) | undefined,\n yFormatter: ((value: number) => string) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const value = item.value as readonly [number, number] | undefined\n const x = value?.[0]\n const y = value?.[1]\n const formattedX =\n typeof x === 'number' ? (xFormatter ? xFormatter(x) : String(x)) : ''\n const formattedY =\n typeof y === 'number' ? (yFormatter ? yFormatter(y) : String(y)) : ''\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n return {\n name: `(${formattedX}, ${formattedY})`,\n seriesName,\n marker,\n value: '',\n }\n })\n}\n\nfunction computeScatterBounds(\n seriesArr: ScatterplotWidgetData<ScatterplotItem>,\n fixedY: { min?: number; max?: number } = {},\n): {\n niceMinX: number\n niceMaxX: number\n niceMinY: number\n niceMaxY: number\n} {\n let minX = Infinity\n let maxX = -Infinity\n let minY = Infinity\n let maxY = -Infinity\n for (const series of seriesArr) {\n for (const point of series) {\n if (point == null) continue\n const [x, y] = getScatterplotXY(point)\n if (typeof x === 'number' && Number.isFinite(x)) {\n if (x < minX) minX = x\n if (x > maxX) maxX = x\n }\n if (typeof y === 'number' && Number.isFinite(y)) {\n if (y < minY) minY = y\n if (y > maxY) maxY = y\n }\n }\n }\n // Mirror bar's `computeNiceBounds`: clamp min to 0 when data is\n // non-negative (gridline reads cleanly from zero), apply `niceNum` to\n // negative mins, and floor max=0 to 1 so the chart always has range.\n // Scatter can have free coordinates so we apply this per-axis.\n const niceMaxX = Number.isFinite(maxX) ? (maxX <= 0 ? 1 : niceNum(maxX)) : 1\n const niceMaxY = Number.isFinite(maxY)\n ? maxY <= 0\n ? 1\n : (fixedY.max ?? niceNum(maxY))\n : 1\n const niceMinX = Number.isFinite(minX) ? (minX < 0 ? niceNum(minX) : 0) : 0\n const niceMinY = Number.isFinite(minY)\n ? minY < 0\n ? (fixedY.min ?? niceNum(minY))\n : 0\n : 0\n return { niceMinX, niceMaxX, niceMinY, niceMaxY }\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n position: 'relative',\n flex: '1 1 auto',\n width: '100%',\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\n// `sx` callback that needs runtime args — extracted at module scope so the\n// `styles` object can satisfy `Record<string, SxProps<Theme>>` cleanly\n// (function `sx`-with-args isn't assignable to plain `SxProps<Theme>`).\nconst dotSx = (top: string, left: string, size: number): SxProps<Theme> => ({\n position: 'absolute',\n top,\n left,\n width: size,\n height: size,\n borderRadius: '50%',\n})\n\nexport interface ScatterplotSkeletonProps {\n /** Number of dots to render. */\n count?: number\n}\n\n/**\n * Loading state for the Scatterplot widget. Mirrors a scatter chart's\n * silhouette — a deterministic spread of small circular dots in the plot\n * area plus a legend stub — so the skeleton reads as \"a scatter chart\"\n * rather than a generic list. Matches bar/histogram/pie skeleton structure\n * (grid stub + legend stub in a flex column).\n */\nexport function ScatterplotSkeleton({ count = 24 }: ScatterplotSkeletonProps) {\n // Deterministic pseudo-scatter positions so the skeleton doesn't flicker.\n const dots = Array.from({ length: count }, (_, i) => {\n const top = 10 + ((i * 37) % 80)\n const left = 5 + ((i * 53) % 90)\n const size = 8 + ((i * 7) % 6)\n return { top: `${top}%`, left: `${left}%`, size }\n })\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {dots.map((d, i) => (\n <Skeleton\n key={`dot-${i}`}\n variant='circular'\n sx={dotSx(d.top, d.left, d.size)}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadContext,\n type DownloadItem,\n} from '../actions/download'\nimport { getScatterplotXY } from './points'\nimport type { ScatterplotItem, ScatterplotWidgetData } from './types'\n\n/**\n * Download menu items for the Scatterplot widget. Always includes a CSV\n * item with `series, x, y` columns (one row per point). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createScatterplotDownloadConfig(args: {\n filename: string\n getData: (ctx: DownloadContext) => ScatterplotWidgetData<ScatterplotItem>\n seriesNames?: readonly string[]\n getCaptureEl?: (ctx: DownloadContext) => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: (ctx) => {\n const data = args.getData(ctx)\n const rows: unknown[][] = [['series', 'x', 'y']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const point of series) {\n const [x, y] = getScatterplotXY(point)\n rows.push([seriesName, x, y])\n }\n }\n return rows\n },\n }),\n )\n return items\n}\n","import {\n getScatterplotXY,\n isScatterplotDatum,\n withScatterplotXY,\n} from './points'\nimport type { ScatterplotItem } from './types'\n\n/**\n * Scatterplot-specific `RelativeData` transform. Scatter data is\n * `ScatterplotItem[][]` — each series is a list of `[x, y]` tuples or\n * `{ x, y, color? }` points (whose shape is kept).\n * Relative is a values-axis concept, so this rewrites `y` to its\n * share of the series's total `y` (0–100) and leaves `x` raw — x is\n * coordinate space, not part of the cohort total.\n *\n * Pass to `<Widget.RelativeData transform={toRelativeScatterplotData} />`.\n *\n * The denominator is the sum of |y| across the series so mixed-sign\n * y values produce sane signed shares-of-magnitude. A series whose\n * total y-magnitude is zero (all-zero or empty input) is returned\n * unchanged so a stalled or empty data set doesn't show misleading 0%\n * values. Inputs whose shape isn't `ScatterplotItem[]` fall through\n * untouched.\n */\nexport const toRelativeScatterplotData = (input: unknown): unknown => {\n if (!Array.isArray(input)) return input\n return input.map((series: unknown): unknown => {\n if (!isPointArray(series)) return series\n const total = series.reduce(\n (acc, p) => acc + Math.abs(getScatterplotXY(p)[1]),\n 0,\n )\n if (total <= 0) return series\n return series.map((p) => {\n const [x, y] = getScatterplotXY(p)\n return withScatterplotXY(p, x, (y / total) * 100)\n })\n })\n}\n\nfunction isPointArray(v: unknown): v is ScatterplotItem[] {\n return Array.isArray(v) && v.every(isScatterplotDatum)\n}\n\n/**\n * `LockSelection` filter for Scatterplot. Data is `ScatterplotItem[][]` —\n * points have no `name`, so selection (and locking) is keyed on a synthetic\n * `${seriesIndex}:${dataIndex}` string (same format `useChartSelection`'s\n * `keyFromClick`/`keysFromBrush` produce for this widget). Unlike Histogram,\n * a point's position carries no external meaning (no `ticks` to desync from),\n * so non-locked points are removed outright rather than zeroed.\n */\nexport function filterScatterplotByLockedPoints(\n input: unknown,\n lockedItems: readonly (string | number)[],\n): unknown {\n if (lockedItems.length === 0) return input\n if (!Array.isArray(input)) return input\n const locked = new Set<string>(lockedItems.map(String))\n return input.map((series: unknown, seriesIndex: number): unknown => {\n if (!isPointArray(series)) return series\n return series.filter((_, dataIndex) =>\n locked.has(`${seriesIndex}:${dataIndex}`),\n )\n })\n}\n"],"mappings":";;;;;;;;;;;AAGA,SAAgBC,EACdC,GAC2B;CAC3B,OAAOC,EAAQD,CAAK,IAAIA,IAAQ,CAACA,EAAME,GAAGF,EAAMG,CAAC;AACnD;AAGA,SAAgBC,EAAmBC,GAAkC;CACnE,IAAIC,MAAMC,QAAQF,CAAC,GACjB,OAAOA,EAAEG,WAAW,KAAKC,EAAeJ,EAAE,EAAE,KAAKI,EAAeJ,EAAE,EAAE;CAEtE,IAAiB,OAAOA,KAAM,aAA1BA,GAAoC,OAAO;CAC/C,IAAM,EAAEH,MAAGC,SAAME;CACjB,OAAOI,EAAeP,CAAC,KAAKO,EAAeN,CAAC;AAC9C;AAGA,SAAgBO,EACdV,GACAE,GACAC,GACiB;CACjB,OAAOF,EAAQD,CAAK,IAAI,CAACE,GAAGC,CAAC,IAAI;EAAE,GAAGH;EAAOE;EAAGC;CAAE;AACpD;AAEA,SAASF,EAAQD,GAA4D;CAC3E,OAAOM,MAAMC,QAAQP,C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,GAAG;CAClD,CAAC;AACH,CAAC,IAZiCN;AAepC,SAASK,EAAaS,GAAoC;CACxD,OAAOb,MAAMC,QAAQY,CAAC,KAAKA,EAAEC,MAAMnB,CAAkB;AACvD;AAUA,SAAgBoB,EACdhB,GACAiB,GACS;CAET,IADIA,EAAYC,WAAW,KACvB,CAACjB,MAAMC,QAAQF,CAAK,GAAG,OAAOA;CAClC,IAAMmB,IAAS,IAAIC,IAAYH,EAAYd,IAAIkB,MAAM,CAAC;CACtD,OAAOrB,EAAMG,KAAKC,GAAiBkB,MAC5BjB,EAAaD,CAAM,IACjBA,EAAOmB,QAAQC,GAAGC,MACvBN,EAAOO,IAAI,GAAGJ,EAAW,GAAIG,GAAW,CAC1C,IAHkCrB,CAInC;AACH"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { r as e } from "../zoom-toggle-KA63b6-J.js";
|
|
2
|
-
import { n as t
|
|
3
|
-
import { n
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
2
|
+
import { n as t } from "../scale-0elCv3tk.js";
|
|
3
|
+
import { n, t as r } from "../download--wRRnf19.js";
|
|
4
|
+
import { n as i, r as a, t as o } from "../utils-ClB6nn4w.js";
|
|
5
|
+
import { a as s, d as c, f as l, i as u, s as d, u as f } from "../chart-config-BWxjodlt.js";
|
|
6
|
+
import { t as p } from "../item-color-C1cu6EJd.js";
|
|
7
|
+
import { c as m } from "react/compiler-runtime";
|
|
8
|
+
import { Box as h, Skeleton as g } from "@mui/material";
|
|
9
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
|
+
import * as y from "echarts";
|
|
10
11
|
//#region src/widgets-v2/timeseries/options.ts
|
|
11
|
-
function
|
|
12
|
+
function b({ theme: e, formatter: t, labelFormatter: n }) {
|
|
12
13
|
let r = 0, i = 1;
|
|
13
14
|
return {
|
|
14
15
|
grid: {
|
|
15
16
|
left: parseInt(e.spacing(1)),
|
|
16
17
|
top: parseInt(e.spacing(3)),
|
|
17
18
|
right: parseInt(e.spacing(1)),
|
|
18
|
-
...
|
|
19
|
+
...s(!1, e),
|
|
19
20
|
containLabel: !0
|
|
20
21
|
},
|
|
21
22
|
tooltip: {
|
|
@@ -29,10 +30,10 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
29
30
|
fontFamily: e.typography.caption.fontFamily
|
|
30
31
|
},
|
|
31
32
|
axisPointer: { type: "line" },
|
|
32
|
-
position:
|
|
33
|
-
formatter:
|
|
33
|
+
position: c(e),
|
|
34
|
+
formatter: S(t, n)
|
|
34
35
|
},
|
|
35
|
-
legend: { ...
|
|
36
|
+
legend: { ...d({ hasLegend: !1 }) },
|
|
36
37
|
axisPointer: { lineStyle: { color: e.palette.grey[400] } },
|
|
37
38
|
color: [e.palette.secondary.main, ...Object.values(e.palette.qualitative?.bold ?? {})],
|
|
38
39
|
xAxis: {
|
|
@@ -40,7 +41,7 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
40
41
|
axisLine: { show: !1 },
|
|
41
42
|
axisTick: { show: !1 },
|
|
42
43
|
axisLabel: {
|
|
43
|
-
...
|
|
44
|
+
...u(e),
|
|
44
45
|
padding: [
|
|
45
46
|
parseInt(e.spacing(.5)),
|
|
46
47
|
0,
|
|
@@ -54,8 +55,8 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
54
55
|
},
|
|
55
56
|
yAxis: {
|
|
56
57
|
type: "value",
|
|
57
|
-
min: (e) => (r = e.min < 0 ?
|
|
58
|
-
max: (e) => (i = e.max <= 0 ? 1 :
|
|
58
|
+
min: (e) => (r = e.min < 0 ? l(e.min) : 0, r),
|
|
59
|
+
max: (e) => (i = e.max <= 0 ? 1 : l(e.max), i),
|
|
59
60
|
axisLine: { show: !1 },
|
|
60
61
|
axisTick: { show: !1 },
|
|
61
62
|
splitLine: {
|
|
@@ -63,7 +64,7 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
63
64
|
lineStyle: { color: e.palette.black?.[4] ?? e.palette.divider }
|
|
64
65
|
},
|
|
65
66
|
axisLabel: {
|
|
66
|
-
...
|
|
67
|
+
...u(e),
|
|
67
68
|
margin: parseInt(e.spacing(1)),
|
|
68
69
|
show: !0,
|
|
69
70
|
showMaxLabel: !0,
|
|
@@ -75,54 +76,54 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
|
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
let { theme:
|
|
80
|
-
return (
|
|
81
|
-
if (
|
|
82
|
-
let e =
|
|
83
|
-
theme:
|
|
84
|
-
formatter:
|
|
85
|
-
labelFormatter:
|
|
79
|
+
function x(n) {
|
|
80
|
+
let { theme: r, formatter: s, labelFormatter: c, optionsOverride: u } = n, d = n.series, f = n.smooth ?? !0, m = n.area ?? !1, h = n.selection, g = h && h.length > 0 ? new Set(h) : null, _ = (e) => e instanceof Date ? e.getTime() : e;
|
|
81
|
+
return (n, h, v) => {
|
|
82
|
+
if (n == null) {
|
|
83
|
+
let e = b({
|
|
84
|
+
theme: r,
|
|
85
|
+
formatter: s,
|
|
86
|
+
labelFormatter: c
|
|
86
87
|
});
|
|
87
|
-
return
|
|
88
|
+
return u ? a(e, u) : e;
|
|
88
89
|
}
|
|
89
|
-
let
|
|
90
|
-
if (
|
|
91
|
-
...
|
|
90
|
+
let x = Array.isArray(h) ? h : [];
|
|
91
|
+
if (x.length === 0) return {
|
|
92
|
+
...n,
|
|
92
93
|
dataset: [],
|
|
93
94
|
series: []
|
|
94
95
|
};
|
|
95
|
-
let
|
|
96
|
-
let
|
|
97
|
-
theme:
|
|
96
|
+
let C = x.length > 1, w = Array.isArray(n.series) ? n.series : [], T = w[0] ?? {}, E = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, D = t(E), O = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, k = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, A = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, j = v?.formatter, M = 0, N = 1, P = i(n.dataZoom, C), F = typeof O.bottom == "number" ? O.bottom : 24, I = C ? 56 : F, L = P ? I + e.sliderHeight + e.sliderGap : I, R = (e, t) => {
|
|
97
|
+
let n = p({
|
|
98
|
+
theme: r,
|
|
98
99
|
datums: e,
|
|
99
100
|
template: t,
|
|
100
101
|
fallback: (e) => e.color
|
|
101
102
|
});
|
|
102
103
|
return { color: (e) => {
|
|
103
|
-
let t = e.value?.name,
|
|
104
|
-
return !
|
|
104
|
+
let t = e.value?.name, r = n(e);
|
|
105
|
+
return !g || t == null || g.has(_(t)) ? r : y.color.modifyAlpha(r, .15);
|
|
105
106
|
} };
|
|
106
|
-
},
|
|
107
|
+
}, z = x.some((e) => e.some((e) => typeof e?.color == "string" && e.color !== ""));
|
|
107
108
|
return {
|
|
108
|
-
...
|
|
109
|
-
dataset:
|
|
110
|
-
series:
|
|
111
|
-
let
|
|
109
|
+
...n,
|
|
110
|
+
dataset: x.map((e) => ({ source: e })),
|
|
111
|
+
series: x.map((e, t) => {
|
|
112
|
+
let n = w[t] ?? T, i = o(r, d?.[t]?.color);
|
|
112
113
|
return {
|
|
113
|
-
...typeof
|
|
114
|
+
...typeof n == "object" ? n : {},
|
|
114
115
|
type: "line",
|
|
115
116
|
datasetIndex: t,
|
|
116
|
-
name:
|
|
117
|
+
name: d?.[t]?.name ?? `Series ${t + 1}`,
|
|
117
118
|
encode: {
|
|
118
119
|
x: "name",
|
|
119
120
|
y: "value"
|
|
120
121
|
},
|
|
121
|
-
smooth:
|
|
122
|
-
showSymbol:
|
|
123
|
-
...
|
|
122
|
+
smooth: f,
|
|
123
|
+
showSymbol: g != null || z,
|
|
124
|
+
...m ? { areaStyle: {} } : {},
|
|
124
125
|
emphasis: { focus: "series" },
|
|
125
|
-
itemStyle:
|
|
126
|
+
itemStyle: R(e, n),
|
|
126
127
|
...i ? {
|
|
127
128
|
color: i,
|
|
128
129
|
lineStyle: { color: i }
|
|
@@ -130,32 +131,32 @@ function b(t) {
|
|
|
130
131
|
};
|
|
131
132
|
}),
|
|
132
133
|
legend: {
|
|
133
|
-
...
|
|
134
|
-
show:
|
|
134
|
+
...A,
|
|
135
|
+
show: C
|
|
135
136
|
},
|
|
136
137
|
grid: {
|
|
137
|
-
...
|
|
138
|
-
bottom:
|
|
138
|
+
...O,
|
|
139
|
+
bottom: L
|
|
139
140
|
},
|
|
140
|
-
...
|
|
141
|
+
...P ? { dataZoom: P } : {},
|
|
141
142
|
yAxis: {
|
|
142
|
-
...
|
|
143
|
-
min: (e) => (
|
|
144
|
-
max: (e) => (
|
|
143
|
+
...E,
|
|
144
|
+
min: (e) => (M = e.min < 0 ? D.min ?? l(e.min) : 0, M),
|
|
145
|
+
max: (e) => (N = e.max <= 0 ? 1 : D.max ?? l(e.max), N),
|
|
145
146
|
axisLabel: {
|
|
146
|
-
...
|
|
147
|
-
formatter: (e) => e !==
|
|
147
|
+
...E.axisLabel ?? {},
|
|
148
|
+
formatter: (e) => e !== N && e !== M || e === 0 ? "" : j ? j(e) : String(e)
|
|
148
149
|
}
|
|
149
150
|
},
|
|
150
151
|
tooltip: {
|
|
151
|
-
...
|
|
152
|
-
formatter:
|
|
152
|
+
...k,
|
|
153
|
+
formatter: S(j, c)
|
|
153
154
|
}
|
|
154
155
|
};
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
-
return
|
|
158
|
+
function S(e, t) {
|
|
159
|
+
return f((n) => {
|
|
159
160
|
let r = n.value, i = r?.value, a = typeof i == "number" && e ? e(i) : i ?? "", o = typeof n.marker == "string" ? n.marker : "", s = n.seriesName ? `${n.seriesName}: ` : "", c = r?.name ?? n.name, l = t && c != null ? t(c instanceof Date ? c : new Date(c)) : c ?? "";
|
|
160
161
|
return {
|
|
161
162
|
name: String(l),
|
|
@@ -167,7 +168,7 @@ function x(e, t) {
|
|
|
167
168
|
}
|
|
168
169
|
//#endregion
|
|
169
170
|
//#region src/widgets-v2/timeseries/skeleton.tsx
|
|
170
|
-
var
|
|
171
|
+
var C = {
|
|
171
172
|
container: {
|
|
172
173
|
display: "flex",
|
|
173
174
|
flexDirection: "column",
|
|
@@ -213,42 +214,42 @@ var S = {
|
|
|
213
214
|
gap: ({ spacing: e }) => e(1.5)
|
|
214
215
|
}
|
|
215
216
|
};
|
|
216
|
-
function
|
|
217
|
-
let e =
|
|
218
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */
|
|
219
|
-
sx:
|
|
217
|
+
function w() {
|
|
218
|
+
let e = m(2), t;
|
|
219
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ v(h, {
|
|
220
|
+
sx: C.graph,
|
|
220
221
|
children: [
|
|
221
|
-
/* @__PURE__ */ g
|
|
222
|
+
/* @__PURE__ */ _(g, {
|
|
222
223
|
variant: "rectangular",
|
|
223
|
-
sx:
|
|
224
|
+
sx: C.segmentA
|
|
224
225
|
}),
|
|
225
|
-
/* @__PURE__ */ g
|
|
226
|
+
/* @__PURE__ */ _(g, {
|
|
226
227
|
variant: "rectangular",
|
|
227
|
-
sx:
|
|
228
|
+
sx: C.segmentB
|
|
228
229
|
}),
|
|
229
|
-
/* @__PURE__ */ g
|
|
230
|
+
/* @__PURE__ */ _(g, {
|
|
230
231
|
variant: "rectangular",
|
|
231
|
-
sx:
|
|
232
|
+
sx: C.segmentC
|
|
232
233
|
})
|
|
233
234
|
]
|
|
234
235
|
}), e[0] = t) : t = e[0];
|
|
235
236
|
let n;
|
|
236
|
-
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */
|
|
237
|
-
sx:
|
|
238
|
-
children: [t, /* @__PURE__ */
|
|
239
|
-
sx:
|
|
240
|
-
children: [0, 1].map(
|
|
237
|
+
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ v(h, {
|
|
238
|
+
sx: C.container,
|
|
239
|
+
children: [t, /* @__PURE__ */ _(h, {
|
|
240
|
+
sx: C.legend,
|
|
241
|
+
children: [0, 1].map(T)
|
|
241
242
|
})]
|
|
242
243
|
}), e[1] = n) : n = e[1], n;
|
|
243
244
|
}
|
|
244
|
-
function
|
|
245
|
-
return /* @__PURE__ */
|
|
246
|
-
sx:
|
|
247
|
-
children: [/* @__PURE__ */ g
|
|
245
|
+
function T(e) {
|
|
246
|
+
return /* @__PURE__ */ v(h, {
|
|
247
|
+
sx: C.legendItem,
|
|
248
|
+
children: [/* @__PURE__ */ _(g, {
|
|
248
249
|
variant: "circular",
|
|
249
250
|
width: 8,
|
|
250
251
|
height: 8
|
|
251
|
-
}), /* @__PURE__ */ g
|
|
252
|
+
}), /* @__PURE__ */ _(g, {
|
|
252
253
|
width: 48,
|
|
253
254
|
height: 8
|
|
254
255
|
})]
|
|
@@ -256,14 +257,14 @@ function w(e) {
|
|
|
256
257
|
}
|
|
257
258
|
//#endregion
|
|
258
259
|
//#region src/widgets-v2/timeseries/download.ts
|
|
259
|
-
function
|
|
260
|
-
let
|
|
261
|
-
return e.getCaptureEl &&
|
|
260
|
+
function E(e) {
|
|
261
|
+
let t = [];
|
|
262
|
+
return e.getCaptureEl && t.push(n({
|
|
262
263
|
filename: e.filename,
|
|
263
264
|
getCaptureEl: e.getCaptureEl,
|
|
264
265
|
pixelRatio: e.pngPixelRatio,
|
|
265
266
|
backgroundColor: e.pngBackgroundColor
|
|
266
|
-
})),
|
|
267
|
+
})), t.push(r({
|
|
267
268
|
filename: e.filename,
|
|
268
269
|
getRows: (t) => {
|
|
269
270
|
let n = e.getData(t), r = n.length, i = [], a = /* @__PURE__ */ new Set();
|
|
@@ -275,20 +276,20 @@ function T(e) {
|
|
|
275
276
|
for (let t = 0; t < r; t++) s.push(e.seriesNames?.[t] ?? `series_${t + 1}`);
|
|
276
277
|
let c = [s];
|
|
277
278
|
for (let e of i) {
|
|
278
|
-
let t = [
|
|
279
|
+
let t = [D(e)], n = String(e);
|
|
279
280
|
for (let e of o) t.push(e.get(n) ?? "");
|
|
280
281
|
c.push(t);
|
|
281
282
|
}
|
|
282
283
|
return c;
|
|
283
284
|
}
|
|
284
|
-
})),
|
|
285
|
+
})), t;
|
|
285
286
|
}
|
|
286
|
-
function
|
|
287
|
+
function D(e) {
|
|
287
288
|
return e instanceof Date ? e.toISOString() : typeof e == "number" ? new Date(e).toISOString() : e;
|
|
288
289
|
}
|
|
289
290
|
//#endregion
|
|
290
291
|
//#region src/widgets-v2/timeseries/transforms.ts
|
|
291
|
-
function
|
|
292
|
+
function O(e, t) {
|
|
292
293
|
if (t.length === 0 || !Array.isArray(e)) return e;
|
|
293
294
|
let n = new Set(t);
|
|
294
295
|
return e.map((e) => Array.isArray(e) ? e.filter((e) => {
|
|
@@ -298,6 +299,6 @@ function D(e, t) {
|
|
|
298
299
|
}) : e);
|
|
299
300
|
}
|
|
300
301
|
//#endregion
|
|
301
|
-
export {
|
|
302
|
+
export { w as TimeseriesSkeleton, E as createTimeseriesDownloadConfig, x as createTimeseriesOptionFactory, O as filterTimeseriesByLockedItems, b as timeseriesOptions };
|
|
302
303
|
|
|
303
304
|
//# sourceMappingURL=timeseries.js.map
|