@milaboratories/miplots4 1.0.178 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bubble/BubbleSettingsImpl.d.ts +2 -0
- package/dist/bubble/BubbleSettingsImpl.d.ts.map +1 -1
- package/dist/bubble/BubbleSettingsImpl.js +3 -1
- package/dist/bubble/BubbleSettingsImpl.js.map +1 -1
- package/dist/bubble/getGroupedCellsData.d.ts +1 -1
- package/dist/bubble/getGroupedCellsData.d.ts.map +1 -1
- package/dist/bubble/getGroupedCellsData.js +30 -10
- package/dist/bubble/getGroupedCellsData.js.map +1 -1
- package/dist/bubble/index.d.ts.map +1 -1
- package/dist/bubble/index.js +3 -3
- package/dist/bubble/index.js.map +1 -1
- package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
- package/dist/heatmap/ChartRenderer.js +26 -20
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +2 -0
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +3 -1
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/fillCellsData.d.ts +22 -2
- package/dist/heatmap/fillCellsData.d.ts.map +1 -1
- package/dist/heatmap/fillCellsData.js +60 -47
- package/dist/heatmap/fillCellsData.js.map +1 -1
- package/dist/heatmap/getCells.d.ts +22 -1
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +23 -3
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/getDendrograms.d.ts +5 -1
- package/dist/heatmap/getDendrograms.d.ts.map +1 -1
- package/dist/heatmap/getDendrograms.js +33 -11
- package/dist/heatmap/getDendrograms.js.map +1 -1
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +30 -6
- package/dist/heatmap/index.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.d.ts +2 -2
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +155 -115
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +11 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +20 -0
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.d.ts +5 -0
- package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.js +115 -35
- package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +2 -0
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.d.ts +11 -2
- package/dist/scatterplot/getLayersData.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.js +36 -19
- package/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/scatterplot/index.d.ts.map +1 -1
- package/dist/scatterplot/index.js +51 -33
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot/linearRegression.js +1 -1
- package/dist/scatterplot/utils/createAesGetter.d.ts.map +1 -1
- package/dist/scatterplot/utils/createAesGetter.js +5 -3
- package/dist/scatterplot/utils/createAesGetter.js.map +1 -1
- package/dist/scatterplot/utils/createLegendInfo.d.ts +11 -2
- package/dist/scatterplot/utils/createLegendInfo.d.ts.map +1 -1
- package/dist/scatterplot/utils/createLegendInfo.js +21 -16
- package/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.d.ts +6 -6
- package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js +99 -57
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +11 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js +21 -1
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.d.ts +3 -2
- package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +159 -108
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
- package/dist/scatterplot-umap/components/SVGLayer.js +9 -8
- package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
- package/dist/scatterplot-umap/index.d.ts +6 -1
- package/dist/scatterplot-umap/index.d.ts.map +1 -1
- package/dist/scatterplot-umap/index.js +65 -31
- package/dist/scatterplot-umap/index.js.map +1 -1
- package/dist/scatterplot-umap/types.d.ts +7 -0
- package/dist/scatterplot-umap/types.d.ts.map +1 -1
- package/dist/types/bubble.d.ts +6 -0
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/bubble.js +3 -1
- package/dist/types/bubble.js.map +1 -1
- package/dist/types/heatmap.d.ts +6 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +2 -0
- package/dist/types/heatmap.js.map +1 -1
- package/dist/types/scatterplot-umap.d.ts +763 -87
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +19 -3
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +1377 -44
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/types/scatterplot.js +27 -3
- package/dist/types/scatterplot.js.map +1 -1
- package/package.json +1 -1
|
@@ -21,28 +21,33 @@ function t(t, n, r) {
|
|
|
21
21
|
function n(e) {
|
|
22
22
|
return typeof e == "object" && "type" in e && e.type === "grouping";
|
|
23
23
|
}
|
|
24
|
-
function r(e, r, i) {
|
|
25
|
-
return r.reduce((r,
|
|
26
|
-
let
|
|
24
|
+
function r(e, r, i, a) {
|
|
25
|
+
return r.reduce((r, o) => {
|
|
26
|
+
let s = o.columnName, c = s.nullValueLabel ?? "NA", l = o.order, u = (t) => s.valueLabels ? e.getColumnValueCategory(s.valueLabels, t) : void 0, d = /* @__PURE__ */ new Set(), f = {};
|
|
27
27
|
i.forEach((e) => {
|
|
28
28
|
e.aes && Object.entries(e.aes).forEach(([e, t]) => {
|
|
29
|
-
n(t) && t.value ===
|
|
29
|
+
n(t) && t.value === s.value && (d.add(e), f[e] = t.palette);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
let t = e.
|
|
32
|
+
for (let e of a?.curves ?? []) {
|
|
33
|
+
n(e.lineColor) && e.lineColor.value === s.value && (d.add("lineColor"), e.lineColor.palette && (f.lineColor = e.lineColor.palette));
|
|
34
|
+
let t = e.trend?.color;
|
|
35
|
+
t && n(t) && t.value === s.value && (d.add("lineColor"), t.palette && (f.lineColor = t.palette));
|
|
36
|
+
}
|
|
37
|
+
let p = {}, m = [];
|
|
38
|
+
if (d.has("dotFill") || d.has("dotShape") || d.has("lineColor")) {
|
|
39
|
+
let t = e.getColumnCategories(s.value, !1);
|
|
35
40
|
if (t.length < 100) {
|
|
36
|
-
|
|
37
|
-
let n = t.reduce((e, t) => (e[t] =
|
|
38
|
-
|
|
39
|
-
} else
|
|
41
|
+
p = t.reduce((t, n) => (t[n] = u(e.getColumnCategoryRowIndex(s.value, n)) ?? n, t[n] === "null" && (t[n] = c), t), p);
|
|
42
|
+
let n = t.reduce((e, t) => (e[t] = l?.indexOf(t) ?? -1, e), {});
|
|
43
|
+
m = t.sort((e, t) => n[e] === n[t] ? p[e]?.localeCompare(p[t] ?? "", "en", { numeric: !0 }) ?? 0 : n[e] - n[t]);
|
|
44
|
+
} else m = t;
|
|
40
45
|
}
|
|
41
|
-
return r[
|
|
42
|
-
values:
|
|
43
|
-
usedAes: [...
|
|
44
|
-
aesMap: t(
|
|
45
|
-
labels:
|
|
46
|
+
return r[s.value] = {
|
|
47
|
+
values: m,
|
|
48
|
+
usedAes: [...d],
|
|
49
|
+
aesMap: t(s, f, o.inheritedAes),
|
|
50
|
+
labels: p
|
|
46
51
|
}, r;
|
|
47
52
|
}, {});
|
|
48
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLegendInfo.js","names":[],"sources":["../../../src/scatterplot/utils/createLegendInfo.ts"],"sourcesContent":["import { MAX_SHOWN_UNIQUE_VALUES_IN_LABELS } from '../../constants';\nimport type { DataFrame } from '../../DataFrame';\nimport type {AesRecord} from '../../types';\nimport type {\n AesItem,\n Category,\n ColumnName,\n ContinuousAesFromColumn,\n InheritAesScatterplot,\n ScatterplotLayer,\n ScatterplotLegendInfo\n} from '../../types';\nimport type { ScatterplotSettingsImpl } from '../ScatterplotSettingsImpl';\n\nconst categoryIndexer = (() => {\n const map = new Map<string, Map<Category, number>>();\n const clear = () => map.clear();\n const getIndex = (columnName: ColumnName, category: Category): number => {\n let categoryMap = map.get(columnName.value);\n if (categoryMap === undefined) {\n categoryMap = new Map();\n map.set(columnName.value, categoryMap);\n }\n let index = categoryMap.get(category);\n if (index === undefined) {\n index = categoryMap.size;\n categoryMap.set(category, index);\n }\n return index;\n };\n\n return {\n clear,\n getIndex,\n };\n})();\n\nexport function addPalettesToAesMapping(\n columnName: ColumnName,\n usedAesFromPalettes: Partial<Record<keyof AesItem, string[]>>,\n inheritedAes?: AesRecord\n) {\n categoryIndexer.clear();\n const hasInheritedAes = inheritedAes && Object.keys(inheritedAes).length > 0;\n const dotFill = usedAesFromPalettes['dotFill'];\n const hasDotFill = dotFill && dotFill.length > 0;\n const lineColor = usedAesFromPalettes['lineColor'];\n const hasLineColor = lineColor && lineColor.length > 0;\n const getAesField = (category: Category, field: keyof AesItem) => {\n const inheritedResult = hasInheritedAes ? inheritedAes[category]?.[field] : undefined;\n // Use inherited when defined; otherwise generate from palette so overflow categories get a color\n if (field === 'dotFill' && hasDotFill) {\n return inheritedResult ?? dotFill[categoryIndexer.getIndex(columnName, category) % dotFill.length];\n }\n if (field === 'lineColor' && hasLineColor) {\n return inheritedResult ?? lineColor[categoryIndexer.getIndex(columnName, category) % lineColor.length];\n }\n return inheritedResult;\n };\n\n return getAesField;\n}\n\nfunction isInheritMapping<T extends (string | number)>(value:T | InheritAesScatterplot | ContinuousAesFromColumn<T>):value is InheritAesScatterplot {\n return typeof value === 'object' && 'type' in value && value.type === 'grouping';\n}\nexport function createLegendInfo(\n data: DataFrame,\n grouping: ScatterplotSettingsImpl['grouping'],\n layers: ScatterplotLayer[],\n): ScatterplotLegendInfo {\n return grouping.reduce((res: ScatterplotLegendInfo, groupingElement) => {\n // TODO: remove String conversion\n const column = groupingElement.columnName;\n const nullValueLabel = column.nullValueLabel ?? 'NA';\n const order = groupingElement.order;\n const getValueLabel = (index: number) => {\n return column.valueLabels\n ? data.getColumnValueCategory(column.valueLabels, index)\n : undefined;\n };\n\n const usedAes = new Set<keyof AesItem>();\n const usedAesFromPalettes:Partial<Record<keyof AesItem, string[]>> = {}; // if there is palette in mapping then\n layers.forEach(layer => {\n if (!layer.aes) return;\n
|
|
1
|
+
{"version":3,"file":"createLegendInfo.js","names":[],"sources":["../../../src/scatterplot/utils/createLegendInfo.ts"],"sourcesContent":["import { MAX_SHOWN_UNIQUE_VALUES_IN_LABELS } from '../../constants';\nimport type { DataFrame } from '../../DataFrame';\nimport type {AesRecord} from '../../types';\nimport type {\n AesItem,\n Category,\n ColumnName,\n ContinuousAesFromColumn,\n InheritAesScatterplot,\n ScatterplotLayer,\n ScatterplotLegendInfo\n} from '../../types';\nimport type { ScatterplotSettingsImpl } from '../ScatterplotSettingsImpl';\n\nconst categoryIndexer = (() => {\n const map = new Map<string, Map<Category, number>>();\n const clear = () => map.clear();\n const getIndex = (columnName: ColumnName, category: Category): number => {\n let categoryMap = map.get(columnName.value);\n if (categoryMap === undefined) {\n categoryMap = new Map();\n map.set(columnName.value, categoryMap);\n }\n let index = categoryMap.get(category);\n if (index === undefined) {\n index = categoryMap.size;\n categoryMap.set(category, index);\n }\n return index;\n };\n\n return {\n clear,\n getIndex,\n };\n})();\n\nexport function addPalettesToAesMapping(\n columnName: ColumnName,\n usedAesFromPalettes: Partial<Record<keyof AesItem, string[]>>,\n inheritedAes?: AesRecord\n) {\n categoryIndexer.clear();\n const hasInheritedAes = inheritedAes && Object.keys(inheritedAes).length > 0;\n const dotFill = usedAesFromPalettes['dotFill'];\n const hasDotFill = dotFill && dotFill.length > 0;\n const lineColor = usedAesFromPalettes['lineColor'];\n const hasLineColor = lineColor && lineColor.length > 0;\n const getAesField = (category: Category, field: keyof AesItem) => {\n const inheritedResult = hasInheritedAes ? inheritedAes[category]?.[field] : undefined;\n // Use inherited when defined; otherwise generate from palette so overflow categories get a color\n if (field === 'dotFill' && hasDotFill) {\n return inheritedResult ?? dotFill[categoryIndexer.getIndex(columnName, category) % dotFill.length];\n }\n if (field === 'lineColor' && hasLineColor) {\n return inheritedResult ?? lineColor[categoryIndexer.getIndex(columnName, category) % lineColor.length];\n }\n return inheritedResult;\n };\n\n return getAesField;\n}\n\nfunction isInheritMapping<T extends (string | number)>(value:T | InheritAesScatterplot | ContinuousAesFromColumn<T>):value is InheritAesScatterplot {\n return typeof value === 'object' && 'type' in value && value.type === 'grouping';\n}\n// Structural minimum needed from `additionalCurves` for legend-info collection. Scatterplot and UMAP\n// each have their own full AdditionalCurves type (scatterplot has a per-entry `trend` sub-object, UMAP\n// doesn't), but this function only reads `lineColor` + optional `trend.color`, so a narrow shape lets\n// both call sites share this helper without fighting the type system.\ntype LegendAdditionalCurves = {\n curves: ReadonlyArray<{\n lineColor: string | InheritAesScatterplot | ContinuousAesFromColumn<string>;\n trend?: { color?: string | InheritAesScatterplot | ContinuousAesFromColumn<string> };\n }>;\n};\n\nexport function createLegendInfo(\n data: DataFrame,\n grouping: ScatterplotSettingsImpl['grouping'],\n layers: ScatterplotLayer[],\n additionalCurves?: LegendAdditionalCurves | null,\n): ScatterplotLegendInfo {\n return grouping.reduce((res: ScatterplotLegendInfo, groupingElement) => {\n // TODO: remove String conversion\n const column = groupingElement.columnName;\n const nullValueLabel = column.nullValueLabel ?? 'NA';\n const order = groupingElement.order;\n const getValueLabel = (index: number) => {\n return column.valueLabels\n ? data.getColumnValueCategory(column.valueLabels, index)\n : undefined;\n };\n\n const usedAes = new Set<keyof AesItem>();\n const usedAesFromPalettes:Partial<Record<keyof AesItem, string[]>> = {}; // if there is palette in mapping then\n layers.forEach(layer => {\n if (!layer.aes) return;\n\n Object.entries(layer.aes).forEach(([key, value]) => {\n if (!(isInheritMapping(value) && value.value === column.value)) return;\n\n usedAes.add(key as keyof AesItem);\n usedAesFromPalettes[key as keyof AesItem] = value.palette;\n });\n });\n // Additional-curve entries contribute `lineColor` (and trend.color) to this grouping's aesMap\n // whenever their color is grouping-inherited against this column. Without this, the renderer's\n // per-group resolution falls back to DEFAULT_COMMON_AES since the column has no registered\n // lineColor palette.\n for (const entry of additionalCurves?.curves ?? []) {\n if (isInheritMapping(entry.lineColor) && entry.lineColor.value === column.value) {\n usedAes.add('lineColor');\n if (entry.lineColor.palette) {\n usedAesFromPalettes['lineColor'] = entry.lineColor.palette;\n }\n }\n const trendColor = entry.trend?.color;\n if (trendColor && isInheritMapping(trendColor) && trendColor.value === column.value) {\n usedAes.add('lineColor');\n if (trendColor.palette) {\n usedAesFromPalettes['lineColor'] = trendColor.palette;\n }\n }\n }\n let labels: Record<Category, string> = {};\n let values: Category[] = [];\n if (usedAes.has('dotFill') || usedAes.has('dotShape') || usedAes.has('lineColor')) {\n const categories = data.getColumnCategories(column.value, false);\n if (categories.length < MAX_SHOWN_UNIQUE_VALUES_IN_LABELS) {\n labels = categories.reduce((res, category) => {\n const index = data.getColumnCategoryRowIndex(column.value, category);\n res[category] = getValueLabel(index) ?? category;\n if (res[category] === 'null') {\n res[category] = nullValueLabel;\n }\n return res;\n }, labels);\n const sortWeights = categories.reduce((res, v) => {\n res[v] = order?.indexOf(v) ?? -1;\n return res;\n }, {} as Record<string, number>);\n values = categories.sort((a, b) => {\n if (sortWeights[a] !== sortWeights[b]) {\n return sortWeights[a] - sortWeights[b];\n }\n return labels[a]?.localeCompare(labels[b] ?? '', 'en', {numeric: true}) ?? 0;\n });\n } else {\n values = categories;\n }\n }\n res[column.value] = {\n values,\n usedAes: [...usedAes],\n aesMap: addPalettesToAesMapping(column, usedAesFromPalettes, groupingElement.inheritedAes),\n labels,\n };\n return res;\n }, {});\n}"],"mappings":"AAcA,IAAM,WAAyB;CAC3B,IAAM,oBAAM,IAAI,KAAoC;AAgBpD,QAAO;EACH,aAhBgB,EAAI,OAAO;EAiB3B,WAhBc,GAAwB,MAA+B;GACrE,IAAI,IAAc,EAAI,IAAI,EAAW,MAAM;AAC3C,GAAI,MAAgB,KAAA,MAChB,oBAAc,IAAI,KAAK,EACvB,EAAI,IAAI,EAAW,OAAO,EAAY;GAE1C,IAAI,IAAQ,EAAY,IAAI,EAAS;AAKrC,UAJI,MAAU,KAAA,MACV,IAAQ,EAAY,MACpB,EAAY,IAAI,GAAU,EAAM,GAE7B;;EAMV;IACD;AAEJ,SAAgB,EACZ,GACA,GACA,GACF;AACE,GAAgB,OAAO;CACvB,IAAM,IAAkB,KAAgB,OAAO,KAAK,EAAa,CAAC,SAAS,GACrE,IAAU,EAAoB,SAC9B,IAAa,KAAW,EAAQ,SAAS,GACzC,IAAY,EAAoB,WAChC,IAAe,KAAa,EAAU,SAAS;AAarD,SAZqB,GAAoB,MAAyB;EAC9D,IAAM,IAAkB,IAAkB,EAAa,KAAY,KAAS,KAAA;AAQ5E,SANI,MAAU,aAAa,IAChB,KAAmB,EAAQ,EAAgB,SAAS,GAAY,EAAS,GAAG,EAAQ,UAE3F,MAAU,eAAe,IAClB,KAAmB,EAAU,EAAgB,SAAS,GAAY,EAAS,GAAG,EAAU,UAE5F;;;AAMf,SAAS,EAA8C,GAA6F;AACh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,IACR,EAAO;IACV,IAAM,IAAc,EAAW,QAAQ,GAAK,OACxC,EAAI,KAAK,GAAO,QAAQ,EAAE,IAAI,IACvB,IACR,EAAE,CAA2B;AAChC,QAAS,EAAW,MAAM,GAAG,MACrB,EAAY,OAAO,EAAY,KAG5B,EAAO,IAAI,cAAc,EAAO,MAAM,IAAI,MAAM,EAAC,SAAS,IAAK,CAAC,IAAI,IAFhE,EAAY,KAAK,EAAY,GAG1C;SAEF,KAAS;;AASjB,SANA,EAAI,EAAO,SAAS;GAChB;GACA,SAAS,CAAC,GAAG,EAAQ;GACrB,QAAQ,EAAwB,GAAQ,GAAqB,EAAgB,aAAa;GAC1F;GACH,EACM;IACR,EAAE,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { Label } from '../scatterplot/utils/getVisibleLabels';
|
|
|
7
7
|
import { ColumnName, ScatterplotEventHandlers } from '../types';
|
|
8
8
|
import { ScatterplotUmapLegendInfo } from '../types/scatterplot-umap';
|
|
9
9
|
import { ScatterplotUmapLayer, ScatterplotUmapSettingsImpl } from './SettingsImpl';
|
|
10
|
-
import { AesGetters, CaptionsSizes, ChartScales, ChartSizes, Dot, DotsExtents, LassoControlsState, Margins, Polygon, SVGLayerProps } from './types';
|
|
10
|
+
import { AdditionalCurveRenderData, AesGetters, CaptionsSizes, ChartScales, ChartSizes, Dot, DotsExtents, LassoControlsState, Margins, Polygon, SVGLayerProps } from './types';
|
|
11
11
|
import { default as KDBush } from 'kdbush';
|
|
12
12
|
import { DataFrame } from '../DataFrame';
|
|
13
13
|
declare class ChartRenderer {
|
|
@@ -52,16 +52,16 @@ declare class ChartRenderer {
|
|
|
52
52
|
updateCaptionsSize(): void;
|
|
53
53
|
createMainTitle(title: ScatterplotUmapSettingsImpl['chartSettings']['title']): void;
|
|
54
54
|
updateMargins(xAxis: ScatterplotUmapSettingsImpl['chartSettings']['xAxis'], yAxis: ScatterplotUmapSettingsImpl['chartSettings']['yAxis']): void;
|
|
55
|
-
updateLegendSize(legend: ScatterplotUmapSettingsImpl['chartSettings']['legend'], legendLabels: ScatterplotUmapLegendInfo, grouping: ColumnName[], layers: ScatterplotUmapLayer[]): void;
|
|
56
|
-
initSettings(dots: Dot[], chartSettings: ScatterplotUmapSettingsImpl['chartSettings'], dotExtents: DotsExtents, legendInfo: ScatterplotUmapLegendInfo, layers: ScatterplotUmapSettingsImpl['layers'], grouping: ColumnName[], onZoomChange: (v: boolean) => void): void;
|
|
55
|
+
updateLegendSize(legend: ScatterplotUmapSettingsImpl['chartSettings']['legend'], legendLabels: ScatterplotUmapLegendInfo, grouping: ColumnName[], layers: ScatterplotUmapLayer[], additionalCurves: ScatterplotUmapSettingsImpl['additionalCurves'], yColumn: ColumnName): void;
|
|
56
|
+
initSettings(dots: Dot[], chartSettings: ScatterplotUmapSettingsImpl['chartSettings'], dotExtents: DotsExtents, legendInfo: ScatterplotUmapLegendInfo, layers: ScatterplotUmapSettingsImpl['layers'], grouping: ColumnName[], onZoomChange: (v: boolean) => void, additionalCurves: ScatterplotUmapSettingsImpl['additionalCurves'], yColumn: ColumnName): void;
|
|
57
57
|
resetZoom(xAxis: ScatterplotUmapSettingsImpl['chartSettings']['xAxis'], yAxis: ScatterplotUmapSettingsImpl['chartSettings']['yAxis'], dotsExtents?: DotsExtents): void;
|
|
58
|
-
updateAes(legendInfo: ScatterplotUmapLegendInfo, layers: ScatterplotUmapSettingsImpl['layers']): void;
|
|
59
|
-
updatePointSize(legendInfo: ScatterplotUmapLegendInfo, layers: ScatterplotUmapSettingsImpl['layers']): void;
|
|
58
|
+
updateAes(legendInfo: ScatterplotUmapLegendInfo, layers: ScatterplotUmapSettingsImpl['layers'], additionalCurves: ScatterplotUmapSettingsImpl['additionalCurves']): void;
|
|
59
|
+
updatePointSize(legendInfo: ScatterplotUmapLegendInfo, layers: ScatterplotUmapSettingsImpl['layers'], additionalCurves: ScatterplotUmapSettingsImpl['additionalCurves']): void;
|
|
60
60
|
updateByLasso(): void;
|
|
61
61
|
createQuadtree(dots: Dot[]): KDBush;
|
|
62
62
|
getClosestDot(_x: number, _y: number): Dot | null;
|
|
63
63
|
updateDots(dots: Dot[]): void;
|
|
64
|
-
render(dataFrame: DataFrame, settingsId: string, chartSettings: ScatterplotUmapSettingsImpl['chartSettings'], keyColumn: ColumnName | null, dots: Dot[], dotExtents: DotsExtents, dotsByGrouping: Record<string, Dot[]>, layers: ScatterplotUmapSettingsImpl['layers'], legendInfo: ScatterplotUmapLegendInfo, grouping: ColumnName[], onPolygonUpdateOutside: ScatterplotEventHandlers['onPolygonUpdate'], onTooltipHintSwitch: (v: boolean) => void, onLassoControlsStateUpdate: (v: LassoControlsState) => void, onZoomChange: (v: boolean) => void): void;
|
|
64
|
+
render(dataFrame: DataFrame, settingsId: string, chartSettings: ScatterplotUmapSettingsImpl['chartSettings'], keyColumn: ColumnName | null, dots: Dot[], dotExtents: DotsExtents, dotsByGrouping: Record<string, Dot[]>, layers: ScatterplotUmapSettingsImpl['layers'], legendInfo: ScatterplotUmapLegendInfo, grouping: ColumnName[], onPolygonUpdateOutside: ScatterplotEventHandlers['onPolygonUpdate'], onTooltipHintSwitch: (v: boolean) => void, onLassoControlsStateUpdate: (v: LassoControlsState) => void, onZoomChange: (v: boolean) => void, additionalCurves: AdditionalCurveRenderData[] | undefined, additionalCurvesSettings: ScatterplotUmapSettingsImpl["additionalCurves"] | undefined, yColumn: ColumnName): void;
|
|
65
65
|
renderWebglLayer(): void;
|
|
66
66
|
onPolygonUpdate: (p: Polygon[]) => void;
|
|
67
67
|
renderSvgLayer(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartRenderer.d.ts","sourceRoot":"","sources":["../../src/scatterplot-umap/ChartRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIrE,OAAO,KAAK,EAAe,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAA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AAE,yBAAyB,EAAE,YAAK,EAClD,wBAAwB,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,YAAO,EAChF,OAAO,EAAE,UAAU;IAkDvB,gBAAgB;IAMhB,eAAe,GAAI,GAAE,OAAO,EAAE,UAO5B;IAEF,cAAc;IAgCd,WAAW,CAAC,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,aAAa;IAsCrB,OAAO,CAAC,oBAAoB;CAO/B;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -35,12 +35,13 @@ function R(e) {
|
|
|
35
35
|
function z(e, t, n) {
|
|
36
36
|
return n.length === 0 ? !0 : n.some((n) => n.closed && n.points.length > 2 && I(n.points, [e, t]));
|
|
37
37
|
}
|
|
38
|
-
function B(e, t, r) {
|
|
39
|
-
let
|
|
38
|
+
function B(e, t, r, i) {
|
|
39
|
+
let a = r.find((e) => e.type === "dots"), o = r.find((e) => e.type === "curve");
|
|
40
40
|
return {
|
|
41
|
-
dotFill: m(e, t,
|
|
42
|
-
dotSize: m(e, t,
|
|
43
|
-
lineType: m(e, t,
|
|
41
|
+
dotFill: m(e, t, a?.aes.dotFill ?? n.color, "dotFill"),
|
|
42
|
+
dotSize: m(e, t, a?.aes.dotSize ?? n.size, "dotSize"),
|
|
43
|
+
lineType: m(e, t, o?.aes.lineShape ?? "solid", "lineShape"),
|
|
44
|
+
additionalCurveLineColor: (i?.curves ?? []).map((n) => m(e, t, n.lineColor, "lineColor"))
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
var V = class {
|
|
@@ -53,7 +54,8 @@ var V = class {
|
|
|
53
54
|
aesGetters = {
|
|
54
55
|
dotSize: () => 2,
|
|
55
56
|
dotFill: () => t,
|
|
56
|
-
lineType: () => "solid"
|
|
57
|
+
lineType: () => "solid",
|
|
58
|
+
additionalCurveLineColor: []
|
|
57
59
|
};
|
|
58
60
|
tools = null;
|
|
59
61
|
margins = {
|
|
@@ -150,7 +152,7 @@ var V = class {
|
|
|
150
152
|
right: this.legend.width + 24
|
|
151
153
|
}, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartHeight, this.legend.height) + this.margins.bottom, O(this.canvasNode).style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px");
|
|
152
154
|
}
|
|
153
|
-
updateLegendSize(e,
|
|
155
|
+
updateLegendSize(e, a, s, c, u, d) {
|
|
154
156
|
if (!e.show) {
|
|
155
157
|
this.legend = {
|
|
156
158
|
width: 0,
|
|
@@ -159,50 +161,88 @@ var V = class {
|
|
|
159
161
|
};
|
|
160
162
|
return;
|
|
161
163
|
}
|
|
162
|
-
let
|
|
164
|
+
let p = [], m = {
|
|
163
165
|
width: 0,
|
|
164
166
|
height: 0,
|
|
165
167
|
left: 0,
|
|
166
168
|
top: 0
|
|
167
|
-
},
|
|
168
|
-
if (
|
|
169
|
-
let
|
|
170
|
-
if (
|
|
171
|
-
if (
|
|
172
|
-
console.warn(`Too many values for discrete legend (${
|
|
169
|
+
}, h = Math.min(Math.max(this.chartSizes.chartHeight, 250), 400), g = Math.max(this.chartSizes.chartHeight, h);
|
|
170
|
+
if (s.forEach((e) => {
|
|
171
|
+
let t = a[e.value];
|
|
172
|
+
if (t.usedAes.length === 0 || !t.aesMap) return;
|
|
173
|
+
if (t.values.length > 100) {
|
|
174
|
+
console.warn(`Too many values for discrete legend (${t.values.length})`);
|
|
173
175
|
return;
|
|
174
176
|
}
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
let r = {};
|
|
178
|
+
t.values.forEach((e) => {
|
|
179
|
+
r[e] || (r[e] = { ...n }), t.usedAes.forEach((n) => {
|
|
180
|
+
n === "dotFill" && (r[e].color = t.aesMap(e, n) ?? "#110529"), n === "dotSize" && (r[e].size = Number(t.aesMap(e, n) ?? 3));
|
|
179
181
|
});
|
|
180
182
|
});
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
...
|
|
183
|
+
let i = e.label ?? e.value, o = S().domain(t.values).range(t.values.map((e) => r[e]));
|
|
184
|
+
p.push({
|
|
185
|
+
...m,
|
|
184
186
|
id: e.value,
|
|
185
187
|
type: "dots",
|
|
186
|
-
title:
|
|
188
|
+
title: i,
|
|
187
189
|
scale: o,
|
|
188
|
-
values:
|
|
189
|
-
labels:
|
|
190
|
+
values: t.values,
|
|
191
|
+
labels: t.labels
|
|
190
192
|
});
|
|
191
|
-
}),
|
|
193
|
+
}), c.forEach((e) => {
|
|
192
194
|
if (e.type === "dots" && r(e.aes.dotFill)) {
|
|
193
|
-
let { domain: t, range: n, columnName: r, type: a = "linear" } = e.aes.dotFill, o = r.label ?? r.value, s = f(n, t, "linear"),
|
|
194
|
-
|
|
195
|
-
...
|
|
195
|
+
let { domain: t, range: n, columnName: r, type: a = "linear" } = e.aes.dotFill, o = r.label ?? r.value, s = f(n, t, "linear"), c = (a === "log" ? C() : b()).domain(t).range([h, 0]), l = i(c, t);
|
|
196
|
+
p.push({
|
|
197
|
+
...m,
|
|
196
198
|
id: "dotFill",
|
|
197
199
|
type: "continuous",
|
|
198
200
|
title: o,
|
|
199
201
|
scale: s,
|
|
200
|
-
tickPositionScale:
|
|
201
|
-
values:
|
|
202
|
+
tickPositionScale: c,
|
|
203
|
+
values: l
|
|
202
204
|
});
|
|
203
205
|
}
|
|
204
|
-
e.type === "dots" && r(e.aes.dotSize) &&
|
|
205
|
-
}),
|
|
206
|
+
e.type === "dots" && r(e.aes.dotSize) && p.push(o(e.aes.dotSize));
|
|
207
|
+
}), u && u.curves.length > 0) {
|
|
208
|
+
let e = t, n = [], r = {}, i = {}, a = c.find((e) => e.type === "curve");
|
|
209
|
+
if (a) {
|
|
210
|
+
let t = d.label ?? d.value, o = typeof a.aes.lineColor == "string" ? a.aes.lineColor : e;
|
|
211
|
+
n.push(t), r[t] = t, i[t] = {
|
|
212
|
+
lineShape: a.aes.lineShape,
|
|
213
|
+
lineColor: o
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
for (let t of u.curves) {
|
|
217
|
+
let a = t.label, o = 1;
|
|
218
|
+
for (; n.includes(a);) a = `${t.label} (${++o})`;
|
|
219
|
+
let s = typeof t.lineColor == "string" ? t.lineColor : e;
|
|
220
|
+
n.push(a), r[a] = a, i[a] = {
|
|
221
|
+
lineShape: t.lineShape,
|
|
222
|
+
lineColor: s
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
if (n.length > 0) {
|
|
226
|
+
let e = S().domain(n).range(n.map((e) => i[e])).unknown({});
|
|
227
|
+
p.push({
|
|
228
|
+
...m,
|
|
229
|
+
id: "additionalCurves",
|
|
230
|
+
type: "discreteMulti",
|
|
231
|
+
title: "Curves",
|
|
232
|
+
scale: e,
|
|
233
|
+
values: n,
|
|
234
|
+
labels: r,
|
|
235
|
+
usedAes: {
|
|
236
|
+
lineShape: !0,
|
|
237
|
+
lineColor: !0,
|
|
238
|
+
dotFill: !1,
|
|
239
|
+
dotShape: !1,
|
|
240
|
+
fillColor: !1
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (!p.length) {
|
|
206
246
|
this.legend = {
|
|
207
247
|
width: 0,
|
|
208
248
|
height: 0,
|
|
@@ -210,27 +250,27 @@ var V = class {
|
|
|
210
250
|
};
|
|
211
251
|
return;
|
|
212
252
|
}
|
|
213
|
-
let
|
|
253
|
+
let _ = l(p, g, h);
|
|
214
254
|
this.legend = {
|
|
215
|
-
width:
|
|
216
|
-
height:
|
|
217
|
-
items:
|
|
255
|
+
width: _.reduce((e, t) => Math.max(e, t.left + t.width), 0) + 24,
|
|
256
|
+
height: g,
|
|
257
|
+
items: _
|
|
218
258
|
};
|
|
219
259
|
}
|
|
220
|
-
initSettings(e, t, n, r, i, a, o) {
|
|
221
|
-
let { xAxis:
|
|
222
|
-
this.updateChartSizes(
|
|
223
|
-
let
|
|
260
|
+
initSettings(e, t, n, r, i, a, o, s, c) {
|
|
261
|
+
let { xAxis: l, yAxis: u, size: d, title: f, legend: p } = t;
|
|
262
|
+
this.updateChartSizes(d), this.updateViewport(l, u, n), this.updateCaptionsSize(), this.updateLegendSize(p, r, a, i, s, c), this.createMainTitle(f), this.updateMargins(l, u), this.aesGetters = B(this.dataFrame, r, i, s);
|
|
263
|
+
let m = P().data(e).value((e) => {
|
|
224
264
|
let t = y(this.aesGetters.dotFill(e.idx));
|
|
225
265
|
return t[3] = !e.dimmed && z(e.x, e.y, this.polygons) ? 1 : .4, v(t, t);
|
|
226
|
-
}),
|
|
266
|
+
}), h = N().equals((e, t) => e === t).size((e) => R(this.aesGetters.dotSize(e.idx))).crossValue((e) => e.x).mainValue((e) => e.y).decorate((e) => m(e)), g = k().scaleExtent([.1, 1e3]).filter((e) => e.type === "wheel" || e.metaKey || e.ctrlKey).on("start", () => {
|
|
227
267
|
this.selectedDot = null;
|
|
228
268
|
}).on("zoom", (e) => {
|
|
229
269
|
let t = e.transform, n = t.rescaleX(this.scales.xOriginal), r = t.rescaleY(this.scales.yOriginal);
|
|
230
270
|
this.scales.x.domain(n.domain()), this.scales.y.domain(r.domain()), this.zoomTransform = t, this.zoomStateKey = `${t.x}_${t.y}_${t.k}`, this.updateLabelsPosition(this.visibleLabels), this.renderSvgLayer(), this.renderWebglLayer();
|
|
231
271
|
}).on("end", () => {
|
|
232
272
|
this.visibleLabels = this.computeLabels(this.allDots), this.renderSvgLayer(), o(!0);
|
|
233
|
-
}),
|
|
273
|
+
}), _ = F().on("point", ([e]) => {
|
|
234
274
|
let t;
|
|
235
275
|
e && (t = this.getClosestDot(e.x, e.y));
|
|
236
276
|
let n = this.selectedDot && !t || !this.selectedDot && t || this.selectedDot?.idx !== t?.idx;
|
|
@@ -240,26 +280,26 @@ var V = class {
|
|
|
240
280
|
webglChart: D({
|
|
241
281
|
xScale: this.scales.x,
|
|
242
282
|
yScale: this.scales.y
|
|
243
|
-
}).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(j()).webglPlotArea(M().series([
|
|
283
|
+
}).xAxisHeight(() => "0").yAxisWidth(() => "0").svgPlotArea(j()).webglPlotArea(M().series([h]).mapping((e) => e)).decorate((e) => {
|
|
244
284
|
let t = e.enter();
|
|
245
|
-
t && !this.svgLayerElement && (t.style("grid-template-columns", "0 auto 1fr auto 0"), t.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = t.select(".svg-plot-area.plot-area svg").node()), t.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(
|
|
285
|
+
t && !this.svgLayerElement && (t.style("grid-template-columns", "0 auto 1fr auto 0"), t.style("grid-template-rows", "0 auto 1fr auto 0"), this.svgLayerElement = t.select(".svg-plot-area.plot-area svg").node()), t.select(".svg-plot-area.plot-area").attr("class", "svg-plot-area plot-area miplots-scatterplot-plot-area").call(g).call(_);
|
|
246
286
|
}),
|
|
247
|
-
zoom:
|
|
248
|
-
fillColor:
|
|
249
|
-
pointSeries:
|
|
287
|
+
zoom: g,
|
|
288
|
+
fillColor: m,
|
|
289
|
+
pointSeries: h
|
|
250
290
|
}, O(this.canvasNode).datum(e).style("position", "absolute").style("width", this.chartSizes.chartWidth + "px").style("height", this.chartSizes.chartHeight + "px").style("top", this.margins.top + "px").style("left", this.margins.left + "px"), this.onPolygonUpdate(this.polygons);
|
|
251
291
|
}
|
|
252
292
|
resetZoom(e, t, n) {
|
|
253
293
|
!this.tools?.zoom || !n || (this.updateViewport(e, t, n), O(".miplots-scatterplot-plot-area").call(this.tools.zoom.transform, A));
|
|
254
294
|
}
|
|
255
|
-
updateAes(e, t) {
|
|
256
|
-
this.tools !== null && (this.aesGetters = B(this.dataFrame, e, t), this.tools.fillColor.value((e) => {
|
|
295
|
+
updateAes(e, t, n) {
|
|
296
|
+
this.tools !== null && (this.aesGetters = B(this.dataFrame, e, t, n), this.tools.fillColor.value((e) => {
|
|
257
297
|
let t = y((this.aesGetters.dotFill ?? _)(e.idx));
|
|
258
298
|
return t[3] = !e.dimmed && z(e.x, e.y, this.polygons) ? 1 : .4, v(t, t);
|
|
259
299
|
}));
|
|
260
300
|
}
|
|
261
|
-
updatePointSize(e, t) {
|
|
262
|
-
this.tools !== null && (this.updateAes(e, t), O(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((e) => R(this.aesGetters.dotSize(e.idx))));
|
|
301
|
+
updatePointSize(e, t, n) {
|
|
302
|
+
this.tools !== null && (this.updateAes(e, t, n), O(this.canvasNode).datum([...this.allDots]), this.tools.pointSeries.size((e) => R(this.aesGetters.dotSize(e.idx))));
|
|
263
303
|
}
|
|
264
304
|
updateByLasso() {
|
|
265
305
|
this.tools !== null && (this.tools?.fillColor.value((e) => {
|
|
@@ -287,20 +327,21 @@ var V = class {
|
|
|
287
327
|
updateDots(e) {
|
|
288
328
|
this.tools !== null && (O(this.canvasNode).datum(e), this.tools.fillColor.data(e), this.tools.qt = this.createQuadtree(e), this.allDots = e);
|
|
289
329
|
}
|
|
290
|
-
render(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
330
|
+
render(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m = [], h = null, g) {
|
|
291
331
|
this.dataFrame = e;
|
|
292
|
-
let
|
|
293
|
-
if (this.tools === null) this.initSettings(i, n, a, c, s, l, p);
|
|
332
|
+
let _ = n.size.width !== this.chartSizes.chartWidth || n.size.height !== this.chartSizes.chartHeight;
|
|
333
|
+
if (this.tools === null) this.initSettings(i, n, a, c, s, l, p, h, g);
|
|
294
334
|
else {
|
|
295
335
|
let { title: e, legend: t, size: r } = n;
|
|
296
|
-
this.updateChartSizes(r), this.updateLegendSize(t, c, l, s), this.createMainTitle(e), this.updateMargins(n.xAxis, n.yAxis), this.updateAes(c, s);
|
|
336
|
+
this.updateChartSizes(r), this.updateLegendSize(t, c, l, s, h, g), this.createMainTitle(e), this.updateMargins(n.xAxis, n.yAxis), this.updateAes(c, s, h);
|
|
297
337
|
}
|
|
298
|
-
this.onPolygonUpdateOutside = u, this.onTooltipHintSwitch = d, this.onLassoControlsStateUpdate = f, this.allDots === i ?
|
|
338
|
+
this.onPolygonUpdateOutside = u, this.onTooltipHintSwitch = d, this.onLassoControlsStateUpdate = f, this.allDots === i ? _ && (this.visibleLabels = this.computeLabels(i)) : (this.updateDots(i), this.visibleLabels = this.computeLabels(i), this.onPolygonUpdate(this.polygons)), this.notCalculatedProps = {
|
|
299
339
|
settingsId: t,
|
|
300
340
|
chartSettings: n,
|
|
301
341
|
keyColumn: r,
|
|
302
342
|
dotsByGrouping: o,
|
|
303
|
-
layers: s
|
|
343
|
+
layers: s,
|
|
344
|
+
additionalCurves: m
|
|
304
345
|
}, this.renderWebglLayer(), this.renderSvgLayer();
|
|
305
346
|
}
|
|
306
347
|
renderWebglLayer() {
|
|
@@ -318,6 +359,7 @@ var V = class {
|
|
|
318
359
|
keyColumn: this.notCalculatedProps.keyColumn,
|
|
319
360
|
dotsByGrouping: this.notCalculatedProps.dotsByGrouping,
|
|
320
361
|
layers: this.notCalculatedProps.layers,
|
|
362
|
+
additionalCurves: this.notCalculatedProps.additionalCurves ?? [],
|
|
321
363
|
chartSizes: this.chartSizes,
|
|
322
364
|
scales: this.scales,
|
|
323
365
|
margins: this.margins,
|