@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.
Files changed (101) hide show
  1. package/dist/bubble/BubbleSettingsImpl.d.ts +2 -0
  2. package/dist/bubble/BubbleSettingsImpl.d.ts.map +1 -1
  3. package/dist/bubble/BubbleSettingsImpl.js +3 -1
  4. package/dist/bubble/BubbleSettingsImpl.js.map +1 -1
  5. package/dist/bubble/getGroupedCellsData.d.ts +1 -1
  6. package/dist/bubble/getGroupedCellsData.d.ts.map +1 -1
  7. package/dist/bubble/getGroupedCellsData.js +30 -10
  8. package/dist/bubble/getGroupedCellsData.js.map +1 -1
  9. package/dist/bubble/index.d.ts.map +1 -1
  10. package/dist/bubble/index.js +3 -3
  11. package/dist/bubble/index.js.map +1 -1
  12. package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
  13. package/dist/heatmap/ChartRenderer.js +26 -20
  14. package/dist/heatmap/ChartRenderer.js.map +1 -1
  15. package/dist/heatmap/HeatmapSettingsImpl.d.ts +2 -0
  16. package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
  17. package/dist/heatmap/HeatmapSettingsImpl.js +3 -1
  18. package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  19. package/dist/heatmap/fillCellsData.d.ts +22 -2
  20. package/dist/heatmap/fillCellsData.d.ts.map +1 -1
  21. package/dist/heatmap/fillCellsData.js +60 -47
  22. package/dist/heatmap/fillCellsData.js.map +1 -1
  23. package/dist/heatmap/getCells.d.ts +22 -1
  24. package/dist/heatmap/getCells.d.ts.map +1 -1
  25. package/dist/heatmap/getCells.js +23 -3
  26. package/dist/heatmap/getCells.js.map +1 -1
  27. package/dist/heatmap/getDendrograms.d.ts +5 -1
  28. package/dist/heatmap/getDendrograms.d.ts.map +1 -1
  29. package/dist/heatmap/getDendrograms.js +33 -11
  30. package/dist/heatmap/getDendrograms.js.map +1 -1
  31. package/dist/heatmap/index.d.ts.map +1 -1
  32. package/dist/heatmap/index.js +30 -6
  33. package/dist/heatmap/index.js.map +1 -1
  34. package/dist/scatterplot/ChartRenderer.d.ts +2 -2
  35. package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
  36. package/dist/scatterplot/ChartRenderer.js +155 -115
  37. package/dist/scatterplot/ChartRenderer.js.map +1 -1
  38. package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +11 -1
  39. package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
  40. package/dist/scatterplot/ScatterplotSettingsImpl.js +20 -0
  41. package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  42. package/dist/scatterplot/components/ChartLayersData.d.ts +5 -0
  43. package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
  44. package/dist/scatterplot/components/ChartLayersData.js +115 -35
  45. package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
  46. package/dist/scatterplot/components/types.d.ts +2 -0
  47. package/dist/scatterplot/components/types.d.ts.map +1 -1
  48. package/dist/scatterplot/getLayersData.d.ts +11 -2
  49. package/dist/scatterplot/getLayersData.d.ts.map +1 -1
  50. package/dist/scatterplot/getLayersData.js +36 -19
  51. package/dist/scatterplot/getLayersData.js.map +1 -1
  52. package/dist/scatterplot/index.d.ts.map +1 -1
  53. package/dist/scatterplot/index.js +51 -33
  54. package/dist/scatterplot/index.js.map +1 -1
  55. package/dist/scatterplot/linearRegression.js +1 -1
  56. package/dist/scatterplot/utils/createAesGetter.d.ts.map +1 -1
  57. package/dist/scatterplot/utils/createAesGetter.js +5 -3
  58. package/dist/scatterplot/utils/createAesGetter.js.map +1 -1
  59. package/dist/scatterplot/utils/createLegendInfo.d.ts +11 -2
  60. package/dist/scatterplot/utils/createLegendInfo.d.ts.map +1 -1
  61. package/dist/scatterplot/utils/createLegendInfo.js +21 -16
  62. package/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  63. package/dist/scatterplot-umap/ChartRenderer.d.ts +6 -6
  64. package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
  65. package/dist/scatterplot-umap/ChartRenderer.js +99 -57
  66. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  67. package/dist/scatterplot-umap/SettingsImpl.d.ts +11 -1
  68. package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
  69. package/dist/scatterplot-umap/SettingsImpl.js +21 -1
  70. package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  71. package/dist/scatterplot-umap/components/LowerSVG.d.ts +3 -2
  72. package/dist/scatterplot-umap/components/LowerSVG.d.ts.map +1 -1
  73. package/dist/scatterplot-umap/components/LowerSVG.js +159 -108
  74. package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  75. package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
  76. package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
  77. package/dist/scatterplot-umap/components/SVGLayer.js +9 -8
  78. package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
  79. package/dist/scatterplot-umap/index.d.ts +6 -1
  80. package/dist/scatterplot-umap/index.d.ts.map +1 -1
  81. package/dist/scatterplot-umap/index.js +65 -31
  82. package/dist/scatterplot-umap/index.js.map +1 -1
  83. package/dist/scatterplot-umap/types.d.ts +7 -0
  84. package/dist/scatterplot-umap/types.d.ts.map +1 -1
  85. package/dist/types/bubble.d.ts +6 -0
  86. package/dist/types/bubble.d.ts.map +1 -1
  87. package/dist/types/bubble.js +3 -1
  88. package/dist/types/bubble.js.map +1 -1
  89. package/dist/types/heatmap.d.ts +6 -0
  90. package/dist/types/heatmap.d.ts.map +1 -1
  91. package/dist/types/heatmap.js +2 -0
  92. package/dist/types/heatmap.js.map +1 -1
  93. package/dist/types/scatterplot-umap.d.ts +763 -87
  94. package/dist/types/scatterplot-umap.d.ts.map +1 -1
  95. package/dist/types/scatterplot-umap.js +19 -3
  96. package/dist/types/scatterplot-umap.js.map +1 -1
  97. package/dist/types/scatterplot.d.ts +1377 -44
  98. package/dist/types/scatterplot.d.ts.map +1 -1
  99. package/dist/types/scatterplot.js +27 -3
  100. package/dist/types/scatterplot.js.map +1 -1
  101. 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, a) => {
26
- let o = a.columnName, s = o.nullValueLabel ?? "NA", c = a.order, l = (t) => o.valueLabels ? e.getColumnValueCategory(o.valueLabels, t) : void 0, u = /* @__PURE__ */ new Set(), d = {};
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 === o.value && (u.add(e), d[e] = t.palette);
29
+ n(t) && t.value === s.value && (d.add(e), f[e] = t.palette);
30
30
  });
31
31
  });
32
- let f = {}, p = [];
33
- if (u.has("dotFill") || u.has("dotShape") || u.has("lineColor")) {
34
- let t = e.getColumnCategories(o.value, !1);
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
- f = t.reduce((t, n) => (t[n] = l(e.getColumnCategoryRowIndex(o.value, n)) ?? n, t[n] === "null" && (t[n] = s), t), f);
37
- let n = t.reduce((e, t) => (e[t] = c?.indexOf(t) ?? -1, e), {});
38
- p = t.sort((e, t) => n[e] === n[t] ? f[e]?.localeCompare(f[t] ?? "", "en", { numeric: !0 }) ?? 0 : n[e] - n[t]);
39
- } else p = t;
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[o.value] = {
42
- values: p,
43
- usedAes: [...u],
44
- aesMap: t(o, d, a.inheritedAes),
45
- labels: f
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 \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 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;AA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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"}
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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AqB,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,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,KAAK,EAAc,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAe1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAErE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAM3E,OAAO,KAAK,EAAyB,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,KAAK,EACR,UAAU,EACV,aAAa,EACb,WAAW,EAAE,UAAU,EACvB,GAAG,EACH,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,aAAa,EAChB,MAAM,SAAS,CAAC;AAQjB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SA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,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 i = r.find((e) => e.type === "dots"), a = r.find((e) => e.type === "curve");
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, i?.aes.dotFill ?? n.color, "dotFill"),
42
- dotSize: m(e, t, i?.aes.dotSize ?? n.size, "dotSize"),
43
- lineType: m(e, t, a?.aes.lineShape ?? "solid", "lineShape")
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, t, a, s) {
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 c = [], u = {
164
+ let p = [], m = {
163
165
  width: 0,
164
166
  height: 0,
165
167
  left: 0,
166
168
  top: 0
167
- }, d = Math.min(Math.max(this.chartSizes.chartHeight, 250), 400), p = Math.max(this.chartSizes.chartHeight, d);
168
- if (a.forEach((e) => {
169
- let r = t[e.value];
170
- if (r.usedAes.length === 0 || !r.aesMap) return;
171
- if (r.values.length > 100) {
172
- console.warn(`Too many values for discrete legend (${r.values.length})`);
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 i = {};
176
- r.values.forEach((e) => {
177
- i[e] || (i[e] = { ...n }), r.usedAes.forEach((t) => {
178
- t === "dotFill" && (i[e].color = r.aesMap(e, t) ?? "#110529"), t === "dotSize" && (i[e].size = Number(r.aesMap(e, t) ?? 3));
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 a = e.label ?? e.value, o = S().domain(r.values).range(r.values.map((e) => i[e]));
182
- c.push({
183
- ...u,
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: a,
188
+ title: i,
187
189
  scale: o,
188
- values: r.values,
189
- labels: r.labels
190
+ values: t.values,
191
+ labels: t.labels
190
192
  });
191
- }), s.forEach((e) => {
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"), l = (a === "log" ? C() : b()).domain(t).range([d, 0]), p = i(l, t);
194
- c.push({
195
- ...u,
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: l,
201
- values: p
202
+ tickPositionScale: c,
203
+ values: l
202
204
  });
203
205
  }
204
- e.type === "dots" && r(e.aes.dotSize) && c.push(o(e.aes.dotSize));
205
- }), !c.length) {
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 m = l(c, p, d);
253
+ let _ = l(p, g, h);
214
254
  this.legend = {
215
- width: m.reduce((e, t) => Math.max(e, t.left + t.width), 0) + 24,
216
- height: p,
217
- items: m
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: s, yAxis: c, size: l, title: u, legend: d } = t;
222
- this.updateChartSizes(l), this.updateViewport(s, c, n), this.updateCaptionsSize(), this.updateLegendSize(d, r, a, i), this.createMainTitle(u), this.updateMargins(s, c), this.aesGetters = B(this.dataFrame, r, i);
223
- let f = P().data(e).value((e) => {
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
- }), p = N().equals((e, t) => e === t).size((e) => R(this.aesGetters.dotSize(e.idx))).crossValue((e) => e.x).mainValue((e) => e.y).decorate((e) => f(e)), m = k().scaleExtent([.1, 1e3]).filter((e) => e.type === "wheel" || e.metaKey || e.ctrlKey).on("start", () => {
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
- }), h = F().on("point", ([e]) => {
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([p]).mapping((e) => e)).decorate((e) => {
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(m).call(h);
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: m,
248
- fillColor: f,
249
- pointSeries: p
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 m = n.size.width !== this.chartSizes.chartWidth || n.size.height !== this.chartSizes.chartHeight;
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 ? m && (this.visibleLabels = this.computeLabels(i)) : (this.updateDots(i), this.visibleLabels = this.computeLabels(i), this.onPolygonUpdate(this.polygons)), this.notCalculatedProps = {
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,