@milaboratories/miplots4 1.0.147 → 1.0.148
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/common/Legend.js +3 -3
- package/dist/common/Legend.js.map +1 -1
- package/dist/heatmap/ChartRenderer.js +1 -1
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +6 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +9 -3
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/components/Annotations/index.js +58 -58
- package/dist/heatmap/components/Annotations/index.js.map +1 -1
- package/dist/heatmap/getCells.d.ts +1 -1
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +204 -110
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +88 -85
- package/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/react/index.js +1 -1
- package/dist/node_modules/react-dom/index.js +1 -1
- package/dist/types/heatmap.d.ts +24 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +7 -2
- package/dist/types/heatmap.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.js","sources":["../../src/heatmap/getCells.ts"],"sourcesContent":["import { deviation, extent, mean } from 'd3-array';\nimport lodash from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\n\nfunction normalizeByStd(values:number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v:number) => v;\n }\n return (v:number) => (v - meanValue) / stdValue;\n}\nfunction normalizeByMinMax(values:number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined || max === min) {\n return (v:number) => v;\n }\n return (v:number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method:NormalizationMethod, values:number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v:number) => v;\n}\n\nexport type Cell = {\n isCell: true;\n idx: number;\n id: string;\n value: DataValue;\n normalizedValue: DataValue;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData = {\n meta: {\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // for titles, if facet by more 1 columns title has several values separated by commas\n facetKeyValues: Record<string, string[]>;\n xGroupKeyValues: Record<string, string[]>;\n yGroupKeyValues: Record<string, string[]>;\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n valueExtent: [number, number]; // for color scales\n // data for labels, annotations and dendrograms\n xDataByKeys: Record<string, Record<string, DataValue>>;\n yDataByKeys: Record<string, Record<string, DataValue>>;\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // axis keys grouped by group keys from meta\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell>>;\n }\n >;\n};\n\n// all combinations with 1 key from each list\nfunction getKeysCombinations(keysLists: string[][]) {\n if (!keysLists.length) {\n return [];\n }\n let result: string[][] = [[]];\n keysLists.forEach(keys => {\n const nextResult: string[][] = [];\n keys.forEach(key => {\n nextResult.push(...result.map(resultItem => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\nconst sortByLabels = (arr: string[], direction: 'asc' | 'desc', labels: Record<string, string> = {}) => {\n return arr.sort((a, b) => direction === 'asc'\n ? (labels[a] ?? a).localeCompare((labels[b] ?? b), 'en', { numeric: true })\n : (labels[b] ?? b).localeCompare((labels[a] ?? a), 'en', { numeric: true })\n );\n};\n\nexport function getCells(\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumn: ColumnName,\n facetBy: ColumnName[],\n xGroupBy: ColumnName[],\n yGroupBy: ColumnName[],\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n normalization: HeatmapSettingsImpl['normalization'],\n NAValueAs: HeatmapSettingsImpl['NAValueAs'],\n keysOrder: HeatmapSettingsImpl['keysOrder'],\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n): GroupedCellsData {\n const facetKeysLists = facetBy.length\n ? facetBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const xGroupKeysLists = xGroupBy.length\n ? xGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const yGroupKeysLists = yGroupBy.length\n ? yGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const facetKeysCombinations = getKeysCombinations(facetKeysLists);\n const xGroupKeysCombinations = getKeysCombinations(xGroupKeysLists);\n const yGroupKeysCombinations = getKeysCombinations(yGroupKeysLists);\n\n const facetKeys = facetKeysCombinations.map(keys => keys.join('_'));\n const xGroupKeys = xGroupKeysCombinations.map(keys => keys.join('_'));\n const yGroupKeys = yGroupKeysCombinations.map(keys => keys.join('_'));\n\n const result: GroupedCellsData = {\n meta: {\n facetKeys,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups: {},\n yKeysByGroups: {},\n xLabels: {},\n yLabels: {},\n xGroupLabels: {},\n yGroupLabels: {},\n xDataByKeys: {},\n yDataByKeys: {},\n facetKeyValues: facetKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = facetKeysCombinations[index];\n return res;\n }, {}),\n xGroupKeyValues: xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {}),\n yGroupKeyValues: yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\n }, {}),\n valueExtent: [Infinity, -Infinity],\n },\n facets: {},\n };\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n const annotationColumnsX = annotations.filter(item => item.axis === 'x').map(item => item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.value);\n const dendrogramXColumns = Object.values(dendrogramX ?? {}).map(column => column.value);\n const dendrogramYColumns = Object.values(dendrogramY ?? {}).map(column => column.value);\n const additionalDataColumnsX = lodash.uniq([...annotationColumnsX, ...dendrogramXColumns, xLabelsSource]);\n const additionalDataColumnsY = lodash.uniq([...annotationColumnsY, ...dendrogramYColumns, yLabelsSource]);\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = facetBy.length ? facetBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const yGroupKey = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupLabel = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n const yGroupLabel = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n result.meta.xGroupLabels[xGroupKey] = xGroupLabel;\n result.meta.yGroupLabels[yGroupKey] = yGroupLabel;\n const x = String(data.getColumnValue(xColumn.value, i));\n const y = String(data.getColumnValue(yColumn.value, i));\n const value = (data.getColumnValue(valueColumn.value, i) ?? NAValueAs) as number | null;\n \n if (x === 'null' || y === 'null' || value === null) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n cells: {},\n };\n }\n if (!result.facets[facetKey].xKeysByGroups[xGroupKey]) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = [];\n }\n if (!result.facets[facetKey].yKeysByGroups[yGroupKey]) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = [];\n }\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].yKeys.push(y);\n result.facets[facetKey].xKeysByGroups[xGroupKey].push(x);\n result.facets[facetKey].yKeysByGroups[yGroupKey].push(y);\n\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n result.meta.valueExtent[0] = Math.min(value, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value, result.meta.valueExtent[1]);\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const xLabelsSourceValue = data.getColumnValue(xLabelsSource, i);\n if (result.meta.xLabels[x] && String(xLabelsSourceValue) !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n const yLabelsSourceValue = data.getColumnValue(yLabelsSource, i);\n if (result.meta.yLabels[y] && String(yLabelsSourceValue) !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.xLabels[x] = String(xLabelsSourceValue);\n result.meta.yLabels[y] = String(yLabelsSourceValue);\n // data for labels, annotations and dendrograms by X\n additionalDataColumnsX.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.xDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.xDataByKeys[columnKey][x] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.xDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.xDataByKeys[columnKey][x] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for x = ${x} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.xDataByKeys[columnKey][x] = data.getColumnValue(columnKey, i);\n }\n });\n // data for labels, annotations and dendrograms by Y\n additionalDataColumnsY.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.yDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.yDataByKeys[columnKey][y] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.yDataByKeys[columnKey][y] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for y = ${y} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.yDataByKeys[columnKey][y] = data.getColumnValue(columnKey, i);\n }\n });\n result.facets[facetKey].cells[x][y] = {\n isCell: true,\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value,\n normalizedValue: value,\n };\n }\n\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n result.meta.facetKeys.forEach(facetKey => {\n const facet = result.facets[facetKey];\n const uniqueXKeys = lodash.uniq(facet.xKeys);\n const uniqueYKeys = lodash.uniq(facet.yKeys);\n facet.xKeys = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], uniqueXKeys) : uniqueXKeys;\n facet.yKeys = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], uniqueYKeys) : uniqueYKeys;\n xGroupKeys.forEach(xGroupKey => {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = lodash.intersection(\n facet.xKeys,\n result.facets[facetKey].xKeysByGroups[xGroupKey]\n );\n });\n yGroupKeys.forEach(yGroupKey => {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = lodash.intersection(\n facet.yKeys,\n result.facets[facetKey].yKeysByGroups[yGroupKey]\n );\n });\n });\n\n if (normalization) {\n const valueExtent = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n const {xKeys, yKeys, cells} = result.facets[facetKey];\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter = normalization.direction === 'row'\n ? (cellKey:string, groupKey:string) => cells[cellKey]?.[groupKey]\n : (cellKey:string, groupKey:string) => cells[groupKey]?.[cellKey];\n groupKeys.forEach((groupKey) => {\n const values:number[] = [];\n cellKeys.forEach((cellKey) => {\n const v = cellGetter(cellKey, groupKey)?.value;\n if (v !== undefined) {\n values.push(v as number);\n }\n });\n const normalize = getNormalizationFn(normalization.method, values);\n cellKeys.forEach((cellKey) => {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n cell.normalizedValue = normalize(cell.value as number);\n valueExtent[0] = Math.min(cell.normalizedValue, valueExtent[0]);\n valueExtent[1] = Math.max(cell.normalizedValue, valueExtent[1]);\n }\n });\n });\n });\n result.meta.valueExtent = valueExtent;\n }\n\n // every facet may contain not all of available keys, but for shared axes it is necessary to have all of them\n result.meta.xKeysByGroups = xGroupKeys.reduce((res: Record<string, string[]>, xGroupKey) => {\n const existingXKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].xKeysByGroups[xGroupKey]))\n ), xAxis.sorting, result.meta.xLabels);\n res[xGroupKey] = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], existingXKeys) : existingXKeys;\n return res;\n }, {});\n result.meta.yKeysByGroups = yGroupKeys.reduce((res: Record<string, string[]>, yGroupKey) => {\n const existingYKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].yKeysByGroups[yGroupKey]))\n ), yAxis.sorting, result.meta.yLabels);\n res[yGroupKey] = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], existingYKeys) : existingYKeys;\n return res;\n }, {});\n\n // avoid render errors on empty data\n if (result.meta.valueExtent[0] === Infinity) {\n result.meta.valueExtent[0] = 0;\n }\n if (result.meta.valueExtent[1] === -Infinity) {\n result.meta.valueExtent[1] = 0;\n }\n\n return result;\n}\n"],"names":["normalizeByStd","values","stdValue","deviation","meanValue","mean","v","normalizeByMinMax","min","max","extent","getNormalizationFn","method","getKeysCombinations","keysLists","result","keys","nextResult","key","resultItem","sortByLabels","arr","direction","labels","a","b","getCells","data","xColumn","yColumn","valueColumn","facetBy","xGroupBy","yGroupBy","annotations","dendrogramX","dendrogramY","normalization","NAValueAs","keysOrder","xAxis","yAxis","facetKeysLists","column","xGroupKeysLists","yGroupKeysLists","facetKeysCombinations","xGroupKeysCombinations","yGroupKeysCombinations","facetKeys","xGroupKeys","yGroupKeys","res","index","xLabelsSource","yLabelsSource","annotationColumnsX","item","annotationColumnsY","dendrogramXColumns","dendrogramYColumns","additionalDataColumnsX","lodash","additionalDataColumnsY","i","facetKey","xGroupKey","yGroupKey","xGroupLabel","yGroupLabel","x","y","value","xLabelsSourceValue","yLabelsSourceValue","columnKey","isAddedColumn","isAddedValue","facet","uniqueXKeys","uniqueYKeys","valueExtent","xKeys","yKeys","cells","cellKeys","groupKeys","cellGetter","cellKey","groupKey","_a","normalize","cell","existingXKeys","existingYKeys"],"mappings":";;;;AAMA,SAASA,EAAeC,GAAiB;AACrC,QAAMC,IAAWC,EAAUF,CAAM,GAC3BG,IAAYC,EAAKJ,CAAM;AAE7B,SAAIC,MAAa,UAAaE,MAAc,UAAaF,MAAa,IAC3D,CAACI,MAAaA,IAElB,CAACA,OAAcA,IAAIF,KAAaF;AAC3C;AACA,SAASK,GAAkBN,GAAiB;AACxC,QAAMG,IAAYC,EAAKJ,CAAM,GACvB,CAACO,GAAKC,CAAG,IAAIC,EAAOT,CAAM;AAChC,SAAIG,MAAc,UAAaI,MAAQ,UAAaC,MAAQ,UAAaA,MAAQD,IACtE,CAACF,MA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AAavB,EAAUV,EAAQ,KAAK,GAAGiE,CAAa,IAAIA,GACpG1C;AAAA,EACX,GAAG,CAAA,CAAE,GAGDrC,EAAO,KAAK,YAAY,CAAC,MAAM,UAC/BA,EAAO,KAAK,YAAY,CAAC,IAAI,IAE7BA,EAAO,KAAK,YAAY,CAAC,MAAM,WAC/BA,EAAO,KAAK,YAAY,CAAC,IAAI,IAG1BA;AACX;"}
|
|
1
|
+
{"version":3,"file":"getCells.js","sources":["../../src/heatmap/getCells.ts"],"sourcesContent":["import { deviation, extent, mean, quantileSorted } from 'd3-array';\nimport lodash from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { AggregationMethod, ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { exhaustive } from '../utils';\n\nfunction normalizeByStd(values: number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / stdValue;\n}\nfunction normalizeByMinMax(values: number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined || max === min) {\n return (v: number) => v;\n }\n return (v: number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method: NormalizationMethod, values: number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v: number) => v;\n}\n\nfunction aggregateNumeric(method: AggregationMethod, values: number[]) {\n switch (method) {\n case 'max': {\n let res = values[0];\n for (const v of values) {\n res = Math.max(res, v);\n }\n return res;\n }\n case 'min': {\n let res = values[0];\n for (const v of values) {\n res = Math.min(res, v);\n }\n return res;\n }\n case 'median': {\n const valuesSorted = values.sort((a, b) => a - b);\n return quantileSorted(valuesSorted, 0.5) as number;\n }\n case 'mean': {\n return mean(values) ?? values[0];\n }\n default: exhaustive(method, `Unknown aggregation function ${method}`);\n }\n}\nfunction aggregateString(values: string[]) {\n const list = [...new Set(values)].sort();\n if (list.length > 3) {\n return [...list.slice(0, 3), '...'].join(', ');\n }\n return list.join(', ');\n}\n\nexport type Cell = {\n isCell: true;\n idx: number;\n id: string;\n value: DataValue;\n normalizedValue: DataValue;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData = {\n meta: {\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // for titles, if facet by more 1 columns title has several values separated by commas\n facetKeyValues: Record<string, string[]>;\n xGroupKeyValues: Record<string, string[]>;\n yGroupKeyValues: Record<string, string[]>;\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n valueExtent: [number, number]; // for color scales\n // data for labels, annotations and dendrograms\n xDataByKeys: Record<string, Record<string, DataValue>>;\n yDataByKeys: Record<string, Record<string, DataValue>>;\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // axis keys grouped by group keys from meta\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell>>;\n }\n >;\n};\n\n// all combinations with 1 key from each list\nfunction getKeysCombinations(keysLists: string[][]) {\n if (!keysLists.length) {\n return [];\n }\n let result: string[][] = [[]];\n keysLists.forEach(keys => {\n const nextResult: string[][] = [];\n keys.forEach(key => {\n nextResult.push(...result.map(resultItem => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\nconst sortByLabels = (arr: string[], direction: 'asc' | 'desc', labels: Record<string, string> = {}) => {\n return arr.sort((a, b) => direction === 'asc'\n ? (labels[a] ?? a).localeCompare((labels[b] ?? b), 'en', { numeric: true })\n : (labels[b] ?? b).localeCompare((labels[a] ?? a), 'en', { numeric: true })\n );\n};\n\nfunction createEmptyGroupedCells(): GroupedCellsData {\n return {\n meta: {\n facetKeys: [],\n xGroupKeys: [],\n yGroupKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n xLabels: {},\n yLabels: {},\n xGroupLabels: {},\n yGroupLabels: {},\n xDataByKeys: {},\n yDataByKeys: {},\n facetKeyValues: {},\n xGroupKeyValues: {},\n yGroupKeyValues: {},\n valueExtent: [Infinity, -Infinity],\n },\n facets: {},\n };\n}\n\nfunction applyAggregation(\n result: GroupedCellsData,\n aggregation: HeatmapSettingsImpl['aggregation'],\n additionalDataColumnsX: string[],\n additionalDataColumnsY: string[],\n annotations: HeatmapSettingsImpl['annotations']\n) {\n if (aggregation.x || aggregation.y) {\n const valueExtent = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n const { xKeys, yKeys, cells, xKeysByGroups, yKeysByGroups } = result.facets[facetKey];\n const xGroups = aggregation.x ? xKeysByGroups : xKeys.reduce((res, xKey) => { res[xKey] = [xKey]; return res; }, {} as Record<string, string[]>);\n const yGroups = aggregation.y ? yKeysByGroups : yKeys.reduce((res, yKey) => { res[yKey] = [yKey]; return res; }, {} as Record<string, string[]>);\n const xNewKeys = Object.keys(xGroups);\n const yNewKeys = Object.keys(yGroups);\n for (const xGroupKey of xNewKeys) {\n for (const yGroupKey of yNewKeys) {\n const values: number[] = [];\n xGroups[xGroupKey].forEach((xKey) => {\n yGroups[yGroupKey].forEach((yKey) => {\n const cellValue = cells[xKey]?.[yKey]?.value;\n if (cellValue !== undefined) {\n values.push(cellValue as number);\n delete cells[xKey]?.[yKey];\n }\n });\n });\n if (values.length > 0) {\n const value = aggregateNumeric(aggregation.method, values);\n if (!result.facets[facetKey].cells[xGroupKey]) {\n result.facets[facetKey].cells[xGroupKey] = {};\n }\n result.facets[facetKey].cells[xGroupKey][yGroupKey] = {\n isCell: true,\n idx: 0,\n id: `${xGroupKey}_${yGroupKey}`,\n x: xGroupKey,\n y: yGroupKey,\n value,\n normalizedValue: value,\n };\n valueExtent[0] = Math.min(value, valueExtent[0]);\n valueExtent[1] = Math.max(value, valueExtent[1]);\n }\n }\n }\n if (aggregation.x) {\n xNewKeys.forEach(xGroupKey => {\n additionalDataColumnsX.forEach(columnKey => {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n return;\n }\n const values: DataValue[] = [];\n xGroups[xGroupKey].forEach((xKey) => {\n values.push(result.meta.xDataByKeys[columnKey][xKey]);\n delete result.meta.xDataByKeys[columnKey][xKey];\n });\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.xDataByKeys[columnKey][xGroupKey] = value;\n });\n });\n }\n if (aggregation.y) {\n additionalDataColumnsY.forEach(columnKey => {\n result.meta.yDataByKeys[columnKey] = {};\n });\n yNewKeys.forEach(yGroupKey => {\n additionalDataColumnsY.forEach(columnKey => {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n return;\n }\n const values: DataValue[] = [];\n yGroups[yGroupKey].forEach((yKey) => {\n values.push(result.meta.yDataByKeys[columnKey][yKey]);\n delete result.meta.yDataByKeys[columnKey][yKey];\n });\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.yDataByKeys[columnKey][yGroupKey] = value;\n });\n });\n }\n if (aggregation.x) {\n result.facets[facetKey].xKeys = Object.keys(xKeysByGroups);\n result.facets[facetKey].xKeysByGroups = { 'null': result.facets[facetKey].xKeys };\n result.meta.xLabels = result.meta.xGroupLabels;\n result.meta.xGroupKeys = ['null'];\n result.meta.xGroupKeyValues = { null: ['null'] };\n }\n if (aggregation.y) {\n result.facets[facetKey].yKeys = Object.keys(yKeysByGroups);\n result.facets[facetKey].yKeysByGroups = { 'null': result.facets[facetKey].yKeys };\n result.meta.yLabels = result.meta.yGroupLabels;\n result.meta.yGroupKeys = ['null'];\n result.meta.yGroupKeyValues = { null: ['null'] };\n }\n });\n result.meta.valueExtent = valueExtent;\n }\n}\nfunction applyNormalization(result: GroupedCellsData, normalization: HeatmapSettingsImpl['normalization']) {\n if (normalization) {\n const valueExtent = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n const { xKeys, yKeys, cells } = result.facets[facetKey];\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter = normalization.direction === 'row'\n ? (cellKey: string, groupKey: string) => cells[cellKey]?.[groupKey]\n : (cellKey: string, groupKey: string) => cells[groupKey]?.[cellKey];\n groupKeys.forEach((groupKey) => {\n const values: number[] = [];\n cellKeys.forEach((cellKey) => {\n const v = cellGetter(cellKey, groupKey)?.value;\n if (v !== undefined) {\n values.push(v as number);\n }\n });\n const normalize = getNormalizationFn(normalization.method, values);\n cellKeys.forEach((cellKey) => {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n cell.normalizedValue = normalize(cell.value as number);\n valueExtent[0] = Math.min(cell.normalizedValue, valueExtent[0]);\n valueExtent[1] = Math.max(cell.normalizedValue, valueExtent[1]);\n }\n });\n });\n });\n result.meta.valueExtent = valueExtent;\n }\n}\n\nexport function getCells(\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumn: ColumnName,\n facetBy: ColumnName[],\n xGroupBy: ColumnName[],\n yGroupBy: ColumnName[],\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n normalization: HeatmapSettingsImpl['normalization'],\n NAValueAs: HeatmapSettingsImpl['NAValueAs'],\n keysOrder: HeatmapSettingsImpl['keysOrder'],\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n aggregation: HeatmapSettingsImpl['aggregation'],\n): GroupedCellsData {\n const result: GroupedCellsData = createEmptyGroupedCells();\n\n const facetKeysLists = facetBy.length\n ? facetBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const xGroupKeysLists = xGroupBy.length\n ? xGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const yGroupKeysLists = yGroupBy.length\n ? yGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const facetKeysCombinations = getKeysCombinations(facetKeysLists);\n const xGroupKeysCombinations = getKeysCombinations(xGroupKeysLists);\n const yGroupKeysCombinations = getKeysCombinations(yGroupKeysLists);\n\n const facetKeys = facetKeysCombinations.map(keys => keys.join('_'));\n const xGroupKeys = xGroupKeysCombinations.map(keys => keys.join('_'));\n const yGroupKeys = yGroupKeysCombinations.map(keys => keys.join('_'));\n\n result.meta.facetKeys = facetKeys;\n result.meta.xGroupKeys = xGroupKeys;\n result.meta.yGroupKeys = yGroupKeys;\n result.meta.facetKeyValues = facetKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = facetKeysCombinations[index];\n return res;\n }, {});\n result.meta.xGroupKeyValues = xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {});\n result.meta.yGroupKeyValues = yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\n }, {});\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n const annotationColumnsX = annotations.filter(item => item.axis === 'x').map(item => item.valueColumn.valueLabels ?? item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.valueLabels ?? item.valueColumn.value);\n const dendrogramXColumns = Object.values(dendrogramX ?? {}).map(column => column.value);\n const dendrogramYColumns = Object.values(dendrogramY ?? {}).map(column => column.value);\n const additionalDataColumnsX = lodash.uniq([...annotationColumnsX, ...dendrogramXColumns, xLabelsSource]);\n const additionalDataColumnsY = lodash.uniq([...annotationColumnsY, ...dendrogramYColumns, yLabelsSource]);\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = facetBy.length ? facetBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const yGroupKey = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupLabel = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n const yGroupLabel = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n result.meta.xGroupLabels[xGroupKey] = xGroupLabel;\n result.meta.yGroupLabels[yGroupKey] = yGroupLabel;\n const x = String(data.getColumnValue(xColumn.value, i));\n const y = String(data.getColumnValue(yColumn.value, i));\n const value = (data.getColumnValue(valueColumn.value, i) ?? NAValueAs) as number | null;\n\n if (x === 'null' || y === 'null' || value === null) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n cells: {},\n };\n }\n if (!result.facets[facetKey].xKeysByGroups[xGroupKey]) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = [];\n }\n if (!result.facets[facetKey].yKeysByGroups[yGroupKey]) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = [];\n }\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].yKeys.push(y);\n result.facets[facetKey].xKeysByGroups[xGroupKey].push(x);\n result.facets[facetKey].yKeysByGroups[yGroupKey].push(y);\n\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n result.meta.valueExtent[0] = Math.min(value, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value, result.meta.valueExtent[1]);\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const xLabelsSourceValue = data.getColumnValue(xLabelsSource, i);\n if (result.meta.xLabels[x] && String(xLabelsSourceValue) !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n const yLabelsSourceValue = data.getColumnValue(yLabelsSource, i);\n if (result.meta.yLabels[y] && String(yLabelsSourceValue) !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.xLabels[x] = String(xLabelsSourceValue);\n result.meta.yLabels[y] = String(yLabelsSourceValue);\n // data for labels, annotations and dendrograms by X\n additionalDataColumnsX.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.xDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.xDataByKeys[columnKey][x] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.xDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.xDataByKeys[columnKey][x] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for x = ${x} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.xDataByKeys[columnKey][x] = data.getColumnValue(columnKey, i);\n }\n });\n // data for labels, annotations and dendrograms by Y\n additionalDataColumnsY.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.yDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.yDataByKeys[columnKey][y] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.yDataByKeys[columnKey][y] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for y = ${y} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.yDataByKeys[columnKey][y] = data.getColumnValue(columnKey, i);\n }\n });\n result.facets[facetKey].cells[x][y] = {\n isCell: true,\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value,\n normalizedValue: value,\n };\n }\n\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n result.meta.facetKeys.forEach(facetKey => {\n const facet = result.facets[facetKey];\n const uniqueXKeys = lodash.uniq(facet.xKeys);\n const uniqueYKeys = lodash.uniq(facet.yKeys);\n facet.xKeys = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], uniqueXKeys) : uniqueXKeys;\n facet.yKeys = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], uniqueYKeys) : uniqueYKeys;\n xGroupKeys.forEach(xGroupKey => {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = lodash.intersection(\n facet.xKeys,\n result.facets[facetKey].xKeysByGroups[xGroupKey]\n );\n });\n yGroupKeys.forEach(yGroupKey => {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = lodash.intersection(\n facet.yKeys,\n result.facets[facetKey].yKeysByGroups[yGroupKey]\n );\n });\n });\n\n applyAggregation(result, aggregation, additionalDataColumnsX, additionalDataColumnsY, annotations);\n applyNormalization(result, normalization);\n\n // every facet may contain not all of available keys, but for shared axes it is necessary to have all of them\n result.meta.xKeysByGroups = result.meta.xGroupKeys.reduce((res: Record<string, string[]>, xGroupKey) => {\n const existingXKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].xKeysByGroups[xGroupKey]))\n ), xAxis.sorting, result.meta.xLabels);\n res[xGroupKey] = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], existingXKeys) : existingXKeys;\n return res;\n }, {});\n result.meta.yKeysByGroups = result.meta.yGroupKeys.reduce((res: Record<string, string[]>, yGroupKey) => {\n const existingYKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].yKeysByGroups[yGroupKey]))\n ), yAxis.sorting, result.meta.yLabels);\n res[yGroupKey] = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], existingYKeys) : existingYKeys;\n return res;\n }, {});\n\n // avoid render errors on empty data\n if (result.meta.valueExtent[0] === Infinity) {\n result.meta.valueExtent[0] = 0;\n }\n if (result.meta.valueExtent[1] === -Infinity) {\n result.meta.valueExtent[1] = 0;\n }\n\n return result;\n}\n"],"names":["normalizeByStd","values","stdValue","deviation","meanValue","mean","v","normalizeByMinMax","min","max","extent","getNormalizationFn","method","aggregateNumeric","res","valuesSorted","a","b","quantileSorted","exhaustive","aggregateString","list","getKeysCombinations","keysLists","result","keys","nextResult","key","resultItem","sortByLabels","arr","direction","labels","createEmptyGroupedCells","applyAggregation","aggregation","additionalDataColumnsX","additionalDataColumnsY","annotations","valueExtent","facetKey","xKeys","yKeys","cells","xKeysByGroups","yKeysByGroups","xGroups","xKey","yGroups","yKey","xNewKeys","yNewKeys","xGroupKey","yGroupKey","cellValue","_b","_a","_c","value","columnKey","annotation","applyNormalization","normalization","cellKeys","groupKeys","cellGetter","cellKey","groupKey","normalize","cell","getCells","data","xColumn","yColumn","valueColumn","facetBy","xGroupBy","yGroupBy","dendrogramX","dendrogramY","NAValueAs","keysOrder","xAxis","yAxis","facetKeysLists","column","xGroupKeysLists","yGroupKeysLists","facetKeysCombinations","xGroupKeysCombinations","yGroupKeysCombinations","facetKeys","xGroupKeys","yGroupKeys","index","xLabelsSource","yLabelsSource","annotationColumnsX","item","annotationColumnsY","dendrogramXColumns","dendrogramYColumns","lodash","i","xGroupLabel","yGroupLabel","x","y","xLabelsSourceValue","yLabelsSourceValue","isAddedColumn","isAddedValue","facet","uniqueXKeys","uniqueYKeys","existingXKeys","existingYKeys"],"mappings":";;;;;;AAOA,SAASA,GAAeC,GAAkB;AACtC,QAAMC,IAAWC,GAAUF,CAAM,GAC3BG,IAAYC,EAAKJ,CAAM;AAE7B,SAAIC,MAAa,UAAaE,MAAc,UAAaF,MAAa,IAC3D,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;QACnC,eAAe,EAAE,eAAe,CAAC;QACjC,cAAc,EAAE,SAAS,EAAE,CAAC;KAC/B,GAAG,IAAI,CAAQ;gBAEJ,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAC,EAAC,oBAAoB;IAS3F,KAAK,CAAC,IAAI,EAAE,WAAW;IAevB,OAAO;IAIP,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe;IAuBhE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAIhD,MAAM,IAAI,MAAM;IAKhB,mCAAmC,CAAC,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,mBAAmB;IAiEpG,+BAA+B,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS;IAUpE,WAAW;IAgDX,gBAAgB;IAIhB,YAAY;CAkDf"}
|
package/dist/heatmap/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (
|
|
4
|
-
import { renderToString as
|
|
5
|
-
import { AbstractChart as
|
|
6
|
-
import { isColumnName as
|
|
7
|
-
import
|
|
8
|
-
import { getCells as
|
|
9
|
-
import { getDendrograms as
|
|
10
|
-
import { HeatmapSettingsImpl as
|
|
11
|
-
import { MAX_SVG_RENDERED_CELLS_COUNT as
|
|
12
|
-
class
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var F = (C, l, a) => l in C ? K(C, l, { enumerable: !0, configurable: !0, writable: !0, value: a }) : C[l] = a;
|
|
3
|
+
var A = (C, l, a) => F(C, typeof l != "symbol" ? l + "" : l, a);
|
|
4
|
+
import { renderToString as J } from "../node_modules/react-dom/server.browser.js";
|
|
5
|
+
import { AbstractChart as P } from "../AbstractChart.js";
|
|
6
|
+
import { isColumnName as R } from "../utils/index.js";
|
|
7
|
+
import Q from "./ChartRenderer.js";
|
|
8
|
+
import { getCells as W } from "./getCells.js";
|
|
9
|
+
import { getDendrograms as Z } from "./getDendrograms.js";
|
|
10
|
+
import { HeatmapSettingsImpl as q } from "./HeatmapSettingsImpl.js";
|
|
11
|
+
import { MAX_SVG_RENDERED_CELLS_COUNT as $ } from "./constants.js";
|
|
12
|
+
class la extends P {
|
|
13
13
|
constructor(a, e, t) {
|
|
14
14
|
super(a, e);
|
|
15
15
|
A(this, "settings");
|
|
16
|
-
A(this, "chartRenderer", new
|
|
16
|
+
A(this, "chartRenderer", new Q());
|
|
17
17
|
A(this, "onTooltipHintSwitch", () => {
|
|
18
18
|
});
|
|
19
19
|
A(this, "calculatedData", null);
|
|
20
|
-
this.settings = new
|
|
20
|
+
this.settings = new q(e), t && (this.onTooltipHintSwitch = t[0]);
|
|
21
21
|
}
|
|
22
22
|
mount(a) {
|
|
23
23
|
try {
|
|
@@ -31,8 +31,8 @@ class na extends L {
|
|
|
31
31
|
}
|
|
32
32
|
updateSettingsAndData(a, e) {
|
|
33
33
|
try {
|
|
34
|
-
const t = this.settings,
|
|
35
|
-
this.settings = new
|
|
34
|
+
const t = this.settings, d = this.data;
|
|
35
|
+
this.settings = new q(e), this.data = a, this._needUpdateCalculatedDataBySettings(t, this.settings) || this._needUpdateCalculatedDataByData(d, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
|
|
36
36
|
} catch (t) {
|
|
37
37
|
t instanceof Error && (this.chartRenderer.renderError(t.message), console.error(t));
|
|
38
38
|
}
|
|
@@ -41,42 +41,43 @@ class na extends L {
|
|
|
41
41
|
console.warn("no chart state for heatmap");
|
|
42
42
|
}
|
|
43
43
|
export() {
|
|
44
|
-
return this._updateChart(),
|
|
44
|
+
return this._updateChart(), J(this.chartRenderer.component);
|
|
45
45
|
}
|
|
46
46
|
_needUpdateCalculatedDataBySettings(a, e) {
|
|
47
|
-
var
|
|
47
|
+
var c, Y, E, O, v, k, N, T, b, w, U, j, V, H, I;
|
|
48
48
|
const {
|
|
49
49
|
xColumn: t,
|
|
50
|
-
yColumn:
|
|
51
|
-
valueColumn:
|
|
52
|
-
xGroupBy:
|
|
53
|
-
yGroupBy:
|
|
50
|
+
yColumn: d,
|
|
51
|
+
valueColumn: u,
|
|
52
|
+
xGroupBy: i,
|
|
53
|
+
yGroupBy: h,
|
|
54
54
|
facetBy: D,
|
|
55
55
|
annotations: _,
|
|
56
|
-
chartSettings:
|
|
57
|
-
facetSettings:
|
|
58
|
-
dendrogramX:
|
|
59
|
-
dendrogramY:
|
|
56
|
+
chartSettings: y,
|
|
57
|
+
facetSettings: o,
|
|
58
|
+
dendrogramX: m,
|
|
59
|
+
dendrogramY: g,
|
|
60
60
|
normalization: n,
|
|
61
|
+
aggregation: r,
|
|
61
62
|
NAValueAs: p
|
|
62
|
-
} = e, x = Object.values(((
|
|
63
|
-
|
|
64
|
-
), B = Object.values((
|
|
65
|
-
|
|
66
|
-
),
|
|
67
|
-
function s(f,
|
|
68
|
-
return f.length !==
|
|
63
|
+
} = e, x = Object.values(((c = a.dendrogramX) == null ? void 0 : c.aes) || {}).filter(
|
|
64
|
+
R
|
|
65
|
+
), B = Object.values((m == null ? void 0 : m.aes) || {}).filter(R), X = Object.values(((Y = a.dendrogramY) == null ? void 0 : Y.aes) || {}).filter(
|
|
66
|
+
R
|
|
67
|
+
), G = Object.values((g == null ? void 0 : g.aes) || {}).filter(R);
|
|
68
|
+
function s(f, M) {
|
|
69
|
+
return f.length !== M.length || f.some((z, L) => z.value !== M[L].value);
|
|
69
70
|
}
|
|
70
|
-
return a.xColumn.value !== t.value || a.yColumn.value !==
|
|
71
|
+
return a.xColumn.value !== t.value || a.yColumn.value !== d.value || a.valueColumn.value !== u.value || s(a.xGroupBy, i) || s(a.yGroupBy, h) || s(a.facetBy, D) || s(
|
|
71
72
|
a.annotations.map((f) => f.valueColumn),
|
|
72
73
|
_.map((f) => f.valueColumn)
|
|
73
|
-
) || s(x, B) || s(
|
|
74
|
+
) || s(x, B) || s(X, G) || (e.dendrogramX || a.dendrogramX) && (((E = a.dendrogramX) == null ? void 0 : E.distance) !== ((O = e.dendrogramX) == null ? void 0 : O.distance) || ((v = a.dendrogramX) == null ? void 0 : v.linkage) !== ((k = e.dendrogramX) == null ? void 0 : k.linkage)) || (e.dendrogramY || a.dendrogramY) && (((N = a.dendrogramY) == null ? void 0 : N.distance) !== ((T = e.dendrogramY) == null ? void 0 : T.distance) || ((b = a.dendrogramY) == null ? void 0 : b.linkage) !== ((w = e.dendrogramY) == null ? void 0 : w.linkage)) || a.chartSettings.valueType !== y.valueType || a.facetSettings.sharedX !== o.sharedX || a.facetSettings.sharedY !== o.sharedY || ((U = a.normalization) == null ? void 0 : U.method) !== (n == null ? void 0 : n.method) || ((j = a.normalization) == null ? void 0 : j.direction) !== (n == null ? void 0 : n.direction) || a.NAValueAs !== p || ((V = a.aggregation) == null ? void 0 : V.method) !== (r == null ? void 0 : r.method) || ((H = a.aggregation) == null ? void 0 : H.x) !== (r == null ? void 0 : r.x) || ((I = a.aggregation) == null ? void 0 : I.y) !== (r == null ? void 0 : r.y);
|
|
74
75
|
}
|
|
75
76
|
_needUpdateCalculatedDataByData(a, e) {
|
|
76
|
-
const t = Object.keys(a.data),
|
|
77
|
-
return a.id !== e.id || t.length !==
|
|
78
|
-
var
|
|
79
|
-
return a.data[
|
|
77
|
+
const t = Object.keys(a.data), d = Object.keys(e.data);
|
|
78
|
+
return a.id !== e.id || t.length !== d.length || t.some((u) => {
|
|
79
|
+
var i;
|
|
80
|
+
return a.data[u].length !== ((i = e.data[u]) == null ? void 0 : i.length);
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
_updateData() {
|
|
@@ -84,34 +85,36 @@ class na extends L {
|
|
|
84
85
|
xColumn: a,
|
|
85
86
|
yColumn: e,
|
|
86
87
|
valueColumn: t,
|
|
87
|
-
xGroupBy:
|
|
88
|
-
yGroupBy:
|
|
89
|
-
facetBy:
|
|
90
|
-
chartSettings:
|
|
88
|
+
xGroupBy: d,
|
|
89
|
+
yGroupBy: u,
|
|
90
|
+
facetBy: i,
|
|
91
|
+
chartSettings: h,
|
|
91
92
|
facetSettings: D,
|
|
92
93
|
annotations: _,
|
|
93
|
-
dendrogramX:
|
|
94
|
-
dendrogramY:
|
|
95
|
-
normalization:
|
|
96
|
-
NAValueAs:
|
|
97
|
-
keysOrder: n
|
|
98
|
-
|
|
94
|
+
dendrogramX: y,
|
|
95
|
+
dendrogramY: o,
|
|
96
|
+
normalization: m,
|
|
97
|
+
NAValueAs: g,
|
|
98
|
+
keysOrder: n,
|
|
99
|
+
aggregation: r
|
|
100
|
+
} = this.settings, p = W(
|
|
99
101
|
this.data,
|
|
100
102
|
a,
|
|
101
103
|
e,
|
|
102
104
|
t,
|
|
105
|
+
i,
|
|
106
|
+
d,
|
|
103
107
|
u,
|
|
104
|
-
o,
|
|
105
|
-
l,
|
|
106
108
|
_,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
h,
|
|
109
|
+
y,
|
|
110
|
+
o,
|
|
110
111
|
m,
|
|
112
|
+
g,
|
|
111
113
|
n,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
h.xAxis,
|
|
115
|
+
h.yAxis,
|
|
116
|
+
r
|
|
117
|
+
), x = Z(p, y, o, D), B = h.valueType === "discrete" ? this.data.getColumnCategories(t.value) : [];
|
|
115
118
|
this.calculatedData = {
|
|
116
119
|
groupedCellsData: p,
|
|
117
120
|
dendrogramsData: x,
|
|
@@ -121,59 +124,59 @@ class na extends L {
|
|
|
121
124
|
_updateAesInData() {
|
|
122
125
|
}
|
|
123
126
|
_updateChart() {
|
|
124
|
-
var X,
|
|
127
|
+
var X, G;
|
|
125
128
|
if (!this.calculatedData)
|
|
126
129
|
return;
|
|
127
130
|
const {
|
|
128
131
|
id: a,
|
|
129
132
|
valueColumn: e,
|
|
130
133
|
chartSettings: t,
|
|
131
|
-
facetSettings:
|
|
132
|
-
aes:
|
|
133
|
-
annotations:
|
|
134
|
-
dendrogramX:
|
|
134
|
+
facetSettings: d,
|
|
135
|
+
aes: u,
|
|
136
|
+
annotations: i,
|
|
137
|
+
dendrogramX: h,
|
|
135
138
|
dendrogramY: D,
|
|
136
139
|
inheritedDendrogramAes: _,
|
|
137
|
-
normalization:
|
|
138
|
-
keysOrder:
|
|
139
|
-
xColumn:
|
|
140
|
-
yColumn:
|
|
140
|
+
normalization: y,
|
|
141
|
+
keysOrder: o,
|
|
142
|
+
xColumn: m,
|
|
143
|
+
yColumn: g,
|
|
141
144
|
xGroupBy: n,
|
|
142
|
-
yGroupBy:
|
|
143
|
-
} = this.settings,
|
|
144
|
-
x: ((X =
|
|
145
|
-
y: ((
|
|
146
|
-
xGroup: n.some((
|
|
147
|
-
var
|
|
148
|
-
return ((
|
|
145
|
+
yGroupBy: r
|
|
146
|
+
} = this.settings, p = {
|
|
147
|
+
x: ((X = o[m.value]) == null ? void 0 : X.length) > 0,
|
|
148
|
+
y: ((G = o[g.value]) == null ? void 0 : G.length) > 0,
|
|
149
|
+
xGroup: n.some((s) => {
|
|
150
|
+
var c;
|
|
151
|
+
return ((c = o[s.value]) == null ? void 0 : c.length) > 0;
|
|
149
152
|
}),
|
|
150
|
-
yGroup:
|
|
151
|
-
var
|
|
152
|
-
return ((
|
|
153
|
+
yGroup: r.some((s) => {
|
|
154
|
+
var c;
|
|
155
|
+
return ((c = o[s.value]) == null ? void 0 : c.length) > 0;
|
|
153
156
|
})
|
|
154
|
-
},
|
|
157
|
+
}, x = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0, B = this.settings.cellsRenderingMode ?? (x > $ ? "canvas" : "svg");
|
|
155
158
|
this.chartRenderer.render(
|
|
156
159
|
this.data,
|
|
157
160
|
a,
|
|
158
161
|
t,
|
|
159
|
-
|
|
160
|
-
l,
|
|
161
|
-
this.calculatedData.groupedCellsData,
|
|
162
|
+
d,
|
|
162
163
|
u,
|
|
164
|
+
this.calculatedData.groupedCellsData,
|
|
165
|
+
i,
|
|
163
166
|
e,
|
|
164
|
-
|
|
167
|
+
h,
|
|
165
168
|
D,
|
|
166
169
|
this.calculatedData.dendrogramsData,
|
|
167
170
|
_,
|
|
168
171
|
this.calculatedData.cellUniqValues,
|
|
169
|
-
|
|
172
|
+
y,
|
|
170
173
|
this.onTooltipHintSwitch,
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
p,
|
|
175
|
+
B
|
|
173
176
|
);
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
export {
|
|
177
|
-
|
|
180
|
+
la as ChartHeatmap
|
|
178
181
|
};
|
|
179
182
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/heatmap/index.ts"],"sourcesContent":["import { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, HeatmapEventHandlers, HeatmapSettings } from '../types';\nimport { isColumnName } from '../utils';\nimport ChartRenderer from './ChartRenderer';\nimport type { GroupedCellsData } from './getCells';\nimport { getCells } from './getCells';\nimport type { DendrogramsData } from './getDendrograms';\nimport { getDendrograms } from './getDendrograms';\nimport { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { MAX_SVG_RENDERED_CELLS_COUNT } from './constants';\n\nexport class ChartHeatmap extends AbstractChart {\n settings: HeatmapSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n groupedCellsData: GroupedCellsData;\n dendrogramsData: DendrogramsData;\n cellUniqValues: DataValue[];\n } | null = null;\n\n constructor(data: DataFrame, settings: HeatmapSettings, eventHandlers?:HeatmapEventHandlers) {\n super(data, settings);\n\n this.settings = new HeatmapSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: HeatmapSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new HeatmapSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for heatmap');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: HeatmapSettingsImpl, settings: HeatmapSettingsImpl) {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n annotations,\n chartSettings,\n facetSettings,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n } = settings;\n\n const prevDendrogramXColumns: ColumnName[] = Object.values(prevSettings.dendrogramX?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramXColumns: ColumnName[] = Object.values(dendrogramX?.aes || {}).filter(isColumnName);\n const prevDendrogramYColumns: ColumnName[] = Object.values(prevSettings.dendrogramY?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramYColumns: ColumnName[] = Object.values(dendrogramY?.aes || {}).filter(isColumnName);\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.xColumn.value !== xColumn.value ||\n prevSettings.yColumn.value !== yColumn.value ||\n prevSettings.valueColumn.value !== valueColumn.value ||\n compareColumnGroups(prevSettings.xGroupBy, xGroupBy) ||\n compareColumnGroups(prevSettings.yGroupBy, yGroupBy) ||\n compareColumnGroups(prevSettings.facetBy, facetBy) ||\n compareColumnGroups(\n prevSettings.annotations.map(a => a.valueColumn),\n annotations.map(a => a.valueColumn)\n ) ||\n compareColumnGroups(prevDendrogramXColumns, currentDendrogramXColumns) ||\n compareColumnGroups(prevDendrogramYColumns, currentDendrogramYColumns) ||\n ((settings.dendrogramX || prevSettings.dendrogramX) &&\n (prevSettings.dendrogramX?.distance !== settings.dendrogramX?.distance ||\n prevSettings.dendrogramX?.linkage !== settings.dendrogramX?.linkage)) ||\n ((settings.dendrogramY || prevSettings.dendrogramY) &&\n (prevSettings.dendrogramY?.distance !== settings.dendrogramY?.distance ||\n prevSettings.dendrogramY?.linkage !== settings.dendrogramY?.linkage)) ||\n prevSettings.chartSettings.valueType !== chartSettings.valueType ||\n prevSettings.facetSettings.sharedX !== facetSettings.sharedX ||\n prevSettings.facetSettings.sharedY !== facetSettings.sharedY ||\n prevSettings.normalization?.method !== normalization?.method ||\n prevSettings.normalization?.direction !== normalization?.direction ||\n prevSettings.NAValueAs !== NAValueAs\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n chartSettings,\n facetSettings,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder\n } = this.settings;\n\n const groupedCellsData = getCells(\n this.data,\n xColumn,\n yColumn,\n valueColumn,\n facetBy,\n xGroupBy,\n yGroupBy,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder,\n chartSettings.xAxis,\n chartSettings.yAxis,\n );\n const dendrogramsData = getDendrograms(groupedCellsData, dendrogramX, dendrogramY, facetSettings);\n const cellUniqValues =\n chartSettings.valueType === 'discrete' ? this.data.getColumnCategories(valueColumn.value) : [];\n\n this.calculatedData = {\n groupedCellsData,\n dendrogramsData,\n cellUniqValues,\n };\n }\n\n _updateAesInData() {\n return;\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n id,\n valueColumn,\n chartSettings,\n facetSettings,\n aes,\n annotations,\n dendrogramX,\n dendrogramY,\n inheritedDendrogramAes,\n normalization,\n keysOrder,\n xColumn,\n yColumn,\n xGroupBy,\n yGroupBy,\n } = this.settings;\n const customOrder = {\n x: keysOrder[xColumn.value]?.length > 0,\n y: keysOrder[yColumn.value]?.length > 0,\n xGroup: xGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n yGroup: yGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n };\n const dataSize = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0;\n const cellsRenderingMode = this.settings.cellsRenderingMode ?? (dataSize > MAX_SVG_RENDERED_CELLS_COUNT ? 'canvas' : 'svg');\n \n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n aes,\n this.calculatedData.groupedCellsData,\n annotations,\n valueColumn,\n dendrogramX,\n dendrogramY,\n this.calculatedData.dendrogramsData,\n inheritedDendrogramAes,\n this.calculatedData.cellUniqValues,\n normalization,\n this.onTooltipHintSwitch,\n customOrder,\n cellsRenderingMode\n );\n }\n}\n"],"names":["ChartHeatmap","AbstractChart","data","settings","eventHandlers","__publicField","ChartRenderer","HeatmapSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","xColumn","yColumn","valueColumn","xGroupBy","yGroupBy","facetBy","annotations","chartSettings","facetSettings","dendrogramX","dendrogramY","normalization","NAValueAs","prevDendrogramXColumns","_a","isColumnName","currentDendrogramXColumns","prevDendrogramYColumns","_b","currentDendrogramYColumns","compareColumnGroups","columns1","columns2","column","idx","a","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","prevData","prevKeys","keys","key","keysOrder","groupedCellsData","getCells","dendrogramsData","getDendrograms","cellUniqValues","id","aes","inheritedDendrogramAes","customOrder","v","dataSize","cellsRenderingMode","MAX_SVG_RENDERED_CELLS_COUNT"],"mappings":";;;;;;;;;;;AAaO,MAAMA,WAAqBC,EAAc;AAAA,EAW5C,YAAYC,GAAiBC,GAA2BC,GAAqC;AACzF,UAAMF,GAAMC,CAAQ;AAXxB,IAAAE,EAAA;AACA,IAAAA,EAAA,uBAAgB,IAAIC,EAAA;AAEpB,IAAAD,EAAA,6BAA2C,MAAA;AAAA;AAC3C,IAAAA,EAAA,wBAIW;AAKP,SAAK,WAAW,IAAIE,EAAoBJ,CAAQ,GAC5CC,MACA,KAAK,sBAAsBA,EAAc,CAAC;AAAA,EAElD;AAAA,EAEA,MAAMI,GAAmB;AACrB,QAAI;AACA,WAAK,cAAc,KAAKA,CAAI,GAC5B,KAAK,YAAA,GACL,KAAK,aAAA,GACL,KAAK,WAAW;AAAA,IACpB,SAASC,GAAK;AACV,WAAK,WAAW,IACZA,aAAe,UACf,KAAK,cAAc,YAAYA,EAAI,OAAiB,GACpD,QAAQ,MAAMA,CAAG;AAAA,IAEzB;AAAA,EACJ;AAAA,EAEA,UAAU;AACN,SAAK,cAAc,MAAA;AAAA,EACvB;AAAA,EAEA,sBAAsBP,GAAiBC,GAA2B;AAC9D,QAAI;AACA,YAAMO,IAAmB,KAAK,UACxBC,IAAe,KAAK;AAC1B,WAAK,WAAW,IAAIJ,EAAoBJ,CAAQ,GAChD,KAAK,OAAOD,GAER,KAAK,oCAAoCQ,GAAkB,KAAK,QAAQ,KACxE,KAAK,gCAAgCC,GAAc,KAAK,IAAI,IAE5D,KAAK,YAAA,IAEL,KAAK,iBAAA,GAET,KAAK,aAAA;AAAA,IACT,SAASF,GAAK;AACV,MAAIA,aAAe,UACf,KAAK,cAAc,YAAYA,EAAI,OAAiB,GACpD,QAAQ,MAAMA,CAAG;AAAA,IA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A,MAChB,KAAGnC,IAAA0B,EAAUxC,EAAQ,KAAK,MAAvB,gBAAAc,EAA0B,UAAS;AAAA,MACtC,KAAGI,IAAAsB,EAAUvC,EAAQ,KAAK,MAAvB,gBAAAiB,EAA0B,UAAS;AAAA,MACtC,QAAQf,EAAS,KAAK,CAAC+C,MAAA;;AAAM,iBAAApC,IAAA0B,EAAUU,EAAE,KAAK,MAAjB,gBAAApC,EAAoB,UAAS;AAAA,OAAC;AAAA,MAC3D,QAAQV,EAAS,KAAK,CAAC8C,MAAA;;AAAM,iBAAApC,IAAA0B,EAAUU,EAAE,KAAK,MAAjB,gBAAApC,EAAoB,UAAS;AAAA,OAAC;AAAA,IAAA,GAEzDqC,IAAW,KAAK,KAAK,YAAY,SAAS,KAAK,KAAK,UAAU,KAAK,KAAK,YAAY,CAAC,CAAC,EAAE,SAAS,GACjGC,IAAqB,KAAK,SAAS,uBAAuBD,IAAWE,IAA+B,WAAW;AAErH,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACLP;AAAA,MACAvC;AAAA,MACAC;AAAA,MACAuC;AAAA,MACA,KAAK,eAAe;AAAA,MACpBzC;AAAA,MACAJ;AAAA,MACAO;AAAA,MACAC;AAAA,MACA,KAAK,eAAe;AAAA,MACpBsC;AAAA,MACA,KAAK,eAAe;AAAA,MACpBrC;AAAA,MACA,KAAK;AAAA,MACLsC;AAAA,MACAG;AAAA,IAAA;AAAA,EAER;AACJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/heatmap/index.ts"],"sourcesContent":["import { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, HeatmapEventHandlers, HeatmapSettings } from '../types';\nimport { isColumnName } from '../utils';\nimport ChartRenderer from './ChartRenderer';\nimport type { GroupedCellsData } from './getCells';\nimport { getCells } from './getCells';\nimport type { DendrogramsData } from './getDendrograms';\nimport { getDendrograms } from './getDendrograms';\nimport { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { MAX_SVG_RENDERED_CELLS_COUNT } from './constants';\n\nexport class ChartHeatmap extends AbstractChart {\n settings: HeatmapSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n groupedCellsData: GroupedCellsData;\n dendrogramsData: DendrogramsData;\n cellUniqValues: DataValue[];\n } | null = null;\n\n constructor(data: DataFrame, settings: HeatmapSettings, eventHandlers?:HeatmapEventHandlers) {\n super(data, settings);\n\n this.settings = new HeatmapSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: HeatmapSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new HeatmapSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for heatmap');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: HeatmapSettingsImpl, settings: HeatmapSettingsImpl) {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n annotations,\n chartSettings,\n facetSettings,\n dendrogramX,\n dendrogramY,\n normalization,\n aggregation,\n NAValueAs,\n } = settings;\n\n const prevDendrogramXColumns: ColumnName[] = Object.values(prevSettings.dendrogramX?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramXColumns: ColumnName[] = Object.values(dendrogramX?.aes || {}).filter(isColumnName);\n const prevDendrogramYColumns: ColumnName[] = Object.values(prevSettings.dendrogramY?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramYColumns: ColumnName[] = Object.values(dendrogramY?.aes || {}).filter(isColumnName);\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.xColumn.value !== xColumn.value ||\n prevSettings.yColumn.value !== yColumn.value ||\n prevSettings.valueColumn.value !== valueColumn.value ||\n compareColumnGroups(prevSettings.xGroupBy, xGroupBy) ||\n compareColumnGroups(prevSettings.yGroupBy, yGroupBy) ||\n compareColumnGroups(prevSettings.facetBy, facetBy) ||\n compareColumnGroups(\n prevSettings.annotations.map(a => a.valueColumn),\n annotations.map(a => a.valueColumn)\n ) ||\n compareColumnGroups(prevDendrogramXColumns, currentDendrogramXColumns) ||\n compareColumnGroups(prevDendrogramYColumns, currentDendrogramYColumns) ||\n ((settings.dendrogramX || prevSettings.dendrogramX) &&\n (prevSettings.dendrogramX?.distance !== settings.dendrogramX?.distance ||\n prevSettings.dendrogramX?.linkage !== settings.dendrogramX?.linkage)) ||\n ((settings.dendrogramY || prevSettings.dendrogramY) &&\n (prevSettings.dendrogramY?.distance !== settings.dendrogramY?.distance ||\n prevSettings.dendrogramY?.linkage !== settings.dendrogramY?.linkage)) ||\n prevSettings.chartSettings.valueType !== chartSettings.valueType ||\n prevSettings.facetSettings.sharedX !== facetSettings.sharedX ||\n prevSettings.facetSettings.sharedY !== facetSettings.sharedY ||\n prevSettings.normalization?.method !== normalization?.method ||\n prevSettings.normalization?.direction !== normalization?.direction ||\n prevSettings.NAValueAs !== NAValueAs ||\n prevSettings.aggregation?.method !== aggregation?.method ||\n prevSettings.aggregation?.x !== aggregation?.x ||\n prevSettings.aggregation?.y !== aggregation?.y\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n chartSettings,\n facetSettings,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder,\n aggregation\n } = this.settings;\n\n const groupedCellsData = getCells(\n this.data,\n xColumn,\n yColumn,\n valueColumn,\n facetBy,\n xGroupBy,\n yGroupBy,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder,\n chartSettings.xAxis,\n chartSettings.yAxis,\n aggregation\n );\n const dendrogramsData = getDendrograms(groupedCellsData, dendrogramX, dendrogramY, facetSettings);\n const cellUniqValues =\n chartSettings.valueType === 'discrete' ? this.data.getColumnCategories(valueColumn.value) : [];\n\n this.calculatedData = {\n groupedCellsData,\n dendrogramsData,\n cellUniqValues,\n };\n }\n\n _updateAesInData() {\n return;\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n id,\n valueColumn,\n chartSettings,\n facetSettings,\n aes,\n annotations,\n dendrogramX,\n dendrogramY,\n inheritedDendrogramAes,\n normalization,\n keysOrder,\n xColumn,\n yColumn,\n xGroupBy,\n yGroupBy,\n } = this.settings;\n const customOrder = {\n x: keysOrder[xColumn.value]?.length > 0,\n y: keysOrder[yColumn.value]?.length > 0,\n xGroup: xGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n yGroup: yGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n };\n const dataSize = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0;\n const cellsRenderingMode = this.settings.cellsRenderingMode ?? (dataSize > MAX_SVG_RENDERED_CELLS_COUNT ? 'canvas' : 'svg');\n \n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n aes,\n this.calculatedData.groupedCellsData,\n annotations,\n valueColumn,\n dendrogramX,\n dendrogramY,\n this.calculatedData.dendrogramsData,\n inheritedDendrogramAes,\n this.calculatedData.cellUniqValues,\n normalization,\n this.onTooltipHintSwitch,\n customOrder,\n cellsRenderingMode\n );\n }\n}\n"],"names":["ChartHeatmap","AbstractChart","data","settings","eventHandlers","__publicField","ChartRenderer","HeatmapSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","xColumn","yColumn","valueColumn","xGroupBy","yGroupBy","facetBy","annotations","chartSettings","facetSettings","dendrogramX","dendrogramY","normalization","aggregation","NAValueAs","prevDendrogramXColumns","_a","isColumnName","currentDendrogramXColumns","prevDendrogramYColumns","_b","currentDendrogramYColumns","compareColumnGroups","columns1","columns2","column","idx","a","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","_m","_n","_o","prevData","prevKeys","keys","key","keysOrder","groupedCellsData","getCells","dendrogramsData","getDendrograms","cellUniqValues","id","aes","inheritedDendrogramAes","customOrder","v","dataSize","cellsRenderingMode","MAX_SVG_RENDERED_CELLS_COUNT"],"mappings":";;;;;;;;;;;AAaO,MAAMA,WAAqBC,EAAc;AAAA,EAW5C,YAAYC,GAAiBC,GAA2BC,GAAqC;AACzF,UAAMF,GAAMC,CAAQ;AAXxB,IAAAE,EAAA;AACA,IAAAA,EAAA,uBAAgB,IAAIC,EAAA;AAEpB,IAAAD,EAAA,6BAA2C,MAAA;AAAA;AAC3C,IAAAA,EAAA,wBAIW;AAKP,SAAK,WAAW,IAAIE,EAAoBJ,CAAQ,GAC5CC,MACA,KAAK,sBAAsBA,EAAc,CAAC;AAAA,EAElD;AAAA,EAEA,MAAMI,GAAmB;AACrB,QAAI;AACA,WAAK,cAAc,KAAKA,CAAI,GAC5B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QAAQX,EAAS,KAAK,CAACkD,MAAA;;AAAM,iBAAAvC,IAAA6B,EAAUU,EAAE,KAAK,MAAjB,gBAAAvC,EAAoB,UAAS;AAAA,OAAC;AAAA,IAAA,GAEzDwC,IAAW,KAAK,KAAK,YAAY,SAAS,KAAK,KAAK,UAAU,KAAK,KAAK,YAAY,CAAC,CAAC,EAAE,SAAS,GACjGC,IAAqB,KAAK,SAAS,uBAAuBD,IAAWE,IAA+B,WAAW;AAErH,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACLP;AAAA,MACA3C;AAAA,MACAC;AAAA,MACA2C;AAAA,MACA,KAAK,eAAe;AAAA,MACpB7C;AAAA,MACAJ;AAAA,MACAO;AAAA,MACAC;AAAA,MACA,KAAK,eAAe;AAAA,MACpB0C;AAAA,MACA,KAAK,eAAe;AAAA,MACpBzC;AAAA,MACA,KAAK;AAAA,MACL0C;AAAA,MACAG;AAAA,IAAA;AAAA,EAER;AACJ;"}
|
package/dist/types/heatmap.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type DendrogramDistance = 'euclidean' | 'squaredEuclidean';
|
|
|
3
3
|
export type DendrogramLinkage = 'average' | 'complete' | 'single';
|
|
4
4
|
export type NormalizationDirection = 'row' | 'column';
|
|
5
5
|
export type NormalizationMethod = 'standardScaling' | 'meanNormalization';
|
|
6
|
+
export type AggregationMethod = 'min' | 'max' | 'mean' | 'median';
|
|
6
7
|
export declare const HeatmapSettingsSchema: z.ZodObject<{
|
|
7
8
|
type: z.ZodLiteral<"heatmap">;
|
|
8
9
|
title: z.ZodObject<{
|
|
@@ -310,6 +311,19 @@ export declare const HeatmapSettingsSchema: z.ZodObject<{
|
|
|
310
311
|
method: "standardScaling" | "meanNormalization";
|
|
311
312
|
colorRange?: number[] | undefined;
|
|
312
313
|
}>>;
|
|
314
|
+
aggregation: z.ZodOptional<z.ZodObject<{
|
|
315
|
+
x: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
y: z.ZodOptional<z.ZodBoolean>;
|
|
317
|
+
method: z.ZodOptional<z.ZodEnum<["min", "max", "mean", "median"]>>;
|
|
318
|
+
}, "strip", z.ZodTypeAny, {
|
|
319
|
+
x?: boolean | undefined;
|
|
320
|
+
y?: boolean | undefined;
|
|
321
|
+
method?: "mean" | "median" | "min" | "max" | undefined;
|
|
322
|
+
}, {
|
|
323
|
+
x?: boolean | undefined;
|
|
324
|
+
y?: boolean | undefined;
|
|
325
|
+
method?: "mean" | "median" | "min" | "max" | undefined;
|
|
326
|
+
}>>;
|
|
313
327
|
annotations: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
314
328
|
valueColumn: z.ZodObject<{
|
|
315
329
|
type: z.ZodLiteral<"column">;
|
|
@@ -1236,6 +1250,11 @@ export declare const HeatmapSettingsSchema: z.ZodObject<{
|
|
|
1236
1250
|
valueLabels?: string | undefined;
|
|
1237
1251
|
}[] | undefined;
|
|
1238
1252
|
keysOrder?: Record<string, string[]> | undefined;
|
|
1253
|
+
aggregation?: {
|
|
1254
|
+
x?: boolean | undefined;
|
|
1255
|
+
y?: boolean | undefined;
|
|
1256
|
+
method?: "mean" | "median" | "min" | "max" | undefined;
|
|
1257
|
+
} | undefined;
|
|
1239
1258
|
annotations?: ({
|
|
1240
1259
|
type: "continuous" | "discrete";
|
|
1241
1260
|
valueColumn: {
|
|
@@ -1505,6 +1524,11 @@ export declare const HeatmapSettingsSchema: z.ZodObject<{
|
|
|
1505
1524
|
valueLabels?: string | undefined;
|
|
1506
1525
|
}[] | undefined;
|
|
1507
1526
|
keysOrder?: Record<string, string[]> | undefined;
|
|
1527
|
+
aggregation?: {
|
|
1528
|
+
x?: boolean | undefined;
|
|
1529
|
+
y?: boolean | undefined;
|
|
1530
|
+
method?: "mean" | "median" | "min" | "max" | undefined;
|
|
1531
|
+
} | undefined;
|
|
1508
1532
|
annotations?: ({
|
|
1509
1533
|
type: "continuous" | "discrete";
|
|
1510
1534
|
valueColumn: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/types/heatmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAKlE,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/types/heatmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAKlE,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAqClE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/types/heatmap.js
CHANGED
|
@@ -41,7 +41,7 @@ const e = o.enum(["discrete", "continuous"]), a = o.object({
|
|
|
41
41
|
showGroupLabels: o.optional(o.boolean()),
|
|
42
42
|
axisLabelsAngle: o.optional(o.union([o.literal(0), o.literal(45), o.literal(90)])),
|
|
43
43
|
groupLabelsAngle: o.optional(o.union([o.literal(0), o.literal(45), o.literal(90)]))
|
|
44
|
-
},
|
|
44
|
+
}, x = o.object({
|
|
45
45
|
type: o.literal("heatmap"),
|
|
46
46
|
title: o.object({
|
|
47
47
|
name: o.string(),
|
|
@@ -105,6 +105,11 @@ const e = o.enum(["discrete", "continuous"]), a = o.object({
|
|
|
105
105
|
method: o.enum(["standardScaling", "meanNormalization"]),
|
|
106
106
|
colorRange: o.optional(o.array(o.number()))
|
|
107
107
|
})),
|
|
108
|
+
aggregation: o.optional(o.object({
|
|
109
|
+
x: o.optional(o.boolean()),
|
|
110
|
+
y: o.optional(o.boolean()),
|
|
111
|
+
method: o.optional(o.enum(["min", "max", "mean", "median"]))
|
|
112
|
+
})),
|
|
108
113
|
annotations: o.optional(o.array(o.union([u, c]))),
|
|
109
114
|
dendrogramX: o.optional(d),
|
|
110
115
|
dendrogramY: o.optional(h),
|
|
@@ -123,6 +128,6 @@ const e = o.enum(["discrete", "continuous"]), a = o.object({
|
|
|
123
128
|
}))
|
|
124
129
|
});
|
|
125
130
|
export {
|
|
126
|
-
|
|
131
|
+
x as HeatmapSettingsSchema
|
|
127
132
|
};
|
|
128
133
|
//# sourceMappingURL=heatmap.js.map
|