@milaboratories/graph-maker 1.1.142 → 1.1.144
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/GraphMaker/components/ReorderForm.vue.d.ts +15 -0
- package/dist/GraphMaker/components/ReorderForm.vue.d.ts.map +1 -0
- package/dist/GraphMaker/components/ReorderForm.vue.js +43 -0
- package/dist/GraphMaker/components/ReorderForm.vue.js.map +1 -0
- package/dist/GraphMaker/components/ReorderForm.vue2.js +5 -0
- package/dist/GraphMaker/components/ReorderForm.vue2.js.map +1 -0
- package/dist/GraphMaker/constantsCommon.d.ts +15 -0
- package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
- package/dist/GraphMaker/constantsCommon.js +11 -8
- package/dist/GraphMaker/constantsCommon.js.map +1 -1
- package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
- package/dist/GraphMaker/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js +305 -172
- package/dist/GraphMaker/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js +33 -33
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +3 -3
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +9 -9
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +5 -11
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +3 -3
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +31 -5
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +56 -53
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +1 -7
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +13 -13
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts +6 -4
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js +42 -13
- package/dist/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +48 -44
- package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/{discrete/components → common}/BandAxis.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/common/BandAxis.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/common/ContinuousGrid.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +14 -14
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +197 -270
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +9 -9
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Grid.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +11 -11
- package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-scale/src/band.js +44 -34
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-scale/src/band.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +272 -195
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +23 -23
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +54 -50
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxis.js +32 -28
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxis.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +29 -26
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +44 -41
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Grid.js +31 -27
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Grid.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +29 -18
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +71 -57
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/isNumericScale.js +11 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/isNumericScale.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +10 -10
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +6 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +35 -25
- package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +37 -37
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +6 -6
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +7 -7
- package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/createMultilineDiscreteLabels.js +32 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/createMultilineDiscreteLabels.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getFacetRowsColumns.js +18 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/getFacetRowsColumns.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/measureMultilineDiscreteLabels.js +63 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/measureMultilineDiscreteLabels.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/{discrete/utils → utils}/splitTextByWidth.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/utils/splitTextByWidth.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +39 -32
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +68 -62
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +5 -5
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +8 -8
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +3 -3
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +8 -8
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +12 -9
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/{index.js → error_like_shape.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js +63 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js +152 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +189 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js +18 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js +12 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js +7 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js +13 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +89 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +50 -45
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +54 -50
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/BandAxis.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +0 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Axis.js +0 -59
- package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Axis.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -979
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1599
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScatterplotSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.ts"],"sourcesContent":["import { ScatterplotSettings, ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport {\n ComponentStateFilter,\n ComponentStateSimple,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n ScatterplotUIState\n} from '@milaboratories/pf-plots';\nimport {\n DEFAULT_BLACK,\n DEFAULT_CATEGORICAL_PALETTE,\n PALETTE_MAP,\n UNKNOWN_COLOR\n} from '../../constantsAesthetic';\nimport {\n isMappedAes,\n LOWER_LIMIT_KEY, MappingLink,\n PALETTE_KEY,\n SCATTERPLOT_TEMPLATES_MAP,\n ScatterplotStatisticsState, SYMMETRIC_RANGE_KEY,\n THRESHOLDS_KEY, UPPER_LIMIT_KEY\n} from '../../constantsCommon';\nimport {\n AestheticMappingState,\n DEFAULT_DOT_SHAPE,\n DEFAULT_DOT_SIZE,\n DEFAULT_LINE_WIDTH,\n getScatterplotAes\n} from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromForms, getScatterplotLayersSettings } from '../index';\n\nexport function applyChartInfoFromAnnotations (\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n x: ComponentStateSimple | ComponentStateFilter,\n y: ComponentStateSimple | ComponentStateFilter,\n inputGuide: InputGuide<InputState>\n) {\n const groupingSource = grouping.selectorStates[0]?.selectedSource;\n const xSource = x.selectorStates[0]?.selectedSource;\n const ySource = y.selectorStates[0]?.selectedSource;\n const xInfo = inputGuide.getSourceInfo(xSource);\n const yInfo = inputGuide.getSourceInfo(ySource);\n\n settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\n\n if (grouping.selectorStates.length) {\n const annotations = inputGuide.getSourceInfo(groupingSource).annotations;\n if (annotations?.[THRESHOLDS_KEY]) {\n const thresholdsData = JSON.parse(annotations[THRESHOLDS_KEY]) ?? [];\n\n thresholdsData.forEach((thresholdData: { columnId: Record<string, string>, value: number }) => {\n const { columnId, value } = thresholdData;\n if (columnId && (xInfo.kind === 'column' && xInfo.type === columnId.valueType && xInfo.name === columnId.name)) {\n if (!settings.xAxis!.significantLines) {\n settings.xAxis!.significantLines = [];\n }\n settings.xAxis!.significantLines.push(Number(value));\n }\n\n if (columnId && (yInfo.kind === 'column' && yInfo.type === columnId.valueType && yInfo.name === columnId.name)) {\n if (!settings.yAxis!.significantLines) {\n settings.yAxis!.significantLines = [];\n }\n settings.yAxis!.significantLines.push(Number(value));\n }\n });\n }\n\n if (annotations?.[PALETTE_KEY]) {\n const paletteData = JSON.parse(annotations[PALETTE_KEY]);\n const { mapping = {}, name = '' } = paletteData;\n settings.layers.forEach(layer => {\n if (layer.type === 'dots') {\n if (!layer.aes) {\n layer.aes = {};\n }\n layer.aes.dotFill = { type: 'grouping', value: groupingSource };\n }\n });\n const paletteEntries = [...Object.entries(mapping), ['null', UNKNOWN_COLOR]];\n const paletteColors = PALETTE_MAP[name as keyof typeof PALETTE_MAP]?.colors ?? [];\n\n settings.grouping?.forEach((groupingElement) => {\n if (groupingElement.columnName.value === groupingSource) {\n groupingElement.inheritedAes = paletteEntries.reduce((res: Record<string, any>, [key, value]) => {\n const color = paletteColors[Number(value)] ?? DEFAULT_BLACK;\n res[key] = {\n fillColor: color,\n lineColor: color,\n dotFill: color,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n lineWidth: DEFAULT_LINE_WIDTH\n };\n return res;\n }, {})\n }\n })\n }\n }\n if (xInfo.annotations) {\n if (xInfo.annotations[UPPER_LIMIT_KEY]) {\n settings.xAxis!.upperValue = Number(xInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (xInfo.annotations[LOWER_LIMIT_KEY]) {\n settings.xAxis!.lowerValue = Number(xInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (xInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n settings.xAxis!.symmetricRange = Number(xInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n\n if (yInfo.annotations) {\n if (yInfo.annotations[UPPER_LIMIT_KEY]) {\n settings.yAxis!.upperValue = Number(yInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (yInfo.annotations[LOWER_LIMIT_KEY]) {\n settings.yAxis!.lowerValue = Number(yInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (yInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n settings.yAxis!.symmetricRange = Number(yInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n}\n\nexport function applyInheritedAes(\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n shape: ComponentStateSimple | ComponentStateFilter | undefined,\n uniqueValuesData: UniqueValuesBySourceMap,\n dataBindAes: AestheticMappingState\n) {\n if (grouping.selectorStates.length || shape?.selectorStates.length) {\n settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\n settings.grouping.forEach((el) => {\n const selectedSource = el.columnName.value;\n const savedData = getScatterplotAes(selectedSource, uniqueValuesData, dataBindAes); // get saved or default color or shape mapping\n // if mapping exists but doesn't have saved order and value-color pairs - add just colors list to chart settings, chart will use it\n if (!savedData.order.length) {\n settings.layers.forEach(layer=> {\n const layerAes = layer.aes;\n if (!layerAes) {\n return;\n }\n const aesKeys = Object.keys(layerAes);\n aesKeys.forEach((aesKey) => {\n const value = layerAes[aesKey as keyof typeof layerAes] as unknown;\n if (isMappedAes(value) && value.value === selectedSource) {\n const colors = PALETTE_MAP[dataBindAes[selectedSource]?.palette ?? DEFAULT_CATEGORICAL_PALETTE]?.colors ?? [];\n (value as MappingLink & {palette: string[]}).palette = colors;\n }\n })\n })\n } else {\n el.order = savedData.order;\n el.inheritedAes = savedData.inheritedAes;\n }\n });\n }\n}\nexport function composeScatterplotSettings(\n settings: ScatterplotSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping?.map(v => v.columnName)\n );\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.shape,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n const statisticsSettings = reactiveState.statisticsSettings as ScatterplotStatisticsState;\n const dotsLayer = settings.layers.find(layer => layer.type === 'dots');\n if (statisticsSettings.trend.on && dotsLayer) {\n settings.trend = {\n color: dotsLayer.aes?.dotFill,\n bounded: false\n };\n }\n\n Object.assign(\n settings,\n getAxesDataFromForms(reactiveState.axesSettings, reactiveState.chartType)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n return settings;\n}"],"names":["applyChartInfoFromAnnotations","settings","grouping","x","y","inputGuide","groupingSource","_a","xSource","_b","ySource","_c","xInfo","yInfo","v","annotations","THRESHOLDS_KEY","thresholdData","columnId","value","PALETTE_KEY","paletteData","mapping","name","layer","paletteEntries","UNKNOWN_COLOR","paletteColors","_d","PALETTE_MAP","_e","groupingElement","res","key","color","DEFAULT_BLACK","DEFAULT_DOT_SHAPE","DEFAULT_DOT_SIZE","DEFAULT_LINE_WIDTH","UPPER_LIMIT_KEY","LOWER_LIMIT_KEY","SYMMETRIC_RANGE_KEY","applyInheritedAes","shape","uniqueValuesData","dataBindAes","el","selectedSource","savedData","getScatterplotAes","layerAes","aesKey","isMappedAes","colors","DEFAULT_CATEGORICAL_PALETTE","composeScatterplotSettings","dataByColumns","reactiveState","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","statisticsSettings","dotsLayer","getAxesDataFromForms"],"mappings":";;;;;;;AAqCO,SAASA,EACdC,GACAC,GACAC,GACAC,GACAC,GACA;;AACA,QAAMC,KAAiBC,IAAAL,EAAS,eAAe,CAAC,MAAzB,gBAAAK,EAA4B,gBAC7CC,KAAUC,IAAAN,EAAE,eAAe,CAAC,MAAlB,gBAAAM,EAAqB,gBAC/BC,KAAUC,IAAAP,EAAE,eAAe,CAAC,MAAlB,gBAAAO,EAAqB,gBAC/BC,IAAQP,EAAW,cAAcG,CAAO,GACxCK,IAAQR,EAAW,cAAcK,CAAO;AAI9C,MAFAT,EAAS,WAAW,CAAC,GAAIA,EAAS,YAAY,CAAA,CAAG,EAAE,IAAI,CAAAa,OAAM,EAAC,GAAGA,IAAG,GAEhEZ,EAAS,eAAe,QAAQ;AAClC,UAAMa,IAAcV,EAAW,cAAcC,CAAc,EAAE;AAsB7D,QArBIS,KAAA,QAAAA,EAAcC,OACO,KAAK,MAAMD,EAAYC,CAAc,CAAC,KAAK,CAAA,GAEnD,QAAQ,CAACC,MAAuE;AAC7F,YAAM,EAAE,UAAAC,GAAU,OAAAC,EAAA,IAAUF;AAC5B,MAAIC,KAAaN,EAAM,SAAS,YAAYA,EAAM,SAASM,EAAS,aAAaN,EAAM,SAASM,EAAS,SAClGjB,EAAS,MAAO,qBACnBA,EAAS,MAAO,mBAAmB,CAAA,IAErCA,EAAS,MAAO,iBAAiB,KAAK,OAAOkB,CAAK,CAAC,IAGjDD,KAAaL,EAAM,SAAS,YAAYA,EAAM,SAASK,EAAS,aAAaL,EAAM,SAASK,EAAS,SAClGjB,EAAS,MAAO,qBACnBA,EAAS,MAAO,mBAAmB,CAAA,IAErCA,EAA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AAAA,IACH,CAAC;AAAA,EAKL,CAAC;AAEL;AACO,SAASE,EACdtD,GACAuD,GACAC,GACApD,GACAuC,GACA;;AACA,EAAA3C,EAAS,SAASyD;AAAA,IAChBC,EAA0BF,EAAc,QAAqC;AAAA,IAC7EA,EAAc;AAAA,IACdD;AAAA,IACAC,EAAc;AAAA,IACdA,EAAc;AAAA,IACdpD;AAAA,KACAE,IAAAN,KAAA,gBAAAA,EAAU,aAAV,gBAAAM,EAAoB,IAAI,CAAAO,MAAKA,EAAE;AAAA,EAAU,GAG3C4B;AAAA,IACEzC;AAAA,IACAwD,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCb;AAAA,IACAa,EAAc;AAAA,EAAA;AAGhB,QAAMG,IAAqBH,EAAc,oBACnCI,IAAY5D,EAAS,OAAO,KAAK,CAAAuB,MAASA,EAAM,SAAS,MAAM;AACrE,SAAIoC,EAAmB,MAAM,MAAMC,MACjC5D,EAAS,QAAQ;AAAA,IACf,QAAOQ,IAAAoD,EAAU,QAAV,gBAAApD,EAAe;AAAA,IACtB,SAAS;AAAA,EAAA,IAIb,OAAO;AAAA,IACLR;AAAA,IACA6D,EAAqBL,EAAc,cAAcA,EAAc,SAAS;AAAA,EAAA,GAG1EzD;AAAA,IACEC;AAAA,IACAwD,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCpD;AAAA,EAAA,GAGKJ;AACT;"}
|
|
1
|
+
{"version":3,"file":"composeScatterplotSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.ts"],"sourcesContent":["import { ScatterplotSettings, ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport {\n ComponentStateFilter,\n ComponentStateSimple,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n ScatterplotUIState\n} from '@milaboratories/pf-plots';\nimport {\n DEFAULT_BLACK,\n DEFAULT_CATEGORICAL_PALETTE,\n PALETTE_MAP,\n UNKNOWN_COLOR\n} from '../../constantsAesthetic';\nimport {\n isMappedAes,\n LOWER_LIMIT_KEY, MappingLink,\n PALETTE_KEY,\n SCATTERPLOT_TEMPLATES_MAP,\n ScatterplotStatisticsState, SYMMETRIC_RANGE_KEY,\n THRESHOLDS_KEY, UPPER_LIMIT_KEY\n} from '../../constantsCommon';\nimport {\n AestheticMappingState,\n DEFAULT_DOT_SHAPE,\n DEFAULT_DOT_SIZE,\n DEFAULT_LINE_WIDTH,\n getScatterplotAes\n} from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromForms, getAxesDataFromFormsScatterplot, getScatterplotLayersSettings } from '../index';\nimport { AxisSettingsContinuous } from '@milaboratories/miplots4';\n\nexport function applyChartInfoFromAnnotations (\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n x: ComponentStateSimple | ComponentStateFilter,\n y: ComponentStateSimple | ComponentStateFilter,\n inputGuide: InputGuide<InputState>\n) {\n const groupingSource = grouping.selectorStates[0]?.selectedSource;\n const xSource = x.selectorStates[0]?.selectedSource;\n const ySource = y.selectorStates[0]?.selectedSource;\n const xInfo = inputGuide.getSourceInfo(xSource);\n const yInfo = inputGuide.getSourceInfo(ySource);\n\n settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\n\n const xAxis = settings.xAxis as AxisSettingsContinuous;\n const yAxis = settings.yAxis as AxisSettingsContinuous;\n if (grouping.selectorStates.length) {\n const annotations = inputGuide.getSourceInfo(groupingSource).annotations;\n if (annotations?.[THRESHOLDS_KEY]) {\n const thresholdsData = JSON.parse(annotations[THRESHOLDS_KEY]) ?? [];\n\n thresholdsData.forEach((thresholdData: { columnId: Record<string, string>, value: number }) => {\n const { columnId, value } = thresholdData;\n if (columnId && (xInfo.kind === 'column' && xInfo.type === columnId.valueType && xInfo.name === columnId.name && settings.xAxis?.scale === 'discrete')) {\n if (!xAxis.significantLines) {\n xAxis.significantLines = [];\n }\n xAxis.significantLines.push(Number(value));\n }\n\n if (columnId && (yInfo.kind === 'column' && yInfo.type === columnId.valueType && yInfo.name === columnId.name)) {\n if (!yAxis.significantLines) {\n yAxis.significantLines = [];\n }\n yAxis.significantLines.push(Number(value));\n }\n });\n }\n\n if (annotations?.[PALETTE_KEY]) {\n const paletteData = JSON.parse(annotations[PALETTE_KEY]);\n const { mapping = {}, name = '' } = paletteData;\n settings.layers.forEach(layer => {\n if (layer.type === 'dots') {\n if (!layer.aes) {\n layer.aes = {};\n }\n layer.aes.dotFill = { type: 'grouping', value: groupingSource };\n }\n });\n const paletteEntries = [...Object.entries(mapping), ['null', UNKNOWN_COLOR]];\n const paletteColors = PALETTE_MAP[name as keyof typeof PALETTE_MAP]?.colors ?? [];\n\n settings.grouping?.forEach((groupingElement) => {\n if (groupingElement.columnName.value === groupingSource) {\n groupingElement.inheritedAes = paletteEntries.reduce((res: Record<string, any>, [key, value]) => {\n const color = paletteColors[Number(value)] ?? DEFAULT_BLACK;\n res[key] = {\n fillColor: color,\n lineColor: color,\n dotFill: color,\n dotShape: DEFAULT_DOT_SHAPE,\n dotSize: DEFAULT_DOT_SIZE,\n lineWidth: DEFAULT_LINE_WIDTH\n };\n return res;\n }, {})\n }\n })\n }\n }\n if (xInfo.annotations) {\n if (xInfo.annotations[UPPER_LIMIT_KEY]) {\n xAxis!.upperValue = Number(xInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (xInfo.annotations[LOWER_LIMIT_KEY]) {\n xAxis!.lowerValue = Number(xInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (xInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n xAxis!.symmetricRange = Number(xInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n\n if (yInfo.annotations) {\n if (yInfo.annotations[UPPER_LIMIT_KEY]) {\n yAxis!.upperValue = Number(yInfo.annotations[UPPER_LIMIT_KEY]);\n }\n if (yInfo.annotations[LOWER_LIMIT_KEY]) {\n yAxis!.lowerValue = Number(yInfo.annotations[LOWER_LIMIT_KEY]);\n }\n if (yInfo.annotations[SYMMETRIC_RANGE_KEY]) {\n yAxis!.symmetricRange = Number(yInfo.annotations[SYMMETRIC_RANGE_KEY]);\n }\n }\n}\n\nexport function applyInheritedAes(\n settings: ScatterplotSettings | ScatterplotUmapSettings,\n grouping: ComponentStateSimple | ComponentStateFilter,\n shape: ComponentStateSimple | ComponentStateFilter | undefined,\n uniqueValuesData: UniqueValuesBySourceMap,\n dataBindAes: AestheticMappingState\n) {\n if (grouping.selectorStates.length || shape?.selectorStates.length) {\n settings.grouping = [...(settings.grouping ?? [])].map(v => ({...v}));\n settings.grouping.forEach((el) => {\n const selectedSource = el.columnName.value;\n const savedData = getScatterplotAes(selectedSource, uniqueValuesData, dataBindAes); // get saved or default color or shape mapping\n // if mapping exists but doesn't have saved order and value-color pairs - add just colors list to chart settings, chart will use it\n if (!savedData.order.length) {\n settings.layers.forEach(layer=> {\n const layerAes = layer.aes;\n if (!layerAes) {\n return;\n }\n const aesKeys = Object.keys(layerAes);\n aesKeys.forEach((aesKey) => {\n const value = layerAes[aesKey as keyof typeof layerAes] as unknown;\n if (isMappedAes(value) && value.value === selectedSource) {\n const colors = PALETTE_MAP[dataBindAes[selectedSource]?.palette ?? DEFAULT_CATEGORICAL_PALETTE]?.colors ?? [];\n (value as MappingLink & {palette: string[]}).palette = colors;\n }\n })\n })\n } else {\n el.order = savedData.order;\n el.inheritedAes = savedData.inheritedAes;\n }\n });\n }\n}\nexport function composeScatterplotSettings(\n settings: ScatterplotSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping?.map(v => v.columnName)\n );\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.shape,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n const statisticsSettings = reactiveState.statisticsSettings as ScatterplotStatisticsState;\n const dotsLayer = settings.layers.find(layer => layer.type === 'dots');\n if (statisticsSettings.trend.on && dotsLayer) {\n settings.trend = {\n color: dotsLayer.aes?.dotFill,\n bounded: false\n };\n }\n\n Object.assign(\n settings,\n getAxesDataFromFormsScatterplot(reactiveState.axesSettings, uniqueValuesData, reactiveState.optionsState, inputGuide)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n return settings;\n}"],"names":["applyChartInfoFromAnnotations","settings","grouping","x","y","inputGuide","groupingSource","_a","xSource","_b","ySource","_c","xInfo","yInfo","v","xAxis","yAxis","annotations","THRESHOLDS_KEY","thresholdData","columnId","value","PALETTE_KEY","paletteData","mapping","name","layer","paletteEntries","UNKNOWN_COLOR","paletteColors","_d","PALETTE_MAP","_e","groupingElement","res","key","color","DEFAULT_BLACK","DEFAULT_DOT_SHAPE","DEFAULT_DOT_SIZE","DEFAULT_LINE_WIDTH","UPPER_LIMIT_KEY","LOWER_LIMIT_KEY","SYMMETRIC_RANGE_KEY","applyInheritedAes","shape","uniqueValuesData","dataBindAes","el","selectedSource","savedData","getScatterplotAes","layerAes","aesKey","isMappedAes","colors","DEFAULT_CATEGORICAL_PALETTE","composeScatterplotSettings","dataByColumns","reactiveState","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","statisticsSettings","dotsLayer","getAxesDataFromFormsScatterplot"],"mappings":";;;;;;;AAsCO,SAASA,EACdC,GACAC,GACAC,GACAC,GACAC,GACA;;AACA,QAAMC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AAA,gBAAAA,EAAU,aAAV,gBAAAM,EAAoB,IAAI,CAAAO,MAAKA,EAAE;AAAA,EAAU,GAG3C8B;AAAA,IACE3C;AAAA,IACA0D,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCb;AAAA,IACAa,EAAc;AAAA,EAAA;AAGhB,QAAMG,IAAqBH,EAAc,oBACnCI,IAAY9D,EAAS,OAAO,KAAK,CAAAyB,MAASA,EAAM,SAAS,MAAM;AACrE,SAAIoC,EAAmB,MAAM,MAAMC,MACjC9D,EAAS,QAAQ;AAAA,IACf,QAAOQ,IAAAsD,EAAU,QAAV,gBAAAtD,EAAe;AAAA,IACtB,SAAS;AAAA,EAAA,IAIb,OAAO;AAAA,IACLR;AAAA,IACA+D,EAAgCL,EAAc,cAAcb,GAAkBa,EAAc,cAActD,CAAU;AAAA,EAAA,GAGtHL;AAAA,IACEC;AAAA,IACA0D,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCtD;AAAA,EAAA,GAGKJ;AACT;"}
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
6
6
|
title: {
|
|
7
7
|
name: string;
|
|
8
8
|
show?: boolean | undefined;
|
|
9
|
-
position?: "
|
|
9
|
+
position?: "center" | "left" | "right" | undefined;
|
|
10
10
|
};
|
|
11
11
|
x: {
|
|
12
12
|
type: "column";
|
|
@@ -149,15 +149,12 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
149
149
|
} | undefined;
|
|
150
150
|
scale?: "linear" | "log" | undefined;
|
|
151
151
|
showGrid?: boolean | undefined;
|
|
152
|
-
linesBetweenCategories?: boolean | undefined;
|
|
153
152
|
showTicks?: boolean | undefined;
|
|
154
|
-
labelsPosition?: "center" | "45deg" | "90deg" | undefined;
|
|
155
153
|
significantLines?: number[] | undefined;
|
|
156
154
|
significantLinesStyle?: "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash" | undefined;
|
|
157
155
|
symmetricRange?: number | undefined;
|
|
158
156
|
upperValue?: number | undefined;
|
|
159
157
|
lowerValue?: number | undefined;
|
|
160
|
-
hiddenLabels?: boolean | undefined;
|
|
161
158
|
} | undefined;
|
|
162
159
|
yAxis?: {
|
|
163
160
|
title?: string | {
|
|
@@ -169,15 +166,12 @@ export declare function composeScatterplotUmapSettings(settings: ScatterplotUmap
|
|
|
169
166
|
} | undefined;
|
|
170
167
|
scale?: "linear" | "log" | undefined;
|
|
171
168
|
showGrid?: boolean | undefined;
|
|
172
|
-
linesBetweenCategories?: boolean | undefined;
|
|
173
169
|
showTicks?: boolean | undefined;
|
|
174
|
-
labelsPosition?: "center" | "45deg" | "90deg" | undefined;
|
|
175
170
|
significantLines?: number[] | undefined;
|
|
176
171
|
significantLinesStyle?: "solid" | "dashed" | "dotted" | "dotdash" | "longdash" | "twodash" | undefined;
|
|
177
172
|
symmetricRange?: number | undefined;
|
|
178
173
|
upperValue?: number | undefined;
|
|
179
174
|
lowerValue?: number | undefined;
|
|
180
|
-
hiddenLabels?: boolean | undefined;
|
|
181
175
|
} | undefined;
|
|
182
176
|
highlight?: {
|
|
183
177
|
type: "column";
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScatterplotUmapSettings.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAG3G,OAAO,EACL,aAAa,EAEb,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAOrB,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,uBAAuB,EACjC,aAAa,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EACvD,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,gBAAgB,EAAE,uBAAuB;;;;
|
|
1
|
+
{"version":3,"file":"composeScatterplotUmapSettings.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAG3G,OAAO,EACL,aAAa,EAEb,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAOrB,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,uBAAuB,EACjC,aAAa,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EACvD,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,gBAAgB,EAAE,uBAAuB;;;;YAwC4p7D,CAAC;gBAAuC,CAAC;;;;;cAAwH,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;;;;cAAmG,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;;;WAA6E,CAAC;mBAAuB,CAAC;;;;0BAA4I,CAAC;yBAA+C,CAAC;+BAAqD,CAAC;;;;oBAAgI,CAAC;;;;uBAA0I,CAAC;;oBAAuE,CAAC;;;uBAAiQ,CAAC;;mBAAsE,CAAC;;;;0BAA4I,CAAC;yBAA+C,CAAC;+BAAqD,CAAC;;;;oBAAgI,CAAC;;;;;WAA8H,CAAC;qBAAyB,CAAC;qBAA2C,CAAC;qBAAuG,CAAC;;;;0BAA4I,CAAC;yBAA+C,CAAC;+BAAqD,CAAC;;;;oBAAgI,CAAC;;;;uBAA0I,CAAC;;mBAAsE,CAAC;;iBAA8D,CAAC;;;aAA2D,CAAC;cAAoC,CAAC;;;;;cAAoH,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;;;;;kBAAyJ,CAAC;iBAAuC,CAAC;uBAA6C,CAAC;;aAA8C,CAAC;oBAA8D,CAAC;mBAAsC,CAAC;oBAA0C,CAAC;mBAAqM,CAAC;qBAA2C,CAAC;qBAA2C,CAAC;qBAAuG,CAAC;qBAA2C,CAAC;;sBAAoE,CAAC;;;YAAuE,CAAC;gBAAuC,CAAC;;;YAAqG,CAAC;eAAsC,CAAC;;;kBAA6E,CAAC;iBAAuC,CAAC;uBAA6C,CAAC;;;;YAA4F,CAAC;;;;;cAAsK,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;;aAAoE,CAAC;;;kBAAsF,CAAC;iBAAuC,CAAC;uBAA6C,CAAC;;aAA0D,CAAC;gBAAgD,CAAC;iBAAwC,CAAC;wBAA+C,CAAC;6BAAqD,CAAC;sBAAwG,CAAC;kBAAwC,CAAC;kBAAwC,CAAC;;;aAAoE,CAAC;;;kBAAsF,CAAC;iBAAuC,CAAC;uBAA6C,CAAC;;aAA0D,CAAC;gBAAgD,CAAC;iBAAwC,CAAC;wBAA+C,CAAC;6BAAqD,CAAC;sBAAwG,CAAC;kBAAwC,CAAC;kBAAwC,CAAC;;;;;cAAwH,CAAC;aAAmC,CAAC;mBAAyC,CAAC;;EAAz1nE"}
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { SCATTERPLOT_TEMPLATES_MAP as _ } from "../../constantsCommon.js";
|
|
2
2
|
import { DEFAULT_DOT_SIZE_CANVAS as l } from "../../dataBindAes.js";
|
|
3
3
|
import { getScatterplotLayersSettings as E } from "./getLayersDataFromForms.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getAxesDataFromFormsScatterplot as s } from "./getAxesDataFromForms.js";
|
|
5
5
|
import "../../../node_modules/@milaboratories/pf-plots/dist/index.js";
|
|
6
6
|
import "vue";
|
|
7
7
|
import "../../constantsAesthetic.js";
|
|
8
|
-
import { applyInheritedAes as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
var
|
|
8
|
+
import { applyInheritedAes as t, applyChartInfoFromAnnotations as S } from "./composeScatterplotSettings.js";
|
|
9
|
+
const L = 750, f = 450;
|
|
10
|
+
function C(p, A, o, m, n) {
|
|
11
|
+
var r;
|
|
12
12
|
return p.layers = E(
|
|
13
13
|
_[o.template],
|
|
14
14
|
o.layersSettings,
|
|
15
|
-
|
|
15
|
+
A,
|
|
16
16
|
o.optionsState,
|
|
17
17
|
o.dataBindAes,
|
|
18
18
|
m,
|
|
19
|
-
(
|
|
19
|
+
(r = p == null ? void 0 : p.grouping) == null ? void 0 : r.map((T) => T.columnName),
|
|
20
20
|
l
|
|
21
|
-
),
|
|
21
|
+
), t(
|
|
22
22
|
p,
|
|
23
23
|
o.optionsState.components.grouping,
|
|
24
24
|
void 0,
|
|
25
|
-
|
|
25
|
+
n,
|
|
26
26
|
o.dataBindAes
|
|
27
27
|
), Object.assign(
|
|
28
28
|
p,
|
|
29
|
-
s(o.axesSettings, o.
|
|
30
|
-
),
|
|
29
|
+
s(o.axesSettings, n, o.optionsState, m)
|
|
30
|
+
), S(
|
|
31
31
|
p,
|
|
32
32
|
o.optionsState.components.grouping,
|
|
33
33
|
o.optionsState.components.x,
|
|
34
34
|
o.optionsState.components.y,
|
|
35
35
|
m
|
|
36
36
|
), p.size = {
|
|
37
|
-
width:
|
|
37
|
+
width: L * o.chartScale / 100,
|
|
38
38
|
height: f * o.chartScale / 100
|
|
39
39
|
}, p;
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
C as composeScatterplotUmapSettings
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=composeScatterplotUmapSettings.js.map
|
package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScatterplotUmapSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"sourcesContent":["import { ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport { InputGuide, InputState, PlotDataAndSettings, ScatterplotUIState } from '@milaboratories/pf-plots';\nimport { SCATTERPLOT_TEMPLATES_MAP } from '../../constantsCommon';\nimport { DEFAULT_DOT_SIZE_CANVAS } from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport {
|
|
1
|
+
{"version":3,"file":"composeScatterplotUmapSettings.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.ts"],"sourcesContent":["import { ScatterplotUmapSettings } from '@milaboratories/miplots4';\nimport { InputGuide, InputState, PlotDataAndSettings, ScatterplotUIState } from '@milaboratories/pf-plots';\nimport { SCATTERPLOT_TEMPLATES_MAP } from '../../constantsCommon';\nimport { DEFAULT_DOT_SIZE_CANVAS } from '../../dataBindAes';\nimport {\n ReactiveState,\n ScatterplotLayersTemplate,\n UniqueValuesBySourceMap\n} from '../../types';\nimport { getAxesDataFromFormsScatterplot, getScatterplotLayersSettings } from '../index';\nimport { applyChartInfoFromAnnotations, applyInheritedAes } from './composeScatterplotSettings';\n\nconst DEFAULT_WIDTH_SCATTERPLOT_UMAP = 750;\nconst DEFAULT_HEIGHT_SCATTERPLOT_UMAP = 450;\n\nexport function composeScatterplotUmapSettings(\n settings: ScatterplotUmapSettings,\n dataByColumns: PlotDataAndSettings['data']['byColumns'],\n reactiveState: ReactiveState,\n inputGuide: InputGuide<InputState>,\n uniqueValuesData: UniqueValuesBySourceMap\n) {\n settings.layers = getScatterplotLayersSettings(\n SCATTERPLOT_TEMPLATES_MAP[reactiveState.template as ScatterplotLayersTemplate],\n reactiveState.layersSettings,\n dataByColumns,\n reactiveState.optionsState as ScatterplotUIState,\n reactiveState.dataBindAes,\n inputGuide,\n settings?.grouping?.map(v => v.columnName),\n DEFAULT_DOT_SIZE_CANVAS\n ) as ScatterplotUmapSettings['layers'];\n\n applyInheritedAes(\n settings,\n reactiveState.optionsState.components.grouping,\n undefined,\n uniqueValuesData,\n reactiveState.dataBindAes\n );\n\n Object.assign(\n settings,\n getAxesDataFromFormsScatterplot(reactiveState.axesSettings, uniqueValuesData, reactiveState.optionsState, inputGuide)\n );\n\n applyChartInfoFromAnnotations(\n settings,\n reactiveState.optionsState.components.grouping,\n reactiveState.optionsState.components.x,\n reactiveState.optionsState.components.y,\n inputGuide\n );\n\n settings.size = {\n width: DEFAULT_WIDTH_SCATTERPLOT_UMAP * reactiveState.chartScale / 100,\n height: DEFAULT_HEIGHT_SCATTERPLOT_UMAP * reactiveState.chartScale / 100\n }\n\n return settings;\n}"],"names":["DEFAULT_WIDTH_SCATTERPLOT_UMAP","DEFAULT_HEIGHT_SCATTERPLOT_UMAP","composeScatterplotUmapSettings","settings","dataByColumns","reactiveState","inputGuide","uniqueValuesData","getScatterplotLayersSettings","SCATTERPLOT_TEMPLATES_MAP","_a","v","DEFAULT_DOT_SIZE_CANVAS","applyInheritedAes","getAxesDataFromFormsScatterplot","applyChartInfoFromAnnotations"],"mappings":";;;;;;;;AAYA,MAAMA,IAAiC,KACjCC,IAAkC;AAEjC,SAASC,EACdC,GACAC,GACAC,GACAC,GACAC,GACA;;AACA,SAAAJ,EAAS,SAASK;AAAA,IAChBC,EAA0BJ,EAAc,QAAqC;AAAA,IAC7EA,EAAc;AAAA,IACdD;AAAA,IACAC,EAAc;AAAA,IACdA,EAAc;AAAA,IACdC;AAAA,KACAI,IAAAP,KAAA,gBAAAA,EAAU,aAAV,gBAAAO,EAAoB,IAAI,CAAAC,MAAKA,EAAE;AAAA,IAC/BC;AAAA,EAAA,GAGFC;AAAA,IACEV;AAAA,IACAE,EAAc,aAAa,WAAW;AAAA,IACtC;AAAA,IACAE;AAAA,IACAF,EAAc;AAAA,EAAA,GAGhB,OAAO;AAAA,IACLF;AAAA,IACAW,EAAgCT,EAAc,cAAcE,GAAkBF,EAAc,cAAcC,CAAU;AAAA,EAAA,GAGtHS;AAAA,IACEZ;AAAA,IACAE,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCA,EAAc,aAAa,WAAW;AAAA,IACtCC;AAAA,EAAA,GAGFH,EAAS,OAAO;AAAA,IACd,OAAOH,IAAiCK,EAAc,aAAa;AAAA,IACnE,QAAQJ,IAAkCI,EAAc,aAAa;AAAA,EAAA,GAGhEF;AACT;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AxesState } from '../../constantsCommon';
|
|
2
|
-
import { ChartType } from '@milaboratories/pf-plots';
|
|
3
|
-
import { LabelsRotation, UniqueValuesData } from '../../types';
|
|
2
|
+
import { ChartType, InputGuide, InputState } from '@milaboratories/pf-plots';
|
|
3
|
+
import { LabelsRotation, ReactiveState, UniqueValuesBySourceMap, UniqueValuesData } from '../../types';
|
|
4
|
+
import { AxisSettingsContinuous, AxisSettingsDiscrete, HeatmapSettings } from '@milaboratories/miplots4';
|
|
4
5
|
type AxesSettings = {
|
|
5
|
-
xAxis:
|
|
6
|
-
yAxis:
|
|
6
|
+
xAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['xAxis'];
|
|
7
|
+
yAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['yAxis'];
|
|
7
8
|
frame: {
|
|
8
9
|
type: string;
|
|
9
10
|
};
|
|
@@ -18,6 +19,7 @@ type AxesSettings = {
|
|
|
18
19
|
groupingStack?: AxesState['other']['groupingStack'];
|
|
19
20
|
};
|
|
20
21
|
export declare function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups?: UniqueValuesData['options']): LabelsRotation;
|
|
22
|
+
export declare function getAxesDataFromFormsScatterplot(axesFormsData: AxesState, uniqueValues: UniqueValuesBySourceMap, optionsState: ReactiveState['optionsState'], inputGuide: InputGuide<InputState>): AxesSettings;
|
|
21
23
|
export declare function getAxesDataFromForms(axesFormsData: AxesState, chartType: ChartType, discreteGroups?: UniqueValuesData['options']): AxesSettings;
|
|
22
24
|
export {};
|
|
23
25
|
//# sourceMappingURL=getAxesDataFromForms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAxesDataFromForms.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getAxesDataFromForms.d.ts","sourceRoot":"","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,oBAAoB,GAAG,sBAAsB,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAChF,KAAK,EAAE,oBAAoB,GAAG,sBAAsB,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAChF,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAC;IACF,iBAAiB,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC;IAC5D,aAAa,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC;CACrD,CAAA;AAKD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,EAAE,cAAc,GAAE,gBAAgB,CAAC,SAAS,CAAM,kBAWvH;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,SAAS,EACxB,YAAY,EAAE,uBAAuB,EACrC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,EAC3C,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,GACjC,YAAY,CAmFd;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,GAAE,gBAAgB,CAAC,SAAS,CAAM,GAAG,YAAY,CAkDnJ"}
|
|
@@ -1,21 +1,50 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function E(e, l = []) {
|
|
2
|
+
return e !== null ? e : l.length > 6 && l.some(({ label: c }) => c.length > 5) ? "45deg" : "center";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
function H(e, l, c, n) {
|
|
5
|
+
var y, p, k, x, M, _, T, w, C, R, B, O;
|
|
6
|
+
let i = {}, t = {};
|
|
7
|
+
i.showGrid = e.axisX.gridlines, i.showTicks = e.axisX.ticks, t.showGrid = e.axisY.gridlines, t.showTicks = e.axisY.ticks;
|
|
8
|
+
const o = ((y = c.components.x.selectorStates) == null ? void 0 : y[0].selectedSource) ?? null, g = ((p = c.components.y.selectorStates) == null ? void 0 : p[0].selectedSource) ?? null, b = o ? n.getSourceInfo(o) : null, h = g ? n.getSourceInfo(g) : null, A = (b == null ? void 0 : b.type) === "String", Y = (h == null ? void 0 : h.type) === "String";
|
|
9
|
+
if (console.log("isDiscreteX", A, b), console.log("isDiscreteY", Y, h), A) {
|
|
10
|
+
i = i, i.scale = "discrete", i.labelsPosition = e.axisX.labelsRotation ?? "center";
|
|
11
|
+
const u = ((k = e.axisX.order) == null ? void 0 : k.source) === o, r = (x = l[o]) == null ? void 0 : x.list, d = (M = l[o]) == null ? void 0 : M.labels, f = u ? ((_ = e.axisX.order) == null ? void 0 : _.options.map((s) => s.value)) ?? r : r, S = u ? ((T = e.axisX.order) == null ? void 0 : T.options.reduce((s, X) => (s[X.value] = X.label, s), {})) ?? d : d;
|
|
12
|
+
f && S && (i.keys = f, i.labels = S);
|
|
13
|
+
} else
|
|
14
|
+
i = i, i.scale = e.axisX.scale, i.significantLinesStyle = e.axisX.significantLinesStyle;
|
|
15
|
+
if (Y) {
|
|
16
|
+
t = t, t.scale = "discrete", t.labelsPosition = e.axisY.labelsRotation ?? "center";
|
|
17
|
+
const u = (w = l[g]) == null ? void 0 : w.list, r = (C = l[g]) == null ? void 0 : C.labels, d = ((R = e.axisY.order) == null ? void 0 : R.source) === g, f = d ? ((B = e.axisY.order) == null ? void 0 : B.options.map((s) => s.value)) ?? u : u, S = d ? ((O = e.axisY.order) == null ? void 0 : O.options.reduce((s, X) => (s[X.value] = X.label, s), {})) ?? r : r;
|
|
18
|
+
f && S && (t.keys = f, t.labels = S);
|
|
19
|
+
} else
|
|
20
|
+
t = t, t.scale = e.axisY.scale, t.significantLinesStyle = e.axisY.significantLinesStyle;
|
|
21
|
+
e.axisY.titleMode !== "auto" && (t.title = e.axisY.titleMode === "custom" ? e.axisY.customTitle : ""), e.axisX.titleMode !== "auto" && (i.title = e.axisX.titleMode === "custom" ? e.axisX.customTitle : "");
|
|
22
|
+
const L = {
|
|
23
|
+
xAxis: i,
|
|
24
|
+
yAxis: t,
|
|
25
|
+
frame: { type: e.other.frame },
|
|
11
26
|
facetSettings: {
|
|
12
|
-
nCols:
|
|
27
|
+
nCols: e.other.facetColumns
|
|
13
28
|
}
|
|
14
29
|
};
|
|
15
|
-
return
|
|
30
|
+
return L.facetSettings.sharedX = ["x", "xy"].includes(e.other.facetSharedBy), L.facetSettings.sharedY = ["y", "xy"].includes(e.other.facetSharedBy), L;
|
|
31
|
+
}
|
|
32
|
+
function N(e, l, c = []) {
|
|
33
|
+
let n = {}, i = {};
|
|
34
|
+
l === "discrete" && (n.labelsPosition = E(e.axisX.labelsRotation, c), n.linesBetweenCategories = e.axisX.linesBetweenCategories, i.scale = e.axisY.scale, n.showGrid = e.axisX.gridlines, n.showTicks = e.axisX.ticks, i.showGrid = e.axisY.gridlines, i.showTicks = e.axisY.ticks), l === "histogram" && (n.scale = e.axisX.scale, i.scale = e.axisY.scale), (l === "heatmap" || l === "bubble") && (n.axisLabelsAngle = e.axisX.axisLabelsAngle, n.groupLabelsAngle = e.axisX.groupLabelsAngle, i.axisLabelsAngle = e.axisY.axisLabelsAngle, i.groupLabelsAngle = e.axisY.groupLabelsAngle, n.sorting = e.axisX.sorting, i.sorting = e.axisY.sorting), e.axisY.titleMode !== "auto" && (i.title = e.axisY.titleMode === "custom" ? e.axisY.customTitle : ""), e.axisX.titleMode !== "auto" && (n.title = e.axisX.titleMode === "custom" ? e.axisX.customTitle : "");
|
|
35
|
+
const t = {
|
|
36
|
+
xAxis: n,
|
|
37
|
+
yAxis: i,
|
|
38
|
+
frame: { type: e.other.frame },
|
|
39
|
+
facetSettings: {
|
|
40
|
+
nCols: e.other.facetColumns
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (l === "discrete" || l === "scatterplot" || l === "heatmap") && (t.orientation = e.other.reverse ? "horizontal" : "vertical", t.facetSettings.sharedX = ["x", "xy"].includes(e.other.facetSharedBy), t.facetSettings.sharedY = ["y", "xy"].includes(e.other.facetSharedBy)), l === "histogram" && (t.groupingDirection = e.other.groupingDirection, t.groupingStack = e.other.groupingStack), t;
|
|
16
44
|
}
|
|
17
45
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
46
|
+
N as getAxesDataFromForms,
|
|
47
|
+
H as getAxesDataFromFormsScatterplot,
|
|
48
|
+
E as getDiscreteLabelsRotation
|
|
20
49
|
};
|
|
21
50
|
//# sourceMappingURL=getAxesDataFromForms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAxesDataFromForms.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"sourcesContent":["import {AxesState} from '../../constantsCommon';\nimport {ChartType} from \"@milaboratories/pf-plots\";\nimport { LabelsRotation, UniqueValuesData } from '../../types';\n\ntype AxesSettings = {\n xAxis: Record<string, string|boolean|number|undefined>\n yAxis: Record<string, string|boolean|number|undefined>\n frame: {type: string}\n orientation?: string\n title?: Record<string, string>\n facetSettings: {\n nCols: number\n sharedX?: boolean,\n sharedY?: boolean\n },\n groupingDirection?: AxesState['other']['groupingDirection'],\n groupingStack?: AxesState['other']['groupingStack'],\n}\n\nconst HORIZONTAL_CAPTURES_MAX_COUNT = 6;\nconst SHORT_LABEL_MAX_LENGTH = 5;\nexport function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups:UniqueValuesData['options'] = []) {\n if (value !== null) {\n return value;\n }\n if (\n discreteGroups.length > HORIZONTAL_CAPTURES_MAX_COUNT &&\n discreteGroups.some(({label}) => label.length > SHORT_LABEL_MAX_LENGTH)\n ) {\n return '45deg';\n }\n return 'center';\n}\nexport function getAxesDataFromForms(axesFormsData:AxesState, chartType:ChartType, discreteGroups:UniqueValuesData['options'] = []):AxesSettings {\n let xAxis:AxesSettings['xAxis'] = {};\n let yAxis:AxesSettings['yAxis'] = {};\n if (chartType === 'discrete') {\n xAxis.labelsPosition = getDiscreteLabelsRotation(axesFormsData.axisX.labelsRotation, discreteGroups);\n xAxis.linesBetweenCategories = axesFormsData.axisX.linesBetweenCategories;\n yAxis.scale = axesFormsData.axisY.scale;\n }\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'scatterplot-umap') {\n xAxis.showGrid = axesFormsData.axisX.gridlines;\n xAxis.showTicks = axesFormsData.axisX.ticks;\n yAxis.showGrid = axesFormsData.axisY.gridlines;\n yAxis.showTicks = axesFormsData.axisY.ticks;\n }\n if (chartType === 'scatterplot' || chartType === 'scatterplot-umap') {\n xAxis.scale = axesFormsData.axisX.scale;\n yAxis.scale = axesFormsData.axisY.scale;\n xAxis.significantLinesStyle = axesFormsData.axisX.significantLinesStyle;\n yAxis.significantLinesStyle = axesFormsData.axisY.significantLinesStyle;\n }\n if (chartType === 'histogram') {\n xAxis.scale = axesFormsData.axisX.scale;\n yAxis.scale = axesFormsData.axisY.scale;\n }\n if (chartType === 'heatmap' || chartType === 'bubble') {\n xAxis.axisLabelsAngle = axesFormsData.axisX.axisLabelsAngle;\n xAxis.groupLabelsAngle = axesFormsData.axisX.groupLabelsAngle;\n yAxis.axisLabelsAngle = axesFormsData.axisY.axisLabelsAngle;\n yAxis.groupLabelsAngle = axesFormsData.axisY.groupLabelsAngle;\n xAxis.sorting = axesFormsData.axisX.sorting;\n yAxis.sorting = axesFormsData.axisY.sorting;\n }\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : ''\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : ''\n }\n\n const result:AxesSettings = {\n xAxis,\n yAxis,\n frame: {type: axesFormsData.other.frame},\n facetSettings: {\n nCols: axesFormsData.other.facetColumns\n }\n };\n\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'heatmap') {\n result.orientation = axesFormsData.other.reverse ? 'horizontal' : 'vertical';\n result.facetSettings.sharedX = (['x','xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y','xy']).includes(axesFormsData.other.facetSharedBy);\n }\n if (chartType === 'histogram') {\n result.groupingDirection = axesFormsData.other.groupingDirection;\n result.groupingStack = axesFormsData.other.groupingStack;\n }\n return result;\n}\n"],"names":["getDiscreteLabelsRotation","value","discreteGroups","label","getAxesDataFromForms","axesFormsData","chartType","xAxis","yAxis","result"],"mappings":"AAqBO,SAASA,EAA0BC,GAA8BC,IAA6C,IAAI;AACvH,SAAID,MAAU,OACLA,IAGPC,EAAe,SAAS,KACxBA,EAAe,KAAK,CAAC,EAAC,OAAAC,QAAWA,EAAM,SAAS,CAAsB,IAE/D,UAEF;AACT;AACO,SAASC,EAAqBC,GAAyBC,GAAqBJ,IAA6C,CAAA,GAAiB;AAC/I,MAAIK,IAA8B,CAAA,GAC9BC,IAA8B,CAAA;AAClC,EAAIF,MAAc,eAChBC,EAAM,iBAAiBP,EAA0BK,EAAc,MAAM,gBAAgBH,CAAc,GACnGK,EAAM,yBAAyBF,EAAc,MAAM,wBACnDG,EAAM,QAAQH,EAAc,MAAM,SAEhCC,MAAc,cAAcA,MAAc,iBAAiBA,MAAc,wBAC3EC,EAAM,WAAWF,EAAc,MAAM,WACrCE,EAAM,YAAYF,EAAc,MAAM,OACtCG,EAAM,WAAWH,EAAc,MAAM,WACrCG,EAAM,YAAYH,EAAc,MAAM,SAEpCC,MAAc,iBAAiBA,MAAc,wBAC/CC,EAAM,QAAQF,EAAc,MAAM,OAClCG,EAAM,QAAQH,EAAc,MAAM,OAClCE,EAAM,wBAAwBF,EAAc,MAAM,uBAClDG,EAAM,wBAAwBH,EAAc,MAAM,wBAEhDC,MAAc,gBAChBC,EAAM,QAAQF,EAAc,MAAM,OAClCG,EAAM,QAAQH,EAAc,MAAM,SAEhCC,MAAc,aAAaA,MAAc,cAC3CC,EAAM,kBAAkBF,EAAc,MAAM,iBAC5CE,EAAM,mBAAmBF,EAAc,MAAM,kBAC7CG,EAAM,kBAAkBH,EAAc,MAAM,iBAC5CG,EAAM,mBAAmBH,EAAc,MAAM,kBAC7CE,EAAM,UAAUF,EAAc,MAAM,SACpCG,EAAM,UAAUH,EAAc,MAAM,UAElCA,EAAc,MAAM,cAAc,WACpCG,EAAM,QAAQH,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc,KAE3FA,EAAc,MAAM,cAAc,WACpCE,EAAM,QAAQF,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc;AAG/F,QAAMI,IAAsB;AAAA,IAC1B,OAAAF;AAAA,IACA,OAAAC;AAAA,IACA,OAAO,EAAC,MAAMH,EAAc,MAAM,MAAA;AAAA,IAClC,eAAe;AAAA,MACb,OAAOA,EAAc,MAAM;AAAA,IAAA;AAAA,EAC7B;AAGF,UAAIC,MAAc,cAAcA,MAAc,iBAAiBA,MAAc,eAC3EG,EAAO,cAAcJ,EAAc,MAAM,UAAU,eAAe,YAClEI,EAAO,cAAc,UAAW,CAAC,KAAI,IAAI,EAAG,SAASJ,EAAc,MAAM,aAAa,GACtFI,EAAO,cAAc,UAAW,CAAC,KAAI,IAAI,EAAG,SAASJ,EAAc,MAAM,aAAa,IAEpFC,MAAc,gBAChBG,EAAO,oBAAoBJ,EAAc,MAAM,mBAC/CI,EAAO,gBAAgBJ,EAAc,MAAM,gBAEtCI;AACT;"}
|
|
1
|
+
{"version":3,"file":"getAxesDataFromForms.js","sources":["../../../../src/GraphMaker/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"sourcesContent":["import { AxesState } from '../../constantsCommon';\nimport { ChartType, InputGuide, InputState } from \"@milaboratories/pf-plots\";\nimport { LabelsRotation, ReactiveState, UniqueValuesBySourceMap, UniqueValuesData } from '../../types';\nimport { AxisSettingsContinuous } from '@milaboratories/miplots4';\nimport { AxisSettingsDiscrete } from '@milaboratories/miplots4';\nimport { HeatmapSettings } from '@milaboratories/miplots4';\n\ntype AxesSettings = {\n xAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['xAxis'];\n yAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['yAxis'];\n frame: { type: string };\n orientation?: string;\n title?: Record<string, string>;\n facetSettings: {\n nCols: number\n sharedX?: boolean,\n sharedY?: boolean\n };\n groupingDirection?: AxesState['other']['groupingDirection'];\n groupingStack?: AxesState['other']['groupingStack'];\n}\n\nconst HORIZONTAL_CAPTURES_MAX_COUNT = 6;\nconst SHORT_LABEL_MAX_LENGTH = 5;\n\nexport function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups: UniqueValuesData['options'] = []) {\n if (value !== null) {\n return value;\n }\n if (\n discreteGroups.length > HORIZONTAL_CAPTURES_MAX_COUNT &&\n discreteGroups.some(({ label }) => label.length > SHORT_LABEL_MAX_LENGTH)\n ) {\n return '45deg';\n }\n return 'center';\n}\n\nexport function getAxesDataFromFormsScatterplot(\n axesFormsData: AxesState,\n uniqueValues: UniqueValuesBySourceMap,\n optionsState: ReactiveState['optionsState'],\n inputGuide: InputGuide<InputState>,\n): AxesSettings {\n let xAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n let yAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n xAxis.showGrid = axesFormsData.axisX.gridlines;\n xAxis.showTicks = axesFormsData.axisX.ticks;\n yAxis.showGrid = axesFormsData.axisY.gridlines;\n yAxis.showTicks = axesFormsData.axisY.ticks;\n\n const xSource = optionsState.components.x.selectorStates?.[0].selectedSource ?? null;\n const ySource = optionsState.components.y.selectorStates?.[0].selectedSource ?? null;\n const infoX = xSource ? inputGuide.getSourceInfo(xSource) : null;\n const infoY = ySource ? inputGuide.getSourceInfo(ySource) : null;\n\n const isDiscreteX = infoX?.type === 'String';\n const isDiscreteY = infoY?.type === 'String';\n\n console.log('isDiscreteX', isDiscreteX, infoX);\n console.log('isDiscreteY', isDiscreteY, infoY);\n if (isDiscreteX) {\n xAxis = xAxis as AxisSettingsDiscrete;\n xAxis.scale = 'discrete';\n xAxis.labelsPosition = axesFormsData.axisX.labelsRotation ?? 'center';\n\n const saved = axesFormsData.axisX.order?.source === xSource;\n const uniqueList = uniqueValues[xSource]?.list;\n const uniqueLabels = uniqueValues[xSource]?.labels;\n const keys = saved ? axesFormsData.axisX.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved ? axesFormsData.axisX.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels : uniqueLabels;\n if (keys && labels) {\n xAxis.keys = keys;\n xAxis.labels = labels;\n };\n } else {\n xAxis = xAxis as AxisSettingsContinuous;\n xAxis.scale = axesFormsData.axisX.scale;\n xAxis.significantLinesStyle = axesFormsData.axisX.significantLinesStyle;\n }\n\n if (isDiscreteY) {\n yAxis = yAxis as AxisSettingsDiscrete;\n yAxis.scale = 'discrete';\n yAxis.labelsPosition = axesFormsData.axisY.labelsRotation ?? 'center';\n\n const uniqueList = uniqueValues[ySource]?.list;\n const uniqueLabels = uniqueValues[ySource]?.labels;\n const saved = axesFormsData.axisY.order?.source === ySource;\n const keys = saved ? axesFormsData.axisY.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved ? axesFormsData.axisY.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels : uniqueLabels;\n if (keys && labels) {\n yAxis.keys = keys;\n yAxis.labels = labels;\n };\n } else {\n yAxis = yAxis as AxisSettingsContinuous;\n yAxis.scale = axesFormsData.axisY.scale;\n yAxis.significantLinesStyle = axesFormsData.axisY.significantLinesStyle;\n }\n\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : ''\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : ''\n }\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns\n }\n };\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n\n return result;\n}\n\nexport function getAxesDataFromForms(axesFormsData: AxesState, chartType: ChartType, discreteGroups: UniqueValuesData['options'] = []): AxesSettings {\n let xAxis: AxesSettings['xAxis'] = {};\n let yAxis: AxesSettings['yAxis'] = {};\n if (chartType === 'discrete') {\n (xAxis as AxisSettingsDiscrete)!.labelsPosition = getDiscreteLabelsRotation(axesFormsData.axisX.labelsRotation, discreteGroups);\n (xAxis as AxisSettingsDiscrete)!.linesBetweenCategories = axesFormsData.axisX.linesBetweenCategories;\n (yAxis as AxisSettingsContinuous)!.scale = axesFormsData.axisY.scale;\n (xAxis as AxisSettingsDiscrete)!.showGrid = axesFormsData.axisX.gridlines;\n (xAxis as AxisSettingsDiscrete)!.showTicks = axesFormsData.axisX.ticks;\n (yAxis as AxisSettingsContinuous)!.showGrid = axesFormsData.axisY.gridlines;\n (yAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisY.ticks;\n }\n if (chartType === 'histogram') {\n (xAxis as AxisSettingsContinuous).scale = axesFormsData.axisX.scale;\n (yAxis as AxisSettingsContinuous).scale = axesFormsData.axisY.scale;\n }\n if (chartType === 'heatmap' || chartType === 'bubble') {\n (xAxis as HeatmapSettings['xAxis'])!.axisLabelsAngle = axesFormsData.axisX.axisLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.groupLabelsAngle = axesFormsData.axisX.groupLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.axisLabelsAngle = axesFormsData.axisY.axisLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.groupLabelsAngle = axesFormsData.axisY.groupLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.sorting = axesFormsData.axisX.sorting;\n (yAxis as HeatmapSettings['yAxis'])!.sorting = axesFormsData.axisY.sorting;\n }\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis!.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : ''\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis!.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : ''\n }\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns\n }\n };\n\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'heatmap') {\n result.orientation = axesFormsData.other.reverse ? 'horizontal' : 'vertical';\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n }\n if (chartType === 'histogram') {\n result.groupingDirection = axesFormsData.other.groupingDirection;\n result.groupingStack = axesFormsData.other.groupingStack;\n }\n return result;\n}\n"],"names":["getDiscreteLabelsRotation","value","discreteGroups","label","getAxesDataFromFormsScatterplot","axesFormsData","uniqueValues","optionsState","inputGuide","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","xAxis","yAxis","xSource","ySource","infoX","infoY","isDiscreteX","isDiscreteY","saved","uniqueList","uniqueLabels","keys","v","labels","res","result","getAxesDataFromForms","chartType"],"mappings":"AAyBO,SAASA,EAA0BC,GAA8BC,IAA8C,IAAI;AACxH,SAAID,MAAU,OACLA,IAGPC,EAAe,SAAS,KACxBA,EAAe,KAAK,CAAC,EAAE,OAAAC,QAAYA,EAAM,SAAS,CAAsB,IAEjE,UAEF;AACT;AAEO,SAASC,EACdC,GACAC,GACAC,GACAC,GACc;AArBhB,MAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC;AAsBE,MAAIC,IAAuD,CAAA,GACvDC,IAAuD,CAAA;A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AAAA,EAC7B;AAGF,UAAIiC,MAAc,cAAcA,MAAc,iBAAiBA,MAAc,eAC3EF,EAAO,cAAc/B,EAAc,MAAM,UAAU,eAAe,YAClE+B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS/B,EAAc,MAAM,aAAa,GACvF+B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS/B,EAAc,MAAM,aAAa,IAErFiC,MAAc,gBAChBF,EAAO,oBAAoB/B,EAAc,MAAM,mBAC/C+B,EAAO,gBAAgB/B,EAAc,MAAM,gBAEtC+B;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadUniqueValuesToSave.d.ts","sourceRoot":"","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"loadUniqueValuesToSave.d.ts","sourceRoot":"","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAqBnD,wBAAsB,iCAAiC,CACrD,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,oBAAoB,EAAE,uBAAuB,GAC5C,OAAO,CAAC,uBAAuB,CAAC,CAoHlC;AACD,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,oBAAoB,EAAE,uBAAuB,GAC7C,OAAO,CAAC,uBAAuB,CAAC,CAwDjC;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAuBpC"}
|
|
@@ -1,89 +1,93 @@
|
|
|
1
1
|
import { AXIS_NATURE_KEY as g } from "../constantsCommon.js";
|
|
2
|
-
const
|
|
2
|
+
const A = 100, T = ["primaryGrouping", "secondaryGrouping"], y = ["grouping"], I = ["x", "y"], R = ["grouping"], d = [
|
|
3
3
|
"nodeColor",
|
|
4
4
|
"nodeShape",
|
|
5
5
|
"lineColor",
|
|
6
6
|
"heatmapAnnotation"
|
|
7
7
|
// dendro
|
|
8
|
-
],
|
|
9
|
-
async function
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const t = o.data.byColumns.values[s], n = e ? o.data.byColumns.values[e] : null, S = /* @__PURE__ */ new Set(),
|
|
8
|
+
], L = (o) => o.sort((a, _) => a.label.localeCompare(_.label, "en", { numeric: !0 }));
|
|
9
|
+
async function m(o, a, _, v, f) {
|
|
10
|
+
const u = {};
|
|
11
|
+
function i(s, e) {
|
|
12
|
+
const t = o.data.byColumns.values[s], n = e ? o.data.byColumns.values[e] : null, S = /* @__PURE__ */ new Set(), p = [];
|
|
13
13
|
for (let l = 0; l < t.length; l++) {
|
|
14
14
|
const r = String(t[l]);
|
|
15
15
|
if (S.has(r) || t[l] === null)
|
|
16
16
|
continue;
|
|
17
|
-
if (S.size ===
|
|
18
|
-
|
|
17
|
+
if (S.size === A) {
|
|
18
|
+
u[s] = null;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
S.add(r);
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const E = n ? String(n[l]) : r;
|
|
23
|
+
p.push({ value: r, label: E });
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
list:
|
|
27
|
-
labels:
|
|
28
|
-
options:
|
|
25
|
+
L(p), u[s] = {
|
|
26
|
+
list: p.map((l) => l.value),
|
|
27
|
+
labels: p.reduce((l, r) => (l[r.value] = r.value, l), {}),
|
|
28
|
+
options: p
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
o.settings.type === "discrete" &&
|
|
31
|
+
o.settings.type === "discrete" && T.forEach((s) => {
|
|
32
32
|
const e = o.settings[s];
|
|
33
33
|
if (e) {
|
|
34
34
|
const { columnName: t } = e;
|
|
35
|
-
|
|
35
|
+
i(t.value, t.valueLabels);
|
|
36
36
|
}
|
|
37
|
-
}), (o.settings.type === "scatterplot" || o.settings.type === "scatterplot-umap") &&
|
|
37
|
+
}), (o.settings.type === "scatterplot" || o.settings.type === "scatterplot-umap") && (I.forEach((s) => {
|
|
38
|
+
const e = o.settings[s];
|
|
39
|
+
e && a.getSourceInfo(e.value).type === "String" && i(e.value, e.valueLabels);
|
|
40
|
+
}), y.forEach((s) => {
|
|
38
41
|
const e = o.settings[s];
|
|
39
42
|
e == null || e.forEach(({ columnName: t }) => {
|
|
40
|
-
|
|
43
|
+
const n = a.getSourceInfo(t.value).type;
|
|
44
|
+
(n === "String" || n === "Int" || n === "Long") && i(t.value, t.valueLabels);
|
|
41
45
|
});
|
|
42
|
-
}), o.settings.type === "histogram" && R.forEach((s) => {
|
|
46
|
+
})), o.settings.type === "histogram" && R.forEach((s) => {
|
|
43
47
|
const e = o.settings[s];
|
|
44
|
-
e &&
|
|
45
|
-
}), o.settings.type === "dendro" &&
|
|
48
|
+
e && i(e.value, e.valueLabels);
|
|
49
|
+
}), o.settings.type === "dendro" && d.forEach((s) => {
|
|
46
50
|
const e = o.settings[s];
|
|
47
|
-
e &&
|
|
51
|
+
e && i(e.value, e.valueLabels);
|
|
48
52
|
});
|
|
49
|
-
const
|
|
50
|
-
[...
|
|
53
|
+
const c = [];
|
|
54
|
+
[...a.freeOptionsSet].forEach((s) => {
|
|
51
55
|
var t, n, S;
|
|
52
|
-
const e =
|
|
53
|
-
e.kind === "axis" && ((t = e.annotations) != null && t[g]) && ((n = e.annotations) == null ? void 0 : n[g]) !== "homogeneous" && ((S = e.annotations) == null ? void 0 : S[g]) !== "homogenous" &&
|
|
56
|
+
const e = a.getSourceInfo(s);
|
|
57
|
+
e.kind === "axis" && ((t = e.annotations) != null && t[g]) && ((n = e.annotations) == null ? void 0 : n[g]) !== "homogeneous" && ((S = e.annotations) == null ? void 0 : S[g]) !== "homogenous" && c.push(s);
|
|
54
58
|
});
|
|
55
|
-
for (const s of
|
|
56
|
-
if (!
|
|
57
|
-
if (f[s] && !
|
|
58
|
-
|
|
59
|
-
else if (
|
|
60
|
-
const e = await
|
|
61
|
-
e.overflow ?
|
|
59
|
+
for (const s of c)
|
|
60
|
+
if (!u[s]) {
|
|
61
|
+
if (f[s] && !u[s])
|
|
62
|
+
u[s] = f[s];
|
|
63
|
+
else if (v) {
|
|
64
|
+
const e = await _.getUniqueSourceValuesWithLabels(v, a, s, A);
|
|
65
|
+
e.overflow ? u[s] = null : u[s] = {
|
|
62
66
|
list: e.values.map((t) => t.value),
|
|
63
67
|
options: e.values,
|
|
64
68
|
labels: e.values.reduce((t, n) => (t[n.value] = n.label, t), {})
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
return
|
|
72
|
+
return u;
|
|
69
73
|
}
|
|
70
|
-
async function N(o,
|
|
74
|
+
async function N(o, a, _, v) {
|
|
71
75
|
const f = [];
|
|
72
|
-
["filters", "tabBy"].forEach((
|
|
73
|
-
const s = o[
|
|
76
|
+
["filters", "tabBy"].forEach((c) => {
|
|
77
|
+
const s = o[c];
|
|
74
78
|
if (s)
|
|
75
79
|
for (const { selectedSource: e, selectedFilterValue: t, type: n } of s.selectorStates)
|
|
76
|
-
|
|
80
|
+
c === "filters" && n === "equals" && t ? f.push([e, t]) : t && f.push([e, t]);
|
|
77
81
|
});
|
|
78
|
-
const
|
|
79
|
-
for (const [
|
|
80
|
-
const e = await
|
|
81
|
-
e.values.length === 1 && (c
|
|
82
|
+
const i = {};
|
|
83
|
+
for (const [c, s] of f) {
|
|
84
|
+
const e = await _.getUniqueSourceValuesWithLabels(v, a, c, 1, void 0, s);
|
|
85
|
+
e.values.length === 1 && (i[c] = e.values[0]);
|
|
82
86
|
}
|
|
83
|
-
return
|
|
87
|
+
return i;
|
|
84
88
|
}
|
|
85
89
|
export {
|
|
86
|
-
|
|
90
|
+
m as getUniqueValuesFromReadyChartData,
|
|
87
91
|
N as loadFilterLabelsForTitle
|
|
88
92
|
};
|
|
89
93
|
//# sourceMappingURL=loadUniqueValuesToSave.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadUniqueValuesToSave.js","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"sourcesContent":["import { AXIS_NATURE_KEY } from '../constantsCommon';\nimport { UniqueValuesBySourceMap, UniqueValuesData } from '../types';\nimport {\n Controller,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter\n} from '@milaboratories/pf-plots';\nimport { ListOption } from '@platforma-sdk/ui-vue';\nimport { DendroSettings, DiscreteSettings, HistogramSettings, ScatterplotSettings } from '@milaboratories/miplots4';\n\nconst INPUTS_REQUESTING_UNIQUE_VALUES = [\n 'primaryGrouping', 'secondaryGrouping', // discrete charts\n 'grouping', 'shape', // scatterplot\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation', // dendro\n 'filters', 'highlight', 'tabBy' // all\n] as ((keyof InputState['components'])[]);\nconst SAVED_UNIQUE_VALUES_LIMIT = 100;\n\nconst SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS = ['primaryGrouping', 'secondaryGrouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS = ['grouping'];\nconst SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING = ['grouping'];\nconst SAVED_IN_CHART_DATA_DENDRO_GROUPING = [\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation' // dendro\n];\n\nconst sortValues = (values:{value:string, label:string}[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', {numeric: true}))\n\nexport async function getUniqueValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap\n): Promise<UniqueValuesBySourceMap> {\n const resultMap:UniqueValuesBySourceMap = {};\n function addUniqueData(sourceId:string, labelId?:string) {\n const data = chartData!.data.byColumns.values[sourceId];\n const dataLabels = labelId ? chartData!.data.byColumns.values[labelId] : null;\n\n const resultSet = new Set();\n const result:{value:string, label:string}[] = [];\n for (let i = 0; i < data.length; i++) {\n const v = String(data[i]);\n if (resultSet.has(v) || data[i] === null) {\n continue;\n }\n if (resultSet.size === SAVED_UNIQUE_VALUES_LIMIT) {\n resultMap[sourceId] = null;\n return;\n }\n resultSet.add(v);\n const label = dataLabels ? String(dataLabels[i]) : v;\n result.push({value: v, label});\n }\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.value;\n return res;\n }, {} as Record<string, string>),\n options: result\n };\n }\n if (chartData.settings.type === 'discrete') {\n SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS.forEach((inputName:string) => {\n const savedData = chartData.settings[inputName] as unknown as DiscreteSettings['primaryGrouping'];\n if (savedData) {\n const {columnName} = savedData;\n addUniqueData(columnName.value, columnName.valueLabels)\n }\n });\n }\n if (chartData.settings.type === 'scatterplot' || chartData.settings.type === 'scatterplot-umap') {\n SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS.forEach((inputName:string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({columnName}) => {\n addUniqueData(columnName.value, columnName.valueLabels);\n });\n });\n }\n\n if (chartData.settings.type === 'histogram') {\n SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as HistogramSettings['grouping'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n if (chartData.settings.type === 'dendro') {\n SAVED_IN_CHART_DATA_DENDRO_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as DendroSettings['heatmapAnnotation'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n // sources for loading\n const selectedSources: string[] = [];\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n\n for (const source of selectedSources) {\n if (resultMap[source]) {\n continue;\n }\n if (previousUniqueValues[source] && !resultMap[source]) {\n resultMap[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n resultMap[source] = null;\n } else {\n resultMap[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return resultMap;\n}\nexport async function loadUniqueValuesToSave(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap // save null for too long lists of unique values\n):Promise<UniqueValuesBySourceMap> {\n const selectedSources: string[] = [];\n INPUTS_REQUESTING_UNIQUE_VALUES.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource } of componentState.selectorStates) {\n const info = inputGuide.getSourceInfo(selectedSource);\n if (inputName === 'filters' || inputName === 'highlight') {\n if (info.type === 'String' || info.type === 'Int' || info.type === 'Long') {\n selectedSources.push(selectedSource);\n }\n } else if (inputName === 'grouping') {\n if (info.type === 'String') {\n selectedSources.push(selectedSource);\n }\n } else {\n selectedSources.push(selectedSource);\n }\n }\n }\n });\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n ([...inputGuide.axesToBeFixedSet]).forEach(id => {\n selectedSources.push(id);\n });\n const nextUniqueValuesData: UniqueValuesBySourceMap = {};\n for (const source of selectedSources) {\n if (previousUniqueValues[source]) {\n nextUniqueValuesData[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n nextUniqueValuesData[source] = null;\n } else {\n nextUniqueValuesData[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return nextUniqueValuesData;\n}\n\nexport async function loadFilterLabelsForTitle(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n):Promise<Record<string, ListOption>> {\n const selected: [string, string][] = [];\n const INPUTS_REQUESTING_LABELS = ['filters', 'tabBy'] as ((keyof InputState['components'])[]);\n INPUTS_REQUESTING_LABELS.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource, selectedFilterValue, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (inputName === 'filters' && type === 'equals' && selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n } else if (selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n }\n }\n }\n });\n const result:Record<string, ListOption> = {};\n for (const [source, selectedValue] of selected) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, 1, undefined, selectedValue);\n if (uniqueValuesResponse.values.length === 1) {\n result[source] = uniqueValuesResponse.values[0];\n }\n }\n return result;\n}"],"names":["SAVED_UNIQUE_VALUES_LIMIT","SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS","SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING","SAVED_IN_CHART_DATA_DENDRO_GROUPING","sortValues","values","a","b","getUniqueValuesFromReadyChartData","chartData","inputGuide","controller","dataStore","previousUniqueValues","resultMap","addUniqueData","sourceId","labelId","data","dataLabels","resultSet","result","i","v","label","el","res","inputName","savedData","columnName","savedInGrouping","savedByInputName","selectedSources","id","info","_a","AXIS_NATURE_KEY","_b","_c","source","uniqueValuesResponse","loadFilterLabelsForTitle","optionsState","selected","componentState","selectedSource","selectedFilterValue","type","selectedValue"],"mappings":";AAmBA,MAAMA,IAA4B,KAE5BC,IAAyC,CA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C,EAAqB,OAAO,CAAC;AAAA,EAElD;AACA,SAAOnB;AACT;"}
|
|
1
|
+
{"version":3,"file":"loadUniqueValuesToSave.js","sources":["../../../src/GraphMaker/utils/loadUniqueValuesToSave.ts"],"sourcesContent":["import { AXIS_NATURE_KEY } from '../constantsCommon';\nimport { UniqueValuesBySourceMap, UniqueValuesData } from '../types';\nimport {\n Controller,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter\n} from '@milaboratories/pf-plots';\nimport { ListOption } from '@platforma-sdk/ui-vue';\nimport { DendroSettings, DiscreteSettings, HistogramSettings, ScatterplotSettings } from '@milaboratories/miplots4';\n\nconst INPUTS_REQUESTING_UNIQUE_VALUES = [\n 'primaryGrouping', 'secondaryGrouping', // discrete charts\n 'grouping', 'shape', 'x', 'y', // scatterplot\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation', // dendro\n 'filters', 'highlight', 'tabBy' // all\n] as ((keyof InputState['components'])[]);\nconst SAVED_UNIQUE_VALUES_LIMIT = 100;\n\nconst SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS = ['primaryGrouping', 'secondaryGrouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS = ['grouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_XY = ['x', 'y'];\nconst SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING = ['grouping'];\nconst SAVED_IN_CHART_DATA_DENDRO_GROUPING = [\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation' // dendro\n];\n\nconst sortValues = (values:{value:string, label:string}[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', {numeric: true}))\n\nexport async function getUniqueValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap\n): Promise<UniqueValuesBySourceMap> {\n const resultMap:UniqueValuesBySourceMap = {};\n function addUniqueData(sourceId:string, labelId?:string) {\n const data = chartData!.data.byColumns.values[sourceId];\n const dataLabels = labelId ? chartData!.data.byColumns.values[labelId] : null;\n\n const resultSet = new Set();\n const result:{value:string, label:string}[] = [];\n for (let i = 0; i < data.length; i++) {\n const v = String(data[i]);\n if (resultSet.has(v) || data[i] === null) {\n continue;\n }\n if (resultSet.size === SAVED_UNIQUE_VALUES_LIMIT) {\n resultMap[sourceId] = null;\n return;\n }\n resultSet.add(v);\n const label = dataLabels ? String(dataLabels[i]) : v;\n result.push({value: v, label});\n }\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.value;\n return res;\n }, {} as Record<string, string>),\n options: result\n };\n }\n if (chartData.settings.type === 'discrete') {\n SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS.forEach((inputName:string) => {\n const savedData = chartData.settings[inputName] as unknown as DiscreteSettings['primaryGrouping'];\n if (savedData) {\n const {columnName} = savedData;\n addUniqueData(columnName.value, columnName.valueLabels)\n }\n });\n }\n if (chartData.settings.type === 'scatterplot' || chartData.settings.type === 'scatterplot-umap') {\n SAVED_IN_CHART_DATA_SCATTERPLOT_XY.forEach((inputName:string) => {\n const columnName = chartData.settings[inputName] as unknown as ScatterplotSettings['x'];\n if (columnName) {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String') {\n addUniqueData(columnName.value, columnName.valueLabels);\n }\n }\n });\n SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS.forEach((inputName:string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({columnName}) => {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String' || valueType === 'Int' || valueType === 'Long') {\n addUniqueData(columnName.value, columnName.valueLabels);\n }\n });\n });\n }\n\n if (chartData.settings.type === 'histogram') {\n SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as HistogramSettings['grouping'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n if (chartData.settings.type === 'dendro') {\n SAVED_IN_CHART_DATA_DENDRO_GROUPING.forEach((inputName:string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as DendroSettings['heatmapAnnotation'];\n if (savedByInputName) {\n addUniqueData(savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n // sources for loading\n const selectedSources: string[] = [];\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n\n for (const source of selectedSources) {\n if (resultMap[source]) {\n continue;\n }\n if (previousUniqueValues[source] && !resultMap[source]) {\n resultMap[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n resultMap[source] = null;\n } else {\n resultMap[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return resultMap;\n}\nexport async function loadUniqueValuesToSave(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousUniqueValues: UniqueValuesBySourceMap // save null for too long lists of unique values\n):Promise<UniqueValuesBySourceMap> {\n const selectedSources: string[] = [];\n INPUTS_REQUESTING_UNIQUE_VALUES.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource } of componentState.selectorStates) {\n const info = inputGuide.getSourceInfo(selectedSource);\n if (inputName === 'filters' || inputName === 'highlight') {\n if (info.type === 'String' || info.type === 'Int' || info.type === 'Long') {\n selectedSources.push(selectedSource);\n }\n } else if (inputName === 'grouping' || inputName === 'x' || inputName === 'y') {\n if (info.type === 'String') {\n selectedSources.push(selectedSource);\n }\n } else {\n selectedSources.push(selectedSource);\n }\n }\n }\n });\n ([...inputGuide.freeOptionsSet]).forEach(id => {\n const info = inputGuide.getSourceInfo(id);\n if (\n info.kind === 'axis' &&\n info.annotations?.[AXIS_NATURE_KEY] &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogeneous' &&\n info.annotations?.[AXIS_NATURE_KEY] !== 'homogenous'\n ) {\n selectedSources.push(id);\n }\n });\n ([...inputGuide.axesToBeFixedSet]).forEach(id => {\n selectedSources.push(id);\n });\n const nextUniqueValuesData: UniqueValuesBySourceMap = {};\n for (const source of selectedSources) {\n if (previousUniqueValues[source]) {\n nextUniqueValuesData[source] = previousUniqueValues[source];\n } else if (dataStore) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n if (uniqueValuesResponse.overflow) {\n nextUniqueValuesData[source] = null;\n } else {\n nextUniqueValuesData[source] = {\n list: uniqueValuesResponse.values.map((el) => el.value),\n options: uniqueValuesResponse.values,\n labels: uniqueValuesResponse.values.reduce((res: Record<string, string>, el) => {\n res[el.value] = el.label;\n return res;\n }, {})\n } as UniqueValuesData;\n }\n }\n }\n return nextUniqueValuesData;\n}\n\nexport async function loadFilterLabelsForTitle(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n):Promise<Record<string, ListOption>> {\n const selected: [string, string][] = [];\n const INPUTS_REQUESTING_LABELS = ['filters', 'tabBy'] as ((keyof InputState['components'])[]);\n INPUTS_REQUESTING_LABELS.forEach(inputName => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource, selectedFilterValue, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (inputName === 'filters' && type === 'equals' && selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n } else if (selectedFilterValue) {\n selected.push([selectedSource, selectedFilterValue]);\n }\n }\n }\n });\n const result:Record<string, ListOption> = {};\n for (const [source, selectedValue] of selected) {\n const uniqueValuesResponse = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, 1, undefined, selectedValue);\n if (uniqueValuesResponse.values.length === 1) {\n result[source] = uniqueValuesResponse.values[0];\n }\n }\n return result;\n}"],"names":["SAVED_UNIQUE_VALUES_LIMIT","SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_XY","SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING","SAVED_IN_CHART_DATA_DENDRO_GROUPING","sortValues","values","b","getUniqueValuesFromReadyChartData","chartData","inputGuide","controller","dataStore","previousUniqueValues","resultMap","addUniqueData","sourceId","labelId","data","dataLabels","resultSet","result","i","v","label","el","res","inputName","savedData","columnName","savedInGrouping","valueType","savedByInputName","selectedSources","id","info","_a","AXIS_NATURE_KEY","_b","_c","source","uniqueValuesResponse","loadFilterLabelsForTitle","optionsState","selected","componentState","selectedSource","selectedFilterValue","type","selectedValue"],"mappings":";AAmBA,MAAMA,IAA4B,KAE5BC,IAAyC,CAAC,mBAAmB,mBAAmB,GAChFC,IAA4C,CAAC,UAAU,GACvDC,IAAqC,CAAC,KAAK,GAAG,GAC9CC,IAAyC,CAAC,UAAU,GACpDC,IAAsC;AAAA,EAC1C;AAAA,EAAa;AAAA,EAAa;AAAA,EAAa;AAAA;AACzC,GAEMC,IAAa,CAACC,MAA0CA,EAAO,KAAK,CAAC,GAAGC,MAAM,EAAE,MAAM,cAAcA,EAA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AAa;AACxI,IAAIR,EAAqB,OAAO,WAAW,MACzCpB,EAAOmB,CAAM,IAAIC,EAAqB,OAAO,CAAC;AAAA,EAElD;AACA,SAAOpB;AACT;"}
|
package/dist/node_modules/@milaboratories/miplots4/dist/{discrete/components → common}/BandAxis.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as i } from "
|
|
2
|
-
import { BLACK as x } from "
|
|
3
|
-
import { TICK_OFFSET as c } from "../constants.js";
|
|
1
|
+
import { j as i } from "../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { BLACK as x } from "../constants.js";
|
|
3
|
+
import { TICK_OFFSET as c } from "../discrete/constants.js";
|
|
4
4
|
function k(t) {
|
|
5
5
|
return `translate(${t},0)`;
|
|
6
6
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BandAxis.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/BandAxis.tsx"],"sourcesContent":["import {BLACK} from '../constants';\nimport {TICK_OFFSET} from '../discrete/constants';\nimport React from 'react';\nimport type {ScaleBand, ScalePoint} from 'd3-scale';\n\ntype Scale = ScaleBand<string> | ScalePoint<string | number>;\ntype Orient = 'left' | 'bottom';\n\nfunction translateX(x: number) {\n return `translate(${x},0)`;\n}\n\nfunction translateY(y: number) {\n return `translate(0,${y})`;\n}\n\ntype LabelsPosition = 'center' | '45deg' | '90deg';\n\nconst FONT_HEIGHT = 21;\nfunction getRotationTransform(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (labelsPosition === '45deg') {\n const x = orient === 'left' ? -FONT_HEIGHT / 2 : 0;\n const y = orient === 'bottom' ? FONT_HEIGHT / 2 : -FONT_HEIGHT / 2;\n return `translate(${x},${y}) rotate(-45)`;\n }\n if (labelsPosition === '90deg' && orient === 'bottom') {\n return `translate(${-FONT_HEIGHT / 2},${TICK_OFFSET + FONT_HEIGHT / 2}) rotate(-90)`;\n }\n return orient === 'bottom' ? `translate(0,${TICK_OFFSET})` : `translate(${-TICK_OFFSET},0)`;\n}\n\nfunction getDominantBaseline(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (orient === 'left' || (orient === 'bottom' && labelsPosition === '90deg')) {\n return 'central';\n }\n if (labelsPosition === 'center') {\n return 'hanging';\n }\n return 'auto';\n}\n\nfunction getTextAnchor(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (orient === 'left' || (orient === 'bottom' && labelsPosition !== 'center')) {\n return 'end';\n }\n return 'middle';\n}\n\nexport const BandAxis = ({\n scale,\n tickSize = 6,\n tickPadding = TICK_OFFSET,\n orient = 'bottom',\n labelsPosition = 'center',\n labels = {},\n offset = typeof window !== 'undefined' && window.devicePixelRatio > 1 ? 0 : 0.5,\n}: {\n scale: Scale;\n tickSize?: number;\n tickPadding?: number;\n offset?: number;\n orient?: Orient;\n labels?: Record<string, string[]>;\n labelsPosition?: 'center' | '45deg' | '90deg';\n}) => {\n function center(scale: Scale, offset: number) {\n if (scale.bandwidth) {\n offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;\n }\n if (scale?.round()) {\n offset = Math.round(offset);\n }\n return (d: string | number) => {\n const value = scale(d as string);\n return value === undefined ? 0 : value + offset;\n };\n }\n\n const values = scale.domain();\n const getLabel = (tick: string | number) => labels[tick] ?? [];\n const spacing = Math.max(tickSize, 0) + tickPadding;\n const position = center(scale.copy(), offset);\n\n const transform = orient === 'bottom' ? translateX : translateY;\n const k = orient === 'left' ? -1 : 1;\n\n const lineProps = {\n [(orient === 'left' ? 'x' : 'y') + '2']: k * tickSize,\n };\n\n const textProps = {\n [orient === 'left' ? 'x' : 'y']: k * spacing,\n };\n\n return (\n <g>\n {values.map((tick: string | number, i: number) => (\n <g className=\"tick\" key={i} transform={transform(position(tick) + offset)}>\n <line stroke={BLACK} {...lineProps} />\n <g transform={getRotationTransform(labelsPosition, orient)}>\n {getLabel(tick).map((line, idx) => {\n return (\n <text\n key={`${line}_${idx}`}\n fill={BLACK}\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n dominantBaseline={getDominantBaseline(labelsPosition, orient)}\n textAnchor={getTextAnchor(labelsPosition, orient)}\n dy={20 * idx}\n {...textProps}\n >\n {line}\n </text>\n );\n })}\n </g>\n </g>\n ))}\n </g>\n );\n};\n"],"names":["translateX","x","translateY","y","FONT_HEIGHT","getRotationTransform","labelsPosition","orient","TICK_OFFSET","getDominantBaseline","getTextAnchor","BandAxis","scale","tickSize","tickPadding","labels","offset","center","d","value","values","getLabel","tick","spacing","position","transform","k","lineProps","textProps","m","i","jsxs","jsx","BLACK","line","idx"],"mappings":";;;AAQA,SAASA,EAAWC,GAAW;AAC3B,SAAO,aAAaA,CAAC;AACzB;AAEA,SAASC,EAAWC,GAAW;AAC3B,SAAO,eAAeA,CAAC;AAC3B;AAIA,MAAMC,IAAc;AACpB,SAASC,EAAqBC,GAAgCC,GAA2B;AACrF,MAAID,MAAmB,SAAS;AAC5B,UAAML,IAAIM,MAAW,SAAS,CAACH,IAAc,IAAI,GAC3CD,IAAII,MAAW,WAAWH,IAAc,IAAI,CAACA,IAAc;AACjE,WAAO,aAAaH,CAAC,IAAIE,CAAC;AAAA,EAC9B;AACA,SAAIG,MAAmB,WAAWC,MAAW,WAClC,aAAa,CAACH,IAAc,CAAC,IAAII,IAAcJ,IAAc,CAAC,kBAElEG,MAAW,WAAW,eAAeC,CAAW,MAAM,aAAa,CAACA,CAAW;AAC1F;AAEA,SAASC,EAAoBH,GAAgCC,GAA2B;AACpF,SAAIA,MAAW,UAAWA,MAAW,YAAYD,MAAmB,UACzD,YAEPA,MAAmB,WACZ,YAEJ;AACX;AAEA,SAASI,EAAcJ,GAAgCC,GAA2B;AAC9E,SAAIA,MAAW,UAAWA,MAAW,YAAYD,MAAmB,WACzD,QAEJ;AACX;AAEO,MAAMK,IAAW,CAAC;AAAA,EACrB,OAAAC;AAAAA,EACA,UAAAC,IAAW;AAAA,EACX,aAAAC,IAAcN;AAAAA,EACd,QAA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