@milaboratories/miplots4 1.0.133 → 1.0.135
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/{discrete/components → common}/BandAxis.d.ts +2 -2
- package/dist/common/BandAxis.d.ts.map +1 -0
- package/dist/{discrete/components → common}/BandAxis.js +3 -3
- package/dist/common/BandAxis.js.map +1 -0
- package/dist/common/ContinuousGrid.d.ts +3 -3
- package/dist/common/ContinuousGrid.d.ts.map +1 -1
- package/dist/common/ContinuousGrid.js.map +1 -1
- package/dist/discrete/ChartRenderer.d.ts.map +1 -1
- package/dist/discrete/ChartRenderer.js +192 -265
- package/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/discrete/DiscreteSettingsImpl.d.ts +17 -2
- package/dist/discrete/DiscreteSettingsImpl.d.ts.map +1 -1
- package/dist/discrete/DiscreteSettingsImpl.js +93 -67
- package/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/discrete/components/Chart.d.ts.map +1 -1
- package/dist/discrete/components/Chart.js +153 -136
- package/dist/discrete/components/Chart.js.map +1 -1
- package/dist/discrete/components/Grid.d.ts +3 -3
- package/dist/discrete/components/Grid.d.ts.map +1 -1
- package/dist/discrete/components/Grid.js.map +1 -1
- package/dist/discrete/components/layers/StackedAreaElement.d.ts +24 -0
- package/dist/discrete/components/layers/StackedAreaElement.d.ts.map +1 -0
- package/dist/discrete/components/layers/StackedAreaElement.js +105 -0
- package/dist/discrete/components/layers/StackedAreaElement.js.map +1 -0
- package/dist/discrete/components/layers/StackedBarElement.d.ts +3 -1
- package/dist/discrete/components/layers/StackedBarElement.d.ts.map +1 -1
- package/dist/discrete/components/layers/StackedBarElement.js +67 -60
- package/dist/discrete/components/layers/StackedBarElement.js.map +1 -1
- package/dist/discrete/components/types.d.ts +5 -3
- package/dist/discrete/components/types.d.ts.map +1 -1
- package/dist/discrete/index.d.ts.map +1 -1
- package/dist/discrete/index.js +58 -55
- package/dist/discrete/index.js.map +1 -1
- package/dist/discrete/layers/index.d.ts +1 -0
- package/dist/discrete/layers/index.d.ts.map +1 -1
- package/dist/discrete/layers/stackedArea.d.ts +10 -0
- package/dist/discrete/layers/stackedArea.d.ts.map +1 -0
- package/dist/discrete/layers/stackedArea.js +17 -0
- package/dist/discrete/layers/stackedArea.js.map +1 -0
- package/dist/discrete/layers/types.d.ts +12 -1
- package/dist/discrete/layers/types.d.ts.map +1 -1
- package/dist/discrete/utils/index.d.ts +1 -1
- package/dist/discrete/utils/index.d.ts.map +1 -1
- package/dist/histogram/ChartRenderer.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/node_modules/d3-scale/src/band.js +45 -35
- package/dist/node_modules/d3-scale/src/band.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.d.ts +10 -5
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +276 -197
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +5 -3
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +53 -53
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/Chart.d.ts +3 -1
- package/dist/scatterplot/components/Chart.d.ts.map +1 -1
- package/dist/scatterplot/components/Chart.js +23 -19
- package/dist/scatterplot/components/Chart.js.map +1 -1
- package/dist/scatterplot/components/ChartAxis.d.ts +3 -1
- package/dist/scatterplot/components/ChartAxis.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartAxis.js +31 -27
- package/dist/scatterplot/components/ChartAxis.js.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.js +20 -17
- package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.d.ts +5 -1
- package/dist/scatterplot/components/ChartsGroup.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.js +49 -46
- package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/scatterplot/components/Grid.d.ts +3 -3
- package/dist/scatterplot/components/Grid.d.ts.map +1 -1
- package/dist/scatterplot/components/Grid.js +31 -27
- package/dist/scatterplot/components/Grid.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +15 -5
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot/dots.d.ts +2 -2
- package/dist/scatterplot/dots.d.ts.map +1 -1
- package/dist/scatterplot/dots.js.map +1 -1
- package/dist/scatterplot/getLayersData.d.ts +3 -2
- package/dist/scatterplot/getLayersData.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.js +29 -18
- package/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/scatterplot/index.d.ts +3 -0
- package/dist/scatterplot/index.d.ts.map +1 -1
- package/dist/scatterplot/index.js +73 -59
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot/linearRegression.d.ts +4 -6
- package/dist/scatterplot/linearRegression.d.ts.map +1 -1
- package/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/scatterplot/utils/isNumericScale.d.ts +6 -0
- package/dist/scatterplot/utils/isNumericScale.d.ts.map +1 -0
- package/dist/scatterplot/utils/isNumericScale.js +11 -0
- package/dist/scatterplot/utils/isNumericScale.js.map +1 -0
- package/dist/scatterplot-umap/ChartRenderer.js +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +7 -4
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +7 -7
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/types/bubble.d.ts +12 -12
- package/dist/types/common.d.ts +186 -21
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +36 -26
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +22 -22
- package/dist/types/discrete.d.ts +291 -53
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/discrete.js +48 -33
- package/dist/types/discrete.js.map +1 -1
- package/dist/types/heatmap.d.ts +12 -12
- package/dist/types/histogram.d.ts +4 -4
- package/dist/types/scatterplot-umap.d.ts +4 -34
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +1 -1
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +186 -32
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/utils/createMultilineDiscreteLabels.d.ts +4 -0
- package/dist/utils/createMultilineDiscreteLabels.d.ts.map +1 -0
- package/dist/utils/createMultilineDiscreteLabels.js +32 -0
- package/dist/utils/createMultilineDiscreteLabels.js.map +1 -0
- package/dist/utils/getFacetRowsColumns.d.ts +3 -0
- package/dist/utils/getFacetRowsColumns.d.ts.map +1 -0
- package/dist/utils/getFacetRowsColumns.js +18 -0
- package/dist/utils/getFacetRowsColumns.js.map +1 -0
- package/dist/utils/measureMultilineDiscreteLabels.d.ts +9 -0
- package/dist/utils/measureMultilineDiscreteLabels.d.ts.map +1 -0
- package/dist/utils/measureMultilineDiscreteLabels.js +63 -0
- package/dist/utils/measureMultilineDiscreteLabels.js.map +1 -0
- package/dist/utils/splitTextByWidth.d.ts.map +1 -0
- package/dist/{discrete/utils → utils}/splitTextByWidth.js +1 -1
- package/dist/utils/splitTextByWidth.js.map +1 -0
- package/package.json +1 -1
- package/dist/discrete/components/BandAxis.d.ts.map +0 -1
- package/dist/discrete/components/BandAxis.js.map +0 -1
- package/dist/discrete/utils/splitTextByWidth.d.ts.map +0 -1
- package/dist/discrete/utils/splitTextByWidth.js.map +0 -1
- package/dist/scatterplot/components/Axis.d.ts +0 -13
- package/dist/scatterplot/components/Axis.d.ts.map +0 -1
- package/dist/scatterplot/components/Axis.js +0 -59
- package/dist/scatterplot/components/Axis.js.map +0 -1
- /package/dist/{discrete/utils → utils}/splitTextByWidth.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsGroup.js","sources":["../../../src/scatterplot/components/ChartsGroup.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { ChartsTitle } from '../../common/ChartsTitle';\nimport { ErrorBoundary } from '../../common/ErrorBoundary';\nimport fonts from '../../common/fonts';\nimport { Legend } from '../../common/Legend';\nimport { useTooltip } from '../../common/Tooltip';\nimport type { LegendData } from '../../common/types';\nimport type { ColumnName } from '../../types';\nimport { LEGEND_OFFSET } from '../constants';\nimport type { Dot, GroupedDots } from '../dots';\nimport type { ScatterplotLayerData } from '../getLayersData';\nimport type { TrendsData } from '../linearRegression';\nimport type { ScatterplotSettingsImpl } from '../ScatterplotSettingsImpl';\nimport { Chart } from './Chart';\nimport { ChartTooltip } from './ChartTooltip';\nimport type {\n AesGetters,\n CaptionsSizes,\n ChartDimensionsData,\n ChartSizes,\n ChartsScales,\n Margins,\n} from './types';\n\ninterface ChartsGroupProps {\n chartSettings: ScatterplotSettingsImpl['chartSettings'];\n facetSettings: ScatterplotSettingsImpl['facetSettings'];\n chartSizes: ChartSizes;\n chartsDimensions: Record<string, ChartDimensionsData>;\n scales: ChartsScales;\n facetKeys: string[];\n settingsId: string;\n groupedDots: GroupedDots;\n legendData: LegendData;\n trendsData: TrendsData | null;\n columnsCount: number;\n margins: Margins;\n keyColumn: ColumnName;\n mainTitle: string[];\n facetTitles: Record<string, string[]>;\n captionsSizes: CaptionsSizes;\n onlyPositive: {x: boolean, y: boolean};\n layersData: Record<string, ScatterplotLayerData[]>;\n aesGetters: AesGetters;\n onTooltipHintSwitch: (v:boolean) => void;\n}\n\nexport function ChartsGroup({\n settingsId,\n chartSettings,\n chartSizes,\n chartsDimensions,\n facetKeys,\n facetSettings,\n scales,\n groupedDots,\n legendData,\n trendsData,\n columnsCount,\n margins,\n keyColumn,\n mainTitle,\n facetTitles,\n captionsSizes,\n onlyPositive,\n layersData,\n aesGetters,\n onTooltipHintSwitch\n}: ChartsGroupProps) {\n const tooltipsData = useTooltip<Dot>(onTooltipHintSwitch);\n \n const {xAxis, yAxis, title, frame, legend, tooltips} = chartSettings;\n\n const leftTopChartPadding = chartsDimensions[facetKeys[0]].padding;\n const rightTopChartPadding = chartsDimensions[facetKeys[columnsCount - 1]].padding;\n\n const legendLeft = chartSizes.chartsWidth + LEGEND_OFFSET;\n const legendTop = leftTopChartPadding.top;\n\n const scalesByFacet = useMemo(() => {\n return Object.fromEntries(\n facetKeys.map(key => [key, {x: scales.x[key], y: scales.y[key]}])\n );\n }, [scales.x, scales.y, facetKeys]);\n\n return (\n <ErrorBoundary dataId={settingsId}>\n <div style={{ position: 'relative', width: chartSizes.totalWidth, height: chartSizes.totalHeight }}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${chartSizes.totalWidth} ${chartSizes.totalHeight}`}\n width={chartSizes.totalWidth}\n height={chartSizes.totalHeight}\n style={{ position: 'absolute', top: 0, left: 0, zIndex: 0 }}\n >\n <defs>{fonts}</defs>\n <g transform={`translate(${margins.left},${margins.top})`} fontFamily=\"Manrope\">\n <ChartsTitle\n title={mainTitle}\n show={title.show}\n position={title.position}\n leftPadding={leftTopChartPadding.left}\n rightPadding={rightTopChartPadding.right}\n chartsWidth={chartSizes.chartsWidth}\n />\n {facetKeys.map(key => (\n <Chart\n key={key}\n facetKey={key}\n scales={scalesByFacet[key]}\n width={chartSizes.chartWidth}\n height={chartSizes.chartHeight}\n dimensions={chartsDimensions[key]}\n facetSettings={facetSettings}\n xAxis={xAxis}\n yAxis={yAxis}\n frameType={frame.type}\n dotsData={groupedDots[key]}\n trendsData={trendsData ? trendsData[key] : null}\n facetTitle={facetTitles[key]}\n captionsSizes={captionsSizes}\n layersData={layersData[key]}\n onlyPositive={onlyPositive}\n aesGetters={aesGetters}\n onMouseEnterDot={tooltipsData.onMouseEnter}\n onMouseLeaveDot={tooltipsData.onMouseLeave}\n />\n ))}\n {legend.show && (\n <g transform={`translate(${legendLeft},${legendTop})`}>\n <Legend legendData={legendData} />\n </g>\n )}\n\n <ChartTooltip\n tooltipsData={tooltipsData}\n dimensions={chartsDimensions[tooltipsData.currentFacet]}\n scales={scalesByFacet[tooltipsData.currentFacet]}\n keyColumn={keyColumn}\n margins={margins}\n chartSizes={chartSizes}\n tooltips={tooltips}\n aesGetters={aesGetters}\n />\n </g>\n </svg>\n </div>\n </ErrorBoundary>\n );\n}\n"],"names":["ChartsGroup","settingsId","chartSettings","chartSizes","chartsDimensions","facetKeys","facetSettings","scales","groupedDots","legendData","trendsData","columnsCount","margins","keyColumn","mainTitle","facetTitles","captionsSizes","onlyPositive","layersData","aesGetters","onTooltipHintSwitch","tooltipsData","useTooltip","xAxis","yAxis","title","frame","legend","tooltips","leftTopChartPadding","rightTopChartPadding","legendLeft","LEGEND_OFFSET","legendTop","scalesByFacet","useMemo","key","ErrorBoundary","jsx","jsxs","fonts","ChartsTitle","Chart","Legend","ChartTooltip"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ChartsGroup.js","sources":["../../../src/scatterplot/components/ChartsGroup.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { ChartsTitle } from '../../common/ChartsTitle';\nimport { ErrorBoundary } from '../../common/ErrorBoundary';\nimport fonts from '../../common/fonts';\nimport { Legend } from '../../common/Legend';\nimport { useTooltip } from '../../common/Tooltip';\nimport type { LegendData } from '../../common/types';\nimport type { ColumnName } from '../../types';\nimport { LEGEND_OFFSET } from '../constants';\nimport type { Dot, GroupedDots } from '../dots';\nimport type { ScatterplotLayerData } from '../getLayersData';\nimport type { TrendsData } from '../linearRegression';\nimport type { ScatterplotSettingsImpl } from '../ScatterplotSettingsImpl';\nimport { Chart } from './Chart';\nimport { ChartTooltip } from './ChartTooltip';\nimport type {\n AesGetters,\n CaptionsSizes,\n ChartDimensionsData,\n ChartSizes,\n ChartsScales,\n Margins,\n} from './types';\n\ninterface ChartsGroupProps {\n chartSettings: ScatterplotSettingsImpl['chartSettings'];\n facetSettings: ScatterplotSettingsImpl['facetSettings'];\n chartSizes: ChartSizes;\n chartsDimensions: Record<string, ChartDimensionsData>;\n scales: ChartsScales;\n facetKeys: string[];\n settingsId: string;\n groupedDots: GroupedDots;\n legendData: LegendData;\n trendsData: TrendsData | null;\n columnsCount: number;\n margins: Margins;\n keyColumn: ColumnName;\n mainTitle: string[];\n facetTitles: Record<string, string[]>;\n captionsSizes: CaptionsSizes;\n onlyPositive: {x: boolean, y: boolean};\n layersData: Record<string, ScatterplotLayerData[]>;\n aesGetters: AesGetters;\n discreteAxesLabels: {\n x: Record<string, Record<string, string[]>>,\n y: Record<string, Record<string, string[]>>\n };\n onTooltipHintSwitch: (v:boolean) => void;\n}\n\nexport function ChartsGroup({\n settingsId,\n chartSettings,\n chartSizes,\n chartsDimensions,\n facetKeys,\n facetSettings,\n scales,\n groupedDots,\n legendData,\n trendsData,\n columnsCount,\n margins,\n keyColumn,\n mainTitle,\n facetTitles,\n captionsSizes,\n onlyPositive,\n layersData,\n aesGetters,\n discreteAxesLabels,\n onTooltipHintSwitch\n}: ChartsGroupProps) {\n const tooltipsData = useTooltip<Dot>(onTooltipHintSwitch);\n \n const {xAxis, yAxis, title, frame, legend, tooltips} = chartSettings;\n\n const leftTopChartPadding = chartsDimensions[facetKeys[0]].padding;\n const rightTopChartPadding = chartsDimensions[facetKeys[columnsCount - 1]].padding;\n\n const legendLeft = chartSizes.chartsWidth + LEGEND_OFFSET;\n const legendTop = leftTopChartPadding.top;\n\n const scalesByFacet = useMemo(() => {\n return Object.fromEntries(\n facetKeys.map(key => [key, {x: scales.x[key], y: scales.y[key]}])\n );\n }, [scales.x, scales.y, facetKeys]);\n\n return (\n <ErrorBoundary dataId={settingsId}>\n <div style={{ position: 'relative', width: chartSizes.totalWidth, height: chartSizes.totalHeight }}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={`0 0 ${chartSizes.totalWidth} ${chartSizes.totalHeight}`}\n width={chartSizes.totalWidth}\n height={chartSizes.totalHeight}\n style={{ position: 'absolute', top: 0, left: 0, zIndex: 0 }}\n >\n <defs>{fonts}</defs>\n <g transform={`translate(${margins.left},${margins.top})`} fontFamily=\"Manrope\">\n <ChartsTitle\n title={mainTitle}\n show={title.show}\n position={title.position}\n leftPadding={leftTopChartPadding.left}\n rightPadding={rightTopChartPadding.right}\n chartsWidth={chartSizes.chartsWidth}\n />\n {facetKeys.map(key => (\n <Chart\n key={key}\n facetKey={key}\n scales={scalesByFacet[key]}\n width={chartSizes.chartWidth}\n height={chartSizes.chartHeight}\n dimensions={chartsDimensions[key]}\n facetSettings={facetSettings}\n xAxis={xAxis}\n yAxis={yAxis}\n discreteLabelsX={discreteAxesLabels.x[key]}\n discreteLabelsY={discreteAxesLabels.y[key]}\n frameType={frame.type}\n dotsData={groupedDots[key]}\n trendsData={trendsData ? trendsData[key] : null}\n facetTitle={facetTitles[key]}\n captionsSizes={captionsSizes}\n layersData={layersData[key]}\n onlyPositive={onlyPositive}\n aesGetters={aesGetters}\n onMouseEnterDot={tooltipsData.onMouseEnter}\n onMouseLeaveDot={tooltipsData.onMouseLeave}\n />\n ))}\n {legend.show && (\n <g transform={`translate(${legendLeft},${legendTop})`}>\n <Legend legendData={legendData} />\n </g>\n )}\n\n <ChartTooltip\n tooltipsData={tooltipsData}\n dimensions={chartsDimensions[tooltipsData.currentFacet]}\n scales={scalesByFacet[tooltipsData.currentFacet]}\n keyColumn={keyColumn}\n margins={margins}\n chartSizes={chartSizes}\n tooltips={tooltips}\n aesGetters={aesGetters}\n />\n </g>\n </svg>\n </div>\n </ErrorBoundary>\n );\n}\n"],"names":["ChartsGroup","settingsId","chartSettings","chartSizes","chartsDimensions","facetKeys","facetSettings","scales","groupedDots","legendData","trendsData","columnsCount","margins","keyColumn","mainTitle","facetTitles","captionsSizes","onlyPositive","layersData","aesGetters","discreteAxesLabels","onTooltipHintSwitch","tooltipsData","useTooltip","xAxis","yAxis","title","frame","legend","tooltips","leftTopChartPadding","rightTopChartPadding","legendLeft","LEGEND_OFFSET","legendTop","scalesByFacet","useMemo","key","ErrorBoundary","jsx","jsxs","fonts","ChartsTitle","Chart","Legend","ChartTooltip"],"mappings":";;;;;;;;;;AAmDO,SAASA,GAAY;AAAA,EACxB,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AACJ,GAAqB;AACjB,QAAMC,IAAeC,EAAgBF,CAAmB,GAElD,EAAC,OAAAG,GAAO,OAAAC,GAAO,OAAAC,GAAO,OAAAC,GAAO,QAAAC,GAAQ,UAAAC,MAAY3B,GAEjD4B,IAAsB1B,EAAiBC,EAAU,CAAC,CAAC,EAAE,SACrD0B,IAAuB3B,EAAiBC,EAAUM,IAAe,CAAC,CAAC,EAAE,SAErEqB,IAAa7B,EAAW,cAAc8B,GACtCC,IAAYJ,EAAoB,KAEhCK,IAAgBC,EAAAA,QAAQ,MACnB,OAAO;AAAA,IACV/B,EAAU,IAAI,CAAAgC,MAAO,CAACA,GAAK,EAAC,GAAG9B,EAAO,EAAE8B,CAAG,GAAG,GAAG9B,EAAO,EAAE8B,CAAG,GAAE,CAAC;AAAA,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AG;AAAA,cACzC,WAAWV,EAAM;AAAA,cACjB,UAAUnB,EAAY6B,CAAG;AAAA,cACzB,YAAY3B,IAAaA,EAAW2B,CAAG,IAAI;AAAA,cAC3C,YAAYtB,EAAYsB,CAAG;AAAA,cAC3B,eAAArB;AAAA,cACA,YAAYE,EAAWmB,CAAG;AAAA,cAC1B,cAAApB;AAAA,cACA,YAAAE;AAAA,cACA,iBAAiBG,EAAa;AAAA,cAC9B,iBAAiBA,EAAa;AAAA,YAAA;AAAA,YApBzBe;AAAA,UAAA,CAsBZ;AAAA,UACAT,EAAO,QACJW,gBAAAA,MAAC,KAAA,EAAE,WAAW,aAAaP,CAAU,IAAIE,CAAS,KAC9C,UAAAK,gBAAAA,EAAAA,IAACK,GAAA,EAAO,YAAAnC,GAAwB,GACpC;AAAA,UAGJ8B,gBAAAA,EAAAA;AAAAA,YAACM;AAAA,YAAA;AAAA,cACG,cAAAvB;AAAA,cACA,YAAYlB,EAAiBkB,EAAa,YAAY;AAAA,cACtD,QAAQa,EAAcb,EAAa,YAAY;AAAA,cAC/C,WAAAT;AAAA,cACA,SAAAD;AAAA,cACA,YAAAT;AAAA,cACA,UAAA0B;AAAA,cACA,YAAAV;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAER,EAAA,CACJ;AAER;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AxisSettings, FrameType } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { ChartScales } from './types';
|
|
3
3
|
interface GridProps {
|
|
4
|
-
scaleY:
|
|
5
|
-
scaleX:
|
|
4
|
+
scaleY: ChartScales['y'];
|
|
5
|
+
scaleX: ChartScales['x'];
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
axisX: AxisSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/scatterplot/components/Grid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/scatterplot/components/Grid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAA0B,SAAS,EAAE,MAAM,aAAa,CAAC;AAInF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAO3C,UAAU,SAAS;IACf,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AASD,wBAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,WAAgB,EAAE,EAAE,SAAS,2CA4D3G"}
|
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
import { j as t } from "../../node_modules/react/jsx-runtime.js";
|
|
2
|
-
import { GRID_GRAY as
|
|
2
|
+
import { GRID_GRAY as f, BLACK as u } from "../../constants.js";
|
|
3
3
|
import { getLineShape as G } from "../../utils/getLineShape.js";
|
|
4
|
-
import { r as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
import { r as m } from "../../_virtual/index.js";
|
|
5
|
+
import { isNumericScale as _, isContinuousAxis as L } from "../utils/isNumericScale.js";
|
|
6
|
+
const D = 1;
|
|
7
|
+
function y(s, c) {
|
|
8
|
+
return _(s) ? s.ticks().filter((i) => !c.includes(i)) : s.domain();
|
|
9
|
+
}
|
|
10
|
+
function C({ scaleX: s, scaleY: c, width: i, height: x, axisX: e, axisY: k, frameType: o, updatingKey: $ = "" }) {
|
|
11
|
+
const { significantLines: l = [] } = e, { significantLines: j = [] } = k, [d, g] = m.useState(() => y(s, l)), [p, S] = m.useState(() => y(c, j));
|
|
12
|
+
return m.useEffect(() => {
|
|
13
|
+
const r = y(s, l), n = y(c, j);
|
|
14
|
+
g(r), S(n);
|
|
15
|
+
}, [s, c, $]), /* @__PURE__ */ t.jsxs("g", { stroke: f, children: [
|
|
16
|
+
e.showGrid && d.map((r) => {
|
|
17
|
+
const n = s(r);
|
|
18
|
+
return /* @__PURE__ */ t.jsx("line", { x1: n, x2: n, y1: 0, y2: x }, `x_${n}_${x}`);
|
|
15
19
|
}),
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */ t.jsx("line", { x1: 0, x2:
|
|
20
|
+
k.showGrid && p.map((r) => {
|
|
21
|
+
const n = c(r);
|
|
22
|
+
return /* @__PURE__ */ t.jsx("line", { x1: 0, x2: i, y1: n, y2: n }, `y_${n}_${i}`);
|
|
19
23
|
}),
|
|
20
|
-
/* @__PURE__ */ t.jsx("g", { strokeDasharray: G(
|
|
21
|
-
const
|
|
22
|
-
return /* @__PURE__ */ t.jsx("line", { x1:
|
|
24
|
+
_(s) && L(e) && /* @__PURE__ */ t.jsx("g", { strokeDasharray: G(e.significantLinesStyle), stroke: u, children: l.map((r) => {
|
|
25
|
+
const n = s(r);
|
|
26
|
+
return /* @__PURE__ */ t.jsx("line", { x1: n, x2: n, y1: 0, y2: x }, `significant_${n}_${x}`);
|
|
23
27
|
}) }),
|
|
24
|
-
/* @__PURE__ */ t.jsx("g", { strokeDasharray: G(
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */ t.jsx("line", { x1: 0, x2:
|
|
28
|
+
_(c) && L(k) && /* @__PURE__ */ t.jsx("g", { strokeDasharray: G(k.significantLinesStyle), stroke: u, children: j.map((r) => {
|
|
29
|
+
const n = c(r);
|
|
30
|
+
return /* @__PURE__ */ t.jsx("line", { x1: 0, x2: i, y1: n, y2: n }, `significant_${n}_${i}`);
|
|
27
31
|
}) }),
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
(
|
|
31
|
-
(
|
|
32
|
-
(
|
|
32
|
+
o !== "empty" && /* @__PURE__ */ t.jsxs("g", { strokeWidth: D, children: [
|
|
33
|
+
(e.showGrid || o !== "left") && /* @__PURE__ */ t.jsx("line", { stroke: o === "left" ? f : u, x1: "0", x2: i, y1: x, y2: x }),
|
|
34
|
+
(e.showGrid || o !== "bottom") && /* @__PURE__ */ t.jsx("line", { stroke: o === "bottom" ? f : u, x1: "0", x2: "0", y1: "0", y2: x }),
|
|
35
|
+
(e.showGrid || o === "full") && /* @__PURE__ */ t.jsx("line", { stroke: o === "full" ? u : f, x1: i, x2: i, y1: "0", y2: x }),
|
|
36
|
+
(k.showGrid || o === "full") && /* @__PURE__ */ t.jsx("line", { stroke: o === "full" ? u : f, x1: "0", x2: i, y1: "0", y2: "0" })
|
|
33
37
|
] })
|
|
34
38
|
] });
|
|
35
39
|
}
|
|
36
40
|
export {
|
|
37
|
-
|
|
41
|
+
C as Grid
|
|
38
42
|
};
|
|
39
43
|
//# sourceMappingURL=Grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sources":["../../../src/scatterplot/components/Grid.tsx"],"sourcesContent":["import {BLACK, GRID_GRAY} from '../../constants';\nimport type {AxisSettings, FrameType} from '../../types';\nimport {getLineShape} from '../../utils/getLineShape';\nimport
|
|
1
|
+
{"version":3,"file":"Grid.js","sources":["../../../src/scatterplot/components/Grid.tsx"],"sourcesContent":["import { BLACK, GRID_GRAY } from '../../constants';\nimport type { AxisSettings, AxisSettingsContinuous, FrameType } from '../../types';\nimport { getLineShape } from '../../utils/getLineShape';\nimport React from 'react';\nimport { useEffect, useState } from 'react';\nimport type { ChartScales } from './types';\nimport { isContinuousAxis, isNumericScale } from '../utils/isNumericScale';\n\ntype PointValue = { valueOf(): number; } & string;\n\nconst GRID_FRAME_WIDTH = 1;\n\ninterface GridProps {\n scaleY: ChartScales['y'];\n scaleX: ChartScales['x'];\n width: number;\n height: number;\n axisX: AxisSettings;\n axisY: AxisSettings;\n frameType: FrameType;\n updatingKey?: string;\n}\n\nfunction getTicks(scale: ChartScales['x' | 'y'], significantLines: number[]): (string | number)[] {\n if (isNumericScale(scale)) {\n return scale.ticks().filter(t => !significantLines.includes(t));\n }\n return scale.domain();\n}\n\nexport function Grid({ scaleX, scaleY, width, height, axisX, axisY, frameType, updatingKey = '' }: GridProps) {\n const { significantLines: significantLinesX = [] } = axisX as AxisSettingsContinuous;\n const { significantLines: significantLinesY = [] } = axisY as AxisSettingsContinuous;\n\n const [ticksX, setTicksX] = useState<(string | number)[]>(() => getTicks(scaleX, significantLinesX));\n const [ticksY, setTicksY] = useState<(string | number)[]>(() => getTicks(scaleY, significantLinesY));\n\n useEffect(() => {\n const ticksX = getTicks(scaleX, significantLinesX);\n const ticksY = getTicks(scaleY, significantLinesY);\n setTicksX(ticksX);\n setTicksY(ticksY);\n }, [scaleX, scaleY, updatingKey]);\n\n return (\n <g stroke={GRID_GRAY}>\n {axisX.showGrid &&\n ticksX.map((tick) => {\n const x = scaleX(tick as PointValue);\n return (\n <line key={`x_${x}_${height}`} x1={x} x2={x} y1={0} y2={height} />\n );\n })}\n {axisY.showGrid &&\n ticksY.map(tick => {\n const y = scaleY(tick as PointValue);\n return (\n <line key={`y_${y}_${width}`} x1={0} x2={width} y1={y} y2={y} />\n );\n })}\n {isNumericScale(scaleX) && isContinuousAxis(axisX) && (\n <g strokeDasharray={getLineShape(axisX.significantLinesStyle)} stroke={BLACK}>\n {significantLinesX.map(v => {\n const x = scaleX(v);\n return (\n <line key={`significant_${x}_${height}`} x1={x} x2={x} y1={0} y2={height} />\n );\n })}\n </g>\n )}\n {isNumericScale(scaleY) && isContinuousAxis(axisY) && (\n <g strokeDasharray={getLineShape(axisY.significantLinesStyle)} stroke={BLACK}>\n {significantLinesY.map(v => {\n const y = scaleY(v);\n return (\n <line key={`significant_${y}_${width}`} x1={0} x2={width} y1={y} y2={y} />\n );\n })}\n </g>\n )}\n {frameType !== 'empty' && (\n <g strokeWidth={GRID_FRAME_WIDTH}>\n {(axisX.showGrid || frameType !== 'left') && <line stroke={frameType === 'left' ? GRID_GRAY : BLACK} x1=\"0\" x2={width} y1={height} y2={height} />}\n {(axisX.showGrid || frameType !== 'bottom') && <line stroke={frameType === 'bottom' ? GRID_GRAY : BLACK} x1=\"0\" x2=\"0\" y1=\"0\" y2={height} />}\n {(axisX.showGrid || frameType === 'full') && <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1={width} x2={width} y1=\"0\" y2={height} />}\n {(axisY.showGrid || frameType === 'full') && <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1=\"0\" x2={width} y1=\"0\" y2=\"0\" />}\n </g>\n )}\n </g>\n );\n}\n"],"names":["GRID_FRAME_WIDTH","getTicks","scale","significantLines","isNumericScale","t","Grid","scaleX","scaleY","width","height","axisX","axisY","frameType","updatingKey","significantLinesX","significantLinesY","ticksX","setTicksX","useState","ticksY","setTicksY","useEffect","jsxs","GRID_GRAY","tick","x","jsx","y","isContinuousAxis","getLineShape","BLACK","v"],"mappings":";;;;;AAUA,MAAMA,IAAmB;AAazB,SAASC,EAASC,GAA+BC,GAAiD;AAC9F,SAAIC,EAAeF,CAAK,IACbA,EAAM,QAAQ,OAAO,OAAK,CAACC,EAAiB,SAASE,CAAC,CAAC,IAE3DH,EAAM,OAAA;AACjB;AAEO,SAASI,EAAK,EAAE,QAAAC,GAAQ,QAAAC,GAAQ,OAAAC,GAAO,QAAAC,GAAQ,OAAAC,GAAO,OAAAC,GAAO,WAAAC,GAAW,aAAAC,IAAc,GAAA,GAAiB;AAC1G,QAAM,EAAE,kBAAkBC,IAAoB,CAAA,MAAOJ,GAC/C,EAAE,kBAAkBK,IAAoB,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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
1
|
+
import { ScaleLinear, ScaleLogarithmic, ScalePoint } from 'd3-scale';
|
|
2
2
|
import { LineShape, PointShape } from '../../types';
|
|
3
3
|
export interface Margins {
|
|
4
4
|
top: number;
|
|
@@ -14,13 +14,15 @@ export interface ChartSizes {
|
|
|
14
14
|
totalWidth: number;
|
|
15
15
|
totalHeight: number;
|
|
16
16
|
}
|
|
17
|
+
export type NumericScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
|
|
18
|
+
export type DiscreteScale = ScalePoint<string | number>;
|
|
17
19
|
export interface ChartScales {
|
|
18
|
-
x:
|
|
19
|
-
y:
|
|
20
|
+
x: NumericScale | DiscreteScale;
|
|
21
|
+
y: NumericScale | DiscreteScale;
|
|
20
22
|
}
|
|
21
23
|
export interface ChartsScales {
|
|
22
|
-
x: Record<string,
|
|
23
|
-
y: Record<string,
|
|
24
|
+
x: Record<string, NumericScale> | Record<string, DiscreteScale>;
|
|
25
|
+
y: Record<string, NumericScale> | Record<string, DiscreteScale>;
|
|
24
26
|
}
|
|
25
27
|
export interface ChartDimensionsData {
|
|
26
28
|
left: number;
|
|
@@ -44,6 +46,10 @@ export interface ChartDimensionsData {
|
|
|
44
46
|
export interface CaptionsSizes {
|
|
45
47
|
xAxisCaptionsWidth: number;
|
|
46
48
|
yAxisCaptionsWidth: number;
|
|
49
|
+
bottomAxisCaptionsWidthByRows: number[];
|
|
50
|
+
leftAxisCaptionsWidthByColumns: number[];
|
|
51
|
+
bottomCaptionsTail: number;
|
|
52
|
+
leftCaptionsTail: number;
|
|
47
53
|
}
|
|
48
54
|
export type Scale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
|
|
49
55
|
export type AesGetters = {
|
|
@@ -54,4 +60,8 @@ export type AesGetters = {
|
|
|
54
60
|
lineColor: (rowIndex: number) => string;
|
|
55
61
|
trendColor: (rowIndex: number) => string;
|
|
56
62
|
};
|
|
63
|
+
export type DiscreteAxisData = {
|
|
64
|
+
keys: (string | number)[];
|
|
65
|
+
labels: Record<string, string>;
|
|
66
|
+
};
|
|
57
67
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/scatterplot/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/scatterplot/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,WAAW,OAAO;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1F,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AACxD,MAAM,WAAW,WAAW;IACxB,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;IAChC,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CACnC;AAED,MAAM,WA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IACvC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;IAC3C,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAI;IAAC,IAAI,EAAC,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,CAAC"}
|
|
@@ -3,8 +3,8 @@ import { ColumnName, DataValue } from '../types';
|
|
|
3
3
|
import { ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';
|
|
4
4
|
export type Dot = {
|
|
5
5
|
idx: number;
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
6
|
+
x: string | number;
|
|
7
|
+
y: string | number;
|
|
8
8
|
label: DataValue | null;
|
|
9
9
|
dimmed: boolean;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dots.d.ts","sourceRoot":"","sources":["../../src/scatterplot/dots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAIzE,MAAM,MAAM,GAAG,GAAG;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dots.d.ts","sourceRoot":"","sources":["../../src/scatterplot/dots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAIzE,MAAM,MAAM,GAAG,GAAG;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAC5B,MAAM,EACN;IACI,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;CACf,CACJ,CAAC;AAEF,wBAAgB,OAAO,CACnB,IAAI,EAAE,SAAS,EACf,qBAAqB,EAAE,MAAM,EAAE,EAAE,EACjC,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACb,KAAK,EAAE,UAAU,GAAG,IAAI,EACxB,SAAS,EAAE,UAAU,GAAG,IAAI,EAC5B,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAC9C,WAAW,CAgDb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dots.js","sources":["../../src/scatterplot/dots.ts"],"sourcesContent":["import {format} from 'd3-format';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue } from '../types';\nimport type { ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';\nimport {formatColumnValue} from './utils/formatColumnValue';\nimport {sortDotsByGrouping} from './utils/sortDotsByGrouping';\n\nexport type Dot = {\n idx: number;\n x: number;\n y: number;\n label: DataValue | null;\n dimmed: boolean;\n};\n\nexport type GroupedDots = Record<\n string,\n {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n dots: Dot[];\n }\n>;\n\nexport function getDots(\n data: DataFrame,\n facetKeysCombinations: string[][],\n x: ColumnName,\n y: ColumnName,\n label: ColumnName | null,\n highlight: ColumnName | null,\n grouping: ScatterplotSettingsImpl['grouping']\n): GroupedDots {\n const result: GroupedDots = {};\n\n const labelFormatter = label?.format ? format(label.format) : undefined;\n\n for (const facetKeys of facetKeysCombinations) {\n const dots: Dot[] = [];\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n const templateGroupPath = facetKeys.concat(['']);\n const rows = data.getRowsByGrouping(templateGroupPath);\n\n for (let i = 0; i < rows.length; i++) {\n const rowIdx = rows[i];\n const valueX = data.getColumnValue(x.value, rowIdx) as number;\n const valueY = data.getColumnValue(y.value, rowIdx) as number;\n\n if (valueX === null && valueY === null) continue;\n\n minX = Math.min(minX, valueX);\n minY = Math.min(minY, valueY);\n maxX = Math.max(maxX, valueX);\n maxY = Math.max(maxY, valueY);\n\n dots.push({\n x: valueX,\n y: valueY,\n label: formatColumnValue(data, rowIdx, label, labelFormatter),\n dimmed: highlight ? !data.getColumnValue(highlight.value, rowIdx) : false,\n idx: rowIdx\n });\n }\n\n sortDotsByGrouping(data, dots, grouping, highlight);\n\n result[facetKeys.join('_')] = {\n minX,\n maxX,\n minY,\n maxY,\n dots,\n };\n }\n\n return result;\n}\n"],"names":["getDots","data","facetKeysCombinations","x","y","label","highlight","grouping","result","labelFormatter","format","facetKeys","dots","minX","minY","maxX","maxY","templateGroupPath","rows","i","rowIdx","valueX","valueY","formatColumnValue","sortDotsByGrouping"],"mappings":";;;AA0BO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACW;AACX,QAAMC,IAAsB,CAAA,GAEtBC,IAAiBJ,KAAA,QAAAA,EAAO,SAASK,EAAOL,EAAM,MAAM,IAAI;AAE9D,aAAWM,KAAaT,GAAuB;AAC3C,UAAMU,IAAc,CAAA;AACpB,QAAIC,IAAO,OACPC,IAAO,OACPC,IAAO,QACPC,IAAO;AAEX,UAAMC,IAAoBN,EAAU,OAAO,CAAC,EAAE,CAAC,GACzCO,IAAOjB,EAAK,kBAAkBgB,CAAiB;AAErD,aAASE,IAAI,GAAGA,IAAID,EAAK,QAAQC,KAAK;AAClC,YAAMC,IAASF,EAAKC,CAAC,GACfE,IAASpB,EAAK,eAAeE,EAAE,OAAOiB,CAAM,GAC5CE,IAASrB,EAAK,eAAeG,EAAE,OAAOgB,CAAM;AAElD,MAAIC,MAAW,QAAQC,MAAW,SAElCT,IAAO,KAAK,IAAIA,GAAMQ,CAAM,GAC5BP,IAAO,KAAK,IAAIA,GAAMQ,CAAM,GAC5BP,IAAO,KAAK,IAAIA,GAAMM,CAAM,GAC5BL,IAAO,KAAK,IAAIA,GAAMM,CAAM,GAE5BV,EAAK,KAAK;AAAA,QACN,GAAGS;AAAA,QACH,GAAGC;AAAA,QACH,OAAOC,EAAkBtB,GAAMmB,GAAQf,GAAOI,CAAc;AAAA,QAC5D,QAAQH,IAAY,CAACL,EAAK,eAAeK,EAAU,OAAOc,CAAM,IAAI;AAAA,QACpE,KAAKA;AAAA,MAAA,CACR;AAAA,IACL;AAEA,IAAAI,EAAmBvB,GAAMW,GAAML,GAAUD,CAAS,GAElDE,EAAOG,EAAU,KAAK,GAAG,CAAC,IAAI;AAAA,MAC1B,MAAAE;AAAA,MACA,MAAAE;AAAA,MACA,MAAAD;AAAA,MACA,MAAAE;AAAA,MACA,MAAAJ;AAAA,IAAA;AAAA,EAER;AAEA,SAAOJ;AACX;"}
|
|
1
|
+
{"version":3,"file":"dots.js","sources":["../../src/scatterplot/dots.ts"],"sourcesContent":["import {format} from 'd3-format';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue } from '../types';\nimport type { ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';\nimport {formatColumnValue} from './utils/formatColumnValue';\nimport {sortDotsByGrouping} from './utils/sortDotsByGrouping';\n\nexport type Dot = {\n idx: number;\n x: string | number;\n y: string | number;\n label: DataValue | null;\n dimmed: boolean;\n};\n\nexport type GroupedDots = Record<\n string,\n {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n dots: Dot[];\n }\n>;\n\nexport function getDots(\n data: DataFrame,\n facetKeysCombinations: string[][],\n x: ColumnName,\n y: ColumnName,\n label: ColumnName | null,\n highlight: ColumnName | null,\n grouping: ScatterplotSettingsImpl['grouping']\n): GroupedDots {\n const result: GroupedDots = {};\n\n const labelFormatter = label?.format ? format(label.format) : undefined;\n\n for (const facetKeys of facetKeysCombinations) {\n const dots: Dot[] = [];\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n const templateGroupPath = facetKeys.concat(['']);\n const rows = data.getRowsByGrouping(templateGroupPath);\n\n for (let i = 0; i < rows.length; i++) {\n const rowIdx = rows[i];\n const valueX = data.getColumnValue(x.value, rowIdx) as number;\n const valueY = data.getColumnValue(y.value, rowIdx) as number;\n\n if (valueX === null && valueY === null) continue;\n\n minX = Math.min(minX, valueX);\n minY = Math.min(minY, valueY);\n maxX = Math.max(maxX, valueX);\n maxY = Math.max(maxY, valueY);\n\n dots.push({\n x: valueX,\n y: valueY,\n label: formatColumnValue(data, rowIdx, label, labelFormatter),\n dimmed: highlight ? !data.getColumnValue(highlight.value, rowIdx) : false,\n idx: rowIdx\n });\n }\n\n sortDotsByGrouping(data, dots, grouping, highlight);\n\n result[facetKeys.join('_')] = {\n minX,\n maxX,\n minY,\n maxY,\n dots,\n };\n }\n\n return result;\n}\n"],"names":["getDots","data","facetKeysCombinations","x","y","label","highlight","grouping","result","labelFormatter","format","facetKeys","dots","minX","minY","maxX","maxY","templateGroupPath","rows","i","rowIdx","valueX","valueY","formatColumnValue","sortDotsByGrouping"],"mappings":";;;AA0BO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACW;AACX,QAAMC,IAAsB,CAAA,GAEtBC,IAAiBJ,KAAA,QAAAA,EAAO,SAASK,EAAOL,EAAM,MAAM,IAAI;AAE9D,aAAWM,KAAaT,GAAuB;AAC3C,UAAMU,IAAc,CAAA;AACpB,QAAIC,IAAO,OACPC,IAAO,OACPC,IAAO,QACPC,IAAO;AAEX,UAAMC,IAAoBN,EAAU,OAAO,CAAC,EAAE,CAAC,GACzCO,IAAOjB,EAAK,kBAAkBgB,CAAiB;AAErD,aAASE,IAAI,GAAGA,IAAID,EAAK,QAAQC,KAAK;AAClC,YAAMC,IAASF,EAAKC,CAAC,GACfE,IAASpB,EAAK,eAAeE,EAAE,OAAOiB,CAAM,GAC5CE,IAASrB,EAAK,eAAeG,EAAE,OAAOgB,CAAM;AAElD,MAAIC,MAAW,QAAQC,MAAW,SAElCT,IAAO,KAAK,IAAIA,GAAMQ,CAAM,GAC5BP,IAAO,KAAK,IAAIA,GAAMQ,CAAM,GAC5BP,IAAO,KAAK,IAAIA,GAAMM,CAAM,GAC5BL,IAAO,KAAK,IAAIA,GAAMM,CAAM,GAE5BV,EAAK,KAAK;AAAA,QACN,GAAGS;AAAA,QACH,GAAGC;AAAA,QACH,OAAOC,EAAkBtB,GAAMmB,GAAQf,GAAOI,CAAc;AAAA,QAC5D,QAAQH,IAAY,CAACL,EAAK,eAAeK,EAAU,OAAOc,CAAM,IAAI;AAAA,QACpE,KAAKA;AAAA,MAAA,CACR;AAAA,IACL;AAEA,IAAAI,EAAmBvB,GAAMW,GAAML,GAAUD,CAAS,GAElDE,EAAOG,EAAU,KAAK,GAAG,CAAC,IAAI;AAAA,MAC1B,MAAAE;AAAA,MACA,MAAAE;AAAA,MACA,MAAAD;AAAA,MACA,MAAAE;AAAA,MACA,MAAAJ;AAAA,IAAA;AAAA,EAER;AAEA,SAAOJ;AACX;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DataFrame } from '../DataFrame';
|
|
2
2
|
import { ColumnName, ScatterplotLayer } from '../types';
|
|
3
|
+
import { DiscreteAxisData } from './components/types';
|
|
3
4
|
import { Dot, GroupedDots } from './dots';
|
|
4
|
-
import { CurveLayer, DotsLayer } from './ScatterplotSettingsImpl';
|
|
5
|
+
import { CurveLayer, DotsLayer, ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';
|
|
5
6
|
export type DotsLayerData = {
|
|
6
7
|
type: 'dots';
|
|
7
8
|
info: DotsLayer;
|
|
@@ -16,5 +17,5 @@ export type CurveLayerData = {
|
|
|
16
17
|
geoms: CurveData[];
|
|
17
18
|
};
|
|
18
19
|
export type ScatterplotLayerData = DotsLayerData | CurveLayerData;
|
|
19
|
-
export declare function getLayersData(dataFrame: DataFrame, layers: ScatterplotLayer[], facetKeys: string[], dotsByFacets: GroupedDots, categoryGroupingCombinations: string[][], grouping: ColumnName[]): Record<string, ScatterplotLayerData[]>;
|
|
20
|
+
export declare function getLayersData(dataFrame: DataFrame, layers: ScatterplotLayer[], facetKeys: string[], dotsByFacets: GroupedDots, categoryGroupingCombinations: string[][], grouping: ColumnName[], axisX: ScatterplotSettingsImpl['chartSettings']['xAxis'], discreteAxisDataX: DiscreteAxisData): Record<string, ScatterplotLayerData[]>;
|
|
20
21
|
//# sourceMappingURL=getLayersData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayersData.d.ts","sourceRoot":"","sources":["../../src/scatterplot/getLayersData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7D,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"getLayersData.d.ts","sourceRoot":"","sources":["../../src/scatterplot/getLayersData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc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3
|
+
if (c.scale !== "discrete")
|
|
4
|
+
o.sort((e, t) => e.x - t.x);
|
|
5
|
+
else {
|
|
6
|
+
const e = u.keys.reduce((t, n, r) => (t[n] = u.keys.length - r, t), {});
|
|
7
|
+
o.sort((t, n) => {
|
|
8
|
+
const r = e[t.x], i = e[n.x];
|
|
9
|
+
return r !== i ? r - i : 0;
|
|
10
|
+
}), o.sort();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function C(o, c, u, e, t, n, r, i) {
|
|
14
|
+
return u.reduce((g, p) => {
|
|
15
|
+
const l = e[p].dots;
|
|
16
|
+
return g[p] = c.map((s) => {
|
|
17
|
+
if (s.type === "curve")
|
|
7
18
|
return {
|
|
8
19
|
type: "curve",
|
|
9
|
-
info:
|
|
10
|
-
geoms:
|
|
11
|
-
const
|
|
12
|
-
(
|
|
20
|
+
info: s,
|
|
21
|
+
geoms: t.map((f) => {
|
|
22
|
+
const m = l.filter(
|
|
23
|
+
(a) => n.every((d, y) => String(o.getColumnValue(d.value, a.idx)) === f[y])
|
|
13
24
|
);
|
|
14
|
-
return
|
|
15
|
-
}).filter((
|
|
25
|
+
return v(m, r, i), { dots: m };
|
|
26
|
+
}).filter((f) => f.dots.length > 0)
|
|
16
27
|
};
|
|
17
|
-
if (
|
|
28
|
+
if (s.type === "dots")
|
|
18
29
|
return {
|
|
19
30
|
type: "dots",
|
|
20
|
-
info:
|
|
21
|
-
geoms:
|
|
31
|
+
info: s,
|
|
32
|
+
geoms: l
|
|
22
33
|
};
|
|
23
|
-
|
|
24
|
-
}),
|
|
34
|
+
h(s, "Unknown scatterplot layer type");
|
|
35
|
+
}), g;
|
|
25
36
|
}, {});
|
|
26
37
|
}
|
|
27
38
|
export {
|
|
28
|
-
|
|
39
|
+
C as getLayersData
|
|
29
40
|
};
|
|
30
41
|
//# sourceMappingURL=getLayersData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLayersData.js","sources":["../../src/scatterplot/getLayersData.ts"],"sourcesContent":["import type { DataFrame } from '../DataFrame';\nimport type { ColumnName, ScatterplotLayer } from '../types';\nimport { exhaustive } from '../utils';\nimport type { Dot, GroupedDots } from './dots';\nimport type { CurveLayer, DotsLayer } from './ScatterplotSettingsImpl';\n\nexport type DotsLayerData = {\n type: 'dots',\n info: DotsLayer,\n geoms: Dot[]\n}\n\nexport type CurveData = {\n dots: Dot[],\n}\nexport type CurveLayerData = {\n type: 'curve',\n info: CurveLayer,\n geoms: CurveData[]\n}\n\nexport type ScatterplotLayerData = DotsLayerData | CurveLayerData;\n\nexport function getLayersData(\n dataFrame: DataFrame,\n layers: ScatterplotLayer[],\n facetKeys: string[],\n dotsByFacets: GroupedDots,\n categoryGroupingCombinations: string[][],\n grouping: ColumnName[]
|
|
1
|
+
{"version":3,"file":"getLayersData.js","sources":["../../src/scatterplot/getLayersData.ts"],"sourcesContent":["import type { DataFrame } from '../DataFrame';\nimport type { ColumnName, ScatterplotLayer } from '../types';\nimport { exhaustive } from '../utils';\nimport type { DiscreteAxisData } from './components/types';\nimport type { Dot, GroupedDots } from './dots';\nimport type { CurveLayer, DotsLayer, ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';\n\nexport type DotsLayerData = {\n type: 'dots',\n info: DotsLayer,\n geoms: Dot[]\n}\n\nexport type CurveData = {\n dots: Dot[],\n}\nexport type CurveLayerData = {\n type: 'curve',\n info: CurveLayer,\n geoms: CurveData[]\n}\n\nexport type ScatterplotLayerData = DotsLayerData | CurveLayerData;\n\nfunction sortDotsForCurve(dots:Dot[], axisX: ScatterplotSettingsImpl['chartSettings']['xAxis'], discreteAxisDataX: DiscreteAxisData) {\n if (axisX.scale !== 'discrete') {\n dots.sort((d1, d2) => (d1.x as number) - (d2.x as number));\n } else {\n const weightsByColumnByOrder = discreteAxisDataX.keys.reduce((res, key, idx) => {\n res[key] = discreteAxisDataX.keys.length - idx;\n return res;\n }, {} as Record<string, number>);\n\n dots.sort((d1, d2) => {\n const aWeight = weightsByColumnByOrder[d1.x];\n const bWeight = weightsByColumnByOrder[d2.x];\n if (aWeight !== bWeight) {\n return aWeight - bWeight;\n }\n return 0;\n });\n dots.sort();\n }\n}\nexport function getLayersData(\n dataFrame: DataFrame,\n layers: ScatterplotLayer[],\n facetKeys: string[],\n dotsByFacets: GroupedDots,\n categoryGroupingCombinations: string[][],\n grouping: ColumnName[],\n axisX: ScatterplotSettingsImpl['chartSettings']['xAxis'],\n discreteAxisDataX: DiscreteAxisData,\n): Record<string, ScatterplotLayerData[]> {\n return facetKeys.reduce((res:Record<string, ScatterplotLayerData[]>, key) => {\n const facetDots = dotsByFacets[key].dots;\n res[key] = layers.map(layer => {\n if (layer.type === 'curve') {\n return {\n type: 'curve',\n info: layer,\n geoms: categoryGroupingCombinations.map(values => {\n const dots = facetDots.filter(dot =>\n grouping.every((column, idx) => String(dataFrame.getColumnValue(column.value, dot.idx)) === values[idx])\n );\n sortDotsForCurve(dots, axisX, discreteAxisDataX);\n return {dots};\n }).filter(item => item.dots.length > 0)\n } as CurveLayerData;\n }\n if (layer.type === 'dots') {\n return {\n type: 'dots',\n info: layer,\n geoms: facetDots,\n } as DotsLayerData;\n }\n exhaustive(layer, 'Unknown scatterplot layer type');\n });\n return res;\n }, {});\n}\n"],"names":["sortDotsForCurve","dots","axisX","discreteAxisDataX","d1","d2","weightsByColumnByOrder","res","key","idx","aWeight","bWeight","getLayersData","dataFrame","layers","facetKeys","dotsByFacets","categoryGroupingCombinations","grouping","facetDots","layer","values","column","dot","item","exhaustive"],"mappings":";AAwBA,SAASA,EAAiBC,GAAYC,GAA0DC,GAAqC;AACjI,MAAID,EAAM,UAAU;AAChB,IAAAD,EAAK,KAAK,CAACG,GAAIC,MAAQD,EAAG,IAAgBC,EAAG,CAAY;AAAA,OACtD;AACH,UAAMC,IAAyBH,EAAkB,KAAK,OAAO,CAACI,GAAKC,GAAKC,OACpEF,EAAIC,CAAG,IAAIL,EAAkB,KAAK,SAASM,GACpCF,IACR,CAAA,CAA4B;AAE/B,IAAAN,EAAK,KAAK,CAACG,GAAIC,MAAO;AAClB,YAAMK,IAAUJ,EAAuBF,EAAG,CAAC,GACrCO,IAAUL,EAAuBD,EAAG,CAAC;AAC3C,aAAIK,MAAYC,IACLD,IAAUC,IAEd;AAAA,IACX,CAAC,GACDV,EAAK,KAAA;AAAA,EACT;AACJ;AACO,SAASW,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAhB,GACAC,GACsC;AACtC,SAAOY,EAAU,OAAO,CAACR,GAA4CC,MAAQ;AACzE,UAAMW,IAAYH,EAAaR,CAAG,EAAE;AACpC,WAAAD,EAAIC,CAAG,IAAIM,EAAO,IAAI,CAAAM,MAAS;AAC3B,UAAIA,EAAM,SAAS;AACf,eAAO;AAAA,UACH,MAAM;AAAA,UACN,MAAMA;AAAA,UACN,OAAOH,EAA6B,IAAI,CAAAI,MAAU;AAC9C,kBAAMpB,IAAOkB,EAAU;AAAA,cAAO,OAC1BD,EAAS,MAAM,CAACI,GAAQb,MAAQ,OAAOI,EAAU,eAAeS,EAAO,OAAOC,EAAI,GAAG,CAAC,MAAMF,EAAOZ,CAAG,CAAC;AAAA,YAAA;AAE3G,mBAAAT,EAAiBC,GAAMC,GAAOC,CAAiB,GACxC,EAAC,MAAAF,EAAA;AAAA,UACZ,CAAC,EAAE,OAAO,OAAQuB,EAAK,KAAK,SAAS,CAAC;AAAA,QAAA;AAG9C,UAAIJ,EAAM,SAAS;AACf,eAAO;AAAA,UACH,MAAM;AAAA,UACN,MAAMA;AAAA,UACN,OAAOD;AAAA,QAAA;AAGf,MAAAM,EAAWL,GAAO,gCAAgC;AAAA,IACtD,CAAC,GACMb;AAAA,EACX,GAAG,CAAA,CAAE;AACT;"}
|
|
@@ -6,6 +6,7 @@ import { GroupedDots } from './dots';
|
|
|
6
6
|
import { ScatterplotLayerData } from './getLayersData';
|
|
7
7
|
import { TrendsData } from './linearRegression';
|
|
8
8
|
import { ScatterplotSettingsImpl } from './ScatterplotSettingsImpl';
|
|
9
|
+
import { DiscreteAxisData } from './components/types';
|
|
9
10
|
export declare class ChartScatterplot extends AbstractChart {
|
|
10
11
|
settings: ScatterplotSettingsImpl;
|
|
11
12
|
chartRenderer: ChartRenderer;
|
|
@@ -21,6 +22,8 @@ export declare class ChartScatterplot extends AbstractChart {
|
|
|
21
22
|
trendsData: TrendsData | null;
|
|
22
23
|
legendLabels: ScatterplotLegendInfo;
|
|
23
24
|
layersData: Record<string, ScatterplotLayerData[]>;
|
|
25
|
+
discreteAxisDataX: DiscreteAxisData;
|
|
26
|
+
discreteAxisDataY: DiscreteAxisData;
|
|
24
27
|
} | null;
|
|
25
28
|
constructor(data: DataFrame, settings: ScatterplotSettings, eventHandlers?: ScatterplotEventHandlers);
|
|
26
29
|
mount(node: HTMLElement): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scatterplot/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scatterplot/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAQR,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,uBAAuB,EAAE,M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