@milaboratories/miplots4 1.0.145 → 1.0.146

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 (61) hide show
  1. package/dist/heatmap/ChartRenderer.d.ts +1 -1
  2. package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
  3. package/dist/heatmap/ChartRenderer.js +110 -109
  4. package/dist/heatmap/ChartRenderer.js.map +1 -1
  5. package/dist/heatmap/HeatmapSettingsImpl.d.ts +1 -0
  6. package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
  7. package/dist/heatmap/HeatmapSettingsImpl.js +7 -6
  8. package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  9. package/dist/heatmap/components/Annotations/Annotation.d.ts +2 -2
  10. package/dist/heatmap/components/Annotations/Annotation.d.ts.map +1 -1
  11. package/dist/heatmap/components/Annotations/Annotation.js +106 -98
  12. package/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  13. package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.d.ts +23 -0
  14. package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.d.ts.map +1 -0
  15. package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js +99 -0
  16. package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js.map +1 -0
  17. package/dist/heatmap/components/Annotations/AnnotationCellsSvg.d.ts +23 -0
  18. package/dist/heatmap/components/Annotations/AnnotationCellsSvg.d.ts.map +1 -0
  19. package/dist/heatmap/components/Annotations/AnnotationCellsSvg.js +57 -0
  20. package/dist/heatmap/components/Annotations/AnnotationCellsSvg.js.map +1 -0
  21. package/dist/heatmap/components/Annotations/index.d.ts +2 -2
  22. package/dist/heatmap/components/Annotations/index.d.ts.map +1 -1
  23. package/dist/heatmap/components/Annotations/index.js +2 -2
  24. package/dist/heatmap/components/Annotations/index.js.map +1 -1
  25. package/dist/heatmap/components/CanvasCells.d.ts +21 -0
  26. package/dist/heatmap/components/CanvasCells.d.ts.map +1 -0
  27. package/dist/heatmap/components/CanvasCells.js +85 -0
  28. package/dist/heatmap/components/CanvasCells.js.map +1 -0
  29. package/dist/heatmap/components/Chart.d.ts +2 -1
  30. package/dist/heatmap/components/Chart.d.ts.map +1 -1
  31. package/dist/heatmap/components/Chart.js +180 -186
  32. package/dist/heatmap/components/Chart.js.map +1 -1
  33. package/dist/heatmap/components/ChartsGroup.d.ts +2 -1
  34. package/dist/heatmap/components/ChartsGroup.d.ts.map +1 -1
  35. package/dist/heatmap/components/ChartsGroup.js +27 -25
  36. package/dist/heatmap/components/ChartsGroup.js.map +1 -1
  37. package/dist/heatmap/components/SvgCells.d.ts +19 -0
  38. package/dist/heatmap/components/SvgCells.d.ts.map +1 -0
  39. package/dist/heatmap/components/SvgCells.js +38 -0
  40. package/dist/heatmap/components/SvgCells.js.map +1 -0
  41. package/dist/heatmap/components/tooltipUtils.d.ts +10 -0
  42. package/dist/heatmap/components/tooltipUtils.d.ts.map +1 -0
  43. package/dist/heatmap/components/tooltipUtils.js +44 -0
  44. package/dist/heatmap/components/tooltipUtils.js.map +1 -0
  45. package/dist/heatmap/components/types.d.ts +8 -0
  46. package/dist/heatmap/components/types.d.ts.map +1 -1
  47. package/dist/heatmap/constants.d.ts +1 -0
  48. package/dist/heatmap/constants.d.ts.map +1 -1
  49. package/dist/heatmap/constants.js +13 -12
  50. package/dist/heatmap/constants.js.map +1 -1
  51. package/dist/heatmap/getCells.d.ts.map +1 -1
  52. package/dist/heatmap/getCells.js +65 -68
  53. package/dist/heatmap/getCells.js.map +1 -1
  54. package/dist/heatmap/index.d.ts.map +1 -1
  55. package/dist/heatmap/index.js +89 -87
  56. package/dist/heatmap/index.js.map +1 -1
  57. package/dist/types/heatmap.d.ts +3 -0
  58. package/dist/types/heatmap.d.ts.map +1 -1
  59. package/dist/types/heatmap.js +5 -4
  60. package/dist/types/heatmap.js.map +1 -1
  61. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n activeElementContainer?: Element;\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n activeElementContainer\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n activeElementContainer\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","activeElementContainer","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","idx","jsx","Annotation","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET"],"mappings":";;;AAcA,SAASA,EAAUC,GAA6CC,GAAuD;AACnH,SAAOD,EAAK,aAAaC,EAAe,SAASD,EAAK,aAAa;AACvE;AA0BO,SAASE,EAAY;AAAA,EACxB,UAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAN;AAAA,EACA,SAAAO;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,wBAAAC;AACJ,GAAoB;AAChB,QAAMC,IAAkBlB,EAAY,OAAO,CAAAL,MAEnCC,EAAe,SAASD,EAAK,QAAQ,KACpC,CAACQ,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASR,EAAK,QAAQ,KACpD,CAACS,KAAW,CAAC,OAAO,QAAQ,EAAE,SAAST,EAAK,QAAQ,CAE5D,GACKwB,IAAkBD,EAAgB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C,CAAc;AAAA,QACzC,GAAGG,EAAkB,MAAM,YAAY,IAAI2B,IAAMG,IAAmBC;AAAA,QACpE,GAAG/B,EAAkB,MAAM,YAAY;AAAA,QACtC,GAAG0B;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,IACA0B,EAAe,IAAI,CAAC1B,GAAM+B,MAEnBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,KAAK;AAAA,QACxC,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,IAAI,YAAY;AAAA,QACrC,GAAGA,EAAkB,IAAI,YAAY,IAAI2B,IAAMG;AAAA,QAC9C,GAAGJ;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,IACA2B,EAAkB,IAAI,CAAC3B,GAAM+B,MAEtBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,KAAK;AAAA,QACxC,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,OAAO,YAAY;AAAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI2B,IAAMG,IAAmBC;AAAA,QACpE,GAAGL;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","idx","jsx","Annotation","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET"],"mappings":";;;AAcA,SAASA,EAAUC,GAA6CC,GAAuD;AACnH,SAAOD,EAAK,aAAaC,EAAe,SAASD,EAAK,aAAa;AACvE;AA0BO,SAASE,EAAY;AAAA,EACxB,UAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAN;AAAA,EACA,SAAAO;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AACJ,GAAoB;AAChB,QAAMC,IAAkBlB,EAAY,OAAO,CAAAL,MAEnCC,EAAe,SAASD,EAAK,QAAQ,KACpC,CAACQ,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASR,EAAK,QAAQ,KACpD,CAACS,KAAW,CAAC,OAAO,QAAQ,EAAE,SAAST,EAAK,QAAQ,CAE5D,GACKwB,IAAkBD,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,MAAM,GACzEyB,IAAmBF,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,OAAO,GAC3E0B,IAAiBH,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,a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AAK;AAAA,IAAA,CAUrB;AAAA,IACA0B,EAAe,IAAI,CAAC1B,GAAM+B,MAEnBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,KAAK;AAAA,QACxC,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,IAAI,YAAY;AAAA,QACrC,GAAGA,EAAkB,IAAI,YAAY,IAAI2B,IAAMG;AAAA,QAC9C,GAAGJ;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,IACA2B,EAAkB,IAAI,CAAC3B,GAAM+B,MAEtBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,KAAK;AAAA,QACxC,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,OAAO,YAAY;AAAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI2B,IAAMG,IAAmBC;AAAA,QACpE,GAAGL;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;"}
@@ -0,0 +1,21 @@
1
+ import { Cell, GroupedCellsData } from '../getCells';
2
+ import { AnnotationTooltipData, ChartScales } from './types';
3
+ import { TooltipsData } from '../../common/Tooltip';
4
+ import { HeatmapSettingsImpl } from '../HeatmapSettingsImpl';
5
+ interface CanvasCellsProps<T> {
6
+ width: number;
7
+ height: number;
8
+ facetKey: string;
9
+ scales: ChartScales;
10
+ cells: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['cells'];
11
+ xKeys: string[];
12
+ yKeys: string[];
13
+ stepX: number;
14
+ stepY: number;
15
+ aes: HeatmapSettingsImpl['aes'];
16
+ colorScale: (value: T) => string;
17
+ tooltipsData: TooltipsData<Cell | AnnotationTooltipData>;
18
+ }
19
+ export declare function CanvasCells<ValueType>({ width, height, facetKey, scales, cells, xKeys, yKeys, stepX, stepY, aes, colorScale, tooltipsData, }: CanvasCellsProps<ValueType>): import("react/jsx-runtime").JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=CanvasCells.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CanvasCells.d.ts","sourceRoot":"","sources":["../../../src/heatmap/components/CanvasCells.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAgElE,UAAU,gBAAgB,CAAC,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAChC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,YAAY,EAAE,YAAY,CAAC,IAAI,GAAG,qBAAqB,CAAC,CAAC;CAC5D;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,EACnC,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,GAAG,EACH,UAAU,EACV,YAAY,GACf,EAAE,gBAAgB,CAAC,SAAS,CAAC,2CAwD7B"}
@@ -0,0 +1,85 @@
1
+ import { j } from "../../node_modules/react/jsx-runtime.js";
2
+ import { r as M } from "../../_virtual/index.js";
3
+ import { useFunction as S } from "../../utils/hooks/useFunction.js";
4
+ function h(e, n, c, o, t, r, x, m, y, v, C, l) {
5
+ var a;
6
+ if (e) {
7
+ e.beginPath(), e.clearRect(0, 0, C, l);
8
+ for (const s of o)
9
+ for (const f of t) {
10
+ const i = (a = c == null ? void 0 : c[s]) == null ? void 0 : a[f];
11
+ if (!i)
12
+ continue;
13
+ const d = n.x(s), u = n.y(f);
14
+ e.fillStyle = i.value === null ? y : v(i.normalizedValue), e.fillRect(d, u, r, x);
15
+ }
16
+ }
17
+ }
18
+ function k(e, n, c) {
19
+ let o = 0, t = e.length - 1;
20
+ for (; o <= t; ) {
21
+ const r = Math.floor((o + t) / 2);
22
+ if (Math.abs(e[r] - n) < c)
23
+ return e[r] >= n ? r - 1 : r;
24
+ n < e[r] ? t = r - 1 : o = r + 1;
25
+ }
26
+ return -1;
27
+ }
28
+ function E(e, n, c, o) {
29
+ const t = k(n, e, o);
30
+ return t === -1 ? -1 : c[t];
31
+ }
32
+ function z({
33
+ width: e,
34
+ height: n,
35
+ facetKey: c,
36
+ scales: o,
37
+ cells: t,
38
+ xKeys: r,
39
+ yKeys: x,
40
+ stepX: m,
41
+ stepY: y,
42
+ aes: v,
43
+ colorScale: C,
44
+ tooltipsData: l
45
+ }) {
46
+ const a = M.useRef(null), s = window.devicePixelRatio || 1, f = M.useRef(null), i = () => {
47
+ h(
48
+ f.current,
49
+ o,
50
+ t,
51
+ r,
52
+ x,
53
+ m,
54
+ y,
55
+ v.cellStrokeColor,
56
+ v.emptyCellColor,
57
+ C,
58
+ e,
59
+ n
60
+ );
61
+ };
62
+ M.useEffect(() => {
63
+ const u = a.current;
64
+ f.current || (f.current = (u == null ? void 0 : u.getContext("2d")) ?? null), u && f.current && (u.style.width = e + "px", u.style.height = n + "px", f.current.scale(s, s)), i();
65
+ }, [e, n]), i();
66
+ const d = S((u) => {
67
+ var p;
68
+ const K = u.nativeEvent.offsetX, b = u.nativeEvent.offsetY, g = E(K, o.x.range(), o.x.domain(), m), L = E(b, o.y.range(), o.y.domain(), y), R = (p = t[g]) == null ? void 0 : p[L];
69
+ R ? l.onMouseEnter(R, c) : l.onMouseLeave();
70
+ });
71
+ return /* @__PURE__ */ j.jsx("foreignObject", { width: e, height: n, children: /* @__PURE__ */ j.jsx(
72
+ "canvas",
73
+ {
74
+ ref: a,
75
+ width: s * e,
76
+ height: s * n,
77
+ onMouseMove: d,
78
+ onMouseLeave: () => l.onMouseLeave()
79
+ }
80
+ ) });
81
+ }
82
+ export {
83
+ z as CanvasCells
84
+ };
85
+ //# sourceMappingURL=CanvasCells.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CanvasCells.js","sources":["../../../src/heatmap/components/CanvasCells.tsx"],"sourcesContent":["import type { Cell, GroupedCellsData } from '../getCells';\nimport type { AnnotationTooltipData, ChartScales } from './types';\nimport type { TooltipsData } from '../../common/Tooltip';\nimport type { HeatmapSettingsImpl } from '../HeatmapSettingsImpl';\nimport type { MouseEventHandler } from 'react';\nimport { useEffect, useRef } from 'react';\nimport { useFunction } from '../../utils/hooks/useFunction';\n\nfunction renderCells<T>(\n ctx: CanvasRenderingContext2D | null,\n scales: ChartScales,\n cells: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['cells'],\n xKeys: string[],\n yKeys: string[],\n stepX: number,\n stepY: number,\n strokeColor: string,\n emptyCellColor: string,\n colorScale: (value: T) => string,\n width: number,\n height: number\n) {\n if (!ctx) {\n return;\n }\n ctx.beginPath(); // Start a new path\n ctx.clearRect(0, 0, width, height);\n for (const xKey of xKeys) {\n for (const yKey of yKeys) {\n const cell = cells?.[xKey]?.[yKey];\n if (!cell) {\n continue;\n }\n const x = scales.x(xKey);\n const y = scales.y(yKey);\n ctx.fillStyle = cell.value === null ? emptyCellColor : colorScale(cell.normalizedValue as T),\n ctx.fillRect(x, y, stepX, stepY); // Add a rectangle to the current path\n }\n }\n}\n\nfunction binarySearch(arr: number[], val: number, step: number) {\n let start = 0;\n let end = arr.length - 1;\n\n while (start <= end) {\n const mid = Math.floor((start + end) / 2);\n if (Math.abs(arr[mid] - val) < step) {\n return arr[mid] >= val ? mid - 1 : mid;\n }\n\n if (val < arr[mid]) {\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n }\n return -1;\n}\nfunction searchKey(px: number, positions: number[], keys: string[], step: number) {\n const pos = binarySearch(positions, px, step);\n if (pos === -1) {\n return -1;\n }\n return keys[pos];\n}\n\ninterface CanvasCellsProps<T> {\n width: number,\n height: number,\n facetKey: string,\n scales: ChartScales,\n cells: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['cells'],\n xKeys: string[],\n yKeys: string[],\n stepX: number,\n stepY: number,\n aes: HeatmapSettingsImpl['aes'];\n colorScale: (value: T) => string,\n tooltipsData: TooltipsData<Cell | AnnotationTooltipData>;\n}\n\nexport function CanvasCells<ValueType>({\n width,\n height,\n facetKey,\n scales,\n cells,\n xKeys,\n yKeys,\n stepX,\n stepY,\n aes,\n colorScale,\n tooltipsData,\n}: CanvasCellsProps<ValueType>) {\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const canvasRatio = window.devicePixelRatio || 1;\n const ctx = useRef<CanvasRenderingContext2D | null>(null);\n const render = () => {\n renderCells<ValueType>(\n ctx.current,\n scales,\n cells,\n xKeys,\n yKeys, stepX, stepY,\n aes.cellStrokeColor,\n aes.emptyCellColor,\n colorScale,\n width,\n height\n );\n };\n useEffect(() => {\n const canvasEl = canvasRef.current;\n if (!ctx.current) {\n ctx.current = canvasEl?.getContext('2d') ?? null;\n }\n if (canvasEl && ctx.current) {\n canvasEl.style.width = width + 'px';\n canvasEl.style.height = height + 'px';\n ctx.current.scale(canvasRatio, canvasRatio);\n }\n render();\n }, [width, height]);\n render();\n\n const moveOnCanvas: MouseEventHandler<HTMLCanvasElement> = useFunction((e: React.MouseEvent) => {\n const x = e.nativeEvent.offsetX;\n const y = e.nativeEvent.offsetY;\n const xKey = searchKey(x, scales.x.range(), scales.x.domain(), stepX);\n const yKey = searchKey(y, scales.y.range(), scales.y.domain(), stepY);\n const activeCell = cells[xKey]?.[yKey];\n if (activeCell) {\n tooltipsData.onMouseEnter(activeCell, facetKey);\n } else {\n tooltipsData.onMouseLeave();\n }\n });\n\n return (\n <foreignObject width={width} height={height}>\n <canvas\n ref={canvasRef}\n width={canvasRatio * width}\n height={canvasRatio * height}\n onMouseMove={moveOnCanvas}\n onMouseLeave={() => tooltipsData.onMouseLeave()}\n />\n </foreignObject>\n );\n}"],"names":["renderCells","ctx","scales","cells","xKeys","yKeys","stepX","stepY","strokeColor","emptyCellColor","colorScale","width","height","xKey","yKey","cell","_a","x","y","binarySearch","arr","val","step","start","end","mid","searchKey","px","positions","keys","pos","CanvasCells","facetKey","aes","tooltipsData","canvasRef","useRef","canvasRatio","render","useEffect","canvasEl","moveOnCanvas","useFunction","e","activeCell","jsx"],"mappings":";;;AAQA,SAASA,EACLC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;;AACE,MAAKX,GAGL;AAAA,IAAAA,EAAI,UAAA,GACJA,EAAI,UAAU,GAAG,GAAGU,GAAOC,CAAM;AACjC,eAAWC,KAAQT;AACf,iBAAWU,KAAQT,GAAO;AACtB,cAAMU,KAAOC,IAAAb,KAAA,gBAAAA,EAAQU,OAAR,gBAAAG,EAAgBF;AAC7B,YAAI,CAACC;AACD;AAEJ,cAAME,IAAIf,EAAO,EAAEW,CAAI,GACjBK,IAAIhB,EAAO,EAAEY,CAAI;AACvB,QAAAb,EAAI,YAAYc,EAAK,UAA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A,EAER;AACA2B,EAAAA,EAAAA,UAAU,MAAM;AACZ,UAAMC,IAAWL,EAAU;AAC3B,IAAKlC,EAAI,YACLA,EAAI,WAAUuC,KAAA,gBAAAA,EAAU,WAAW,UAAS,OAE5CA,KAAYvC,EAAI,YAChBuC,EAAS,MAAM,QAAQ7B,IAAQ,MAC/B6B,EAAS,MAAM,SAAS5B,IAAS,MACjCX,EAAI,QAAQ,MAAMoC,GAAaA,CAAW,IAE9CC,EAAA;AAAA,EACJ,GAAG,CAAC3B,GAAOC,CAAM,CAAC,GAClB0B,EAAA;AAEA,QAAMG,IAAqDC,EAAY,CAACC,MAAwB;;AAC5F,UAAM1B,IAAI0B,EAAE,YAAY,SAClBzB,IAAIyB,EAAE,YAAY,SAClB9B,IAAOa,EAAUT,GAAGf,EAAO,EAAE,MAAA,GAASA,EAAO,EAAE,OAAA,GAAUI,CAAK,GAC9DQ,IAAOY,EAAUR,GAAGhB,EAAO,EAAE,MAAA,GAASA,EAAO,EAAE,OAAA,GAAUK,CAAK,GAC9DqC,KAAa5B,IAAAb,EAAMU,CAAI,MAAV,gBAAAG,EAAcF;AACjC,IAAI8B,IACAV,EAAa,aAAaU,GAAYZ,CAAQ,IAE9CE,EAAa,aAAA;AAAA,EAErB,CAAC;AAED,SACIW,gBAAAA,EAAAA,IAAC,iBAAA,EAAc,OAAAlC,GAAc,QAAAC,GACzB,UAAAiC,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKV;AAAA,MACL,OAAOE,IAAc1B;AAAA,MACrB,QAAQ0B,IAAczB;AAAA,MACtB,aAAa6B;AAAA,MACb,cAAc,MAAMP,EAAa,aAAA;AAAA,IAAa;AAAA,EAAA,GAEtD;AAER;"}
@@ -2,7 +2,7 @@ import { TooltipsData } from '../../common/Tooltip';
2
2
  import { Cell, GroupedCellsData } from '../getCells';
3
3
  import { HeatmapSettingsImpl } from '../HeatmapSettingsImpl';
4
4
  import { AnnotationColorScales, AnnotationTooltipData, CaptionsSizes, ChartDendrograms, ChartDimensionsData, ChartScales, ChartSizes, DendrogramAesScales, LabelAngles, Margins } from './types';
5
- export declare function Chart<ValueType>({ dendrograms, facetKey, dimensions, scales, cells, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, colorScale, chartSettings, cellsMeta, stepX, stepY, sharedX, sharedY, annotations, annotationColorScales, dendrogramAesScales, aes, labelAngles, chartSizes, margins, tooltipsContainer, tooltipsData, }: {
5
+ export declare function Chart<ValueType>({ dendrograms, facetKey, dimensions, scales, cells, xGroupKeys, yGroupKeys, xKeysByGroups, yKeysByGroups, colorScale, chartSettings, cellsMeta, stepX, stepY, sharedX, sharedY, annotations, annotationColorScales, dendrogramAesScales, aes, labelAngles, chartSizes, margins, tooltipsContainer, tooltipsData, cellsRenderingMode, }: {
6
6
  facetKey: string;
7
7
  chartSizes: ChartSizes;
8
8
  captionsSizes: CaptionsSizes;
@@ -29,5 +29,6 @@ export declare function Chart<ValueType>({ dendrograms, facetKey, dimensions, sc
29
29
  margins: Margins;
30
30
  tooltipsContainer?: Element;
31
31
  tooltipsData: TooltipsData<Cell | AnnotationTooltipData>;
32
+ cellsRenderingMode: 'svg' | 'canvas';
32
33
  }): import("react/jsx-runtime").JSX.Element;
33
34
  //# sourceMappingURL=Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/heatmap/components/Chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMzD,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAKlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EA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 -1,234 +1,228 @@
1
- import { j as i } from "../../node_modules/react/jsx-runtime.js";
2
- import { r as te } from "../../_virtual/index.js";
3
- import { r as ne } from "../../node_modules/react-dom/index.js";
4
- import { Tooltip as S } from "../../common/Tooltip.js";
5
- import { useDataFrame as oe } from "../../common/useDataFrame.js";
6
- import { FONT_SIZE as re, FACET_TITLE_OFFSET as ie } from "../constants.js";
7
- import { Annotations as fe } from "./Annotations/index.js";
8
- import { Captions as ue } from "./Captions/index.js";
9
- import { Dendrograms as le } from "./Dendrograms.js";
10
- import { Frames as me } from "./Frames.js";
11
- import { format as xe } from "../../node_modules/d3-format/src/defaultLocale.js";
12
- function p(e, n) {
13
- if (e === null)
14
- return "null";
15
- if (typeof e == "number") {
16
- if (n)
17
- return xe(n)(e);
18
- const o = e > 0 ? Math.floor(e) : Math.ceil(e), r = e - o;
19
- return o + Number(r.toPrecision(2));
20
- }
21
- return e;
22
- }
23
- function ae(e, n, o, r = []) {
24
- const a = `${p(n.value)}${n.value !== n.normalizedValue ? ` (${p(n.normalizedValue)})` : ""}`;
25
- if (r.length) {
26
- const c = [
27
- `Value: ${a}`
28
- ];
29
- for (const m of r) {
30
- const s = e.getColumnValue(m.value, n.idx);
31
- c.push(`${m.label}: ${p(s, m.format)}`);
32
- }
33
- return c;
34
- }
35
- return [a];
36
- }
37
- function ce(e, n) {
38
- const o = [];
39
- return e.xKey && o.push(`X: ${n.xLabels[e.xKey]}`), e.yKey && o.push(`Y: ${n.yLabels[e.yKey]}`), o.push(`${e.title}: ${p(e.value, e.column.format)}`), o;
40
- }
41
- function he(e) {
42
- return e !== null && "isAnnotation" in e;
43
- }
44
- function W(e) {
45
- return e !== null && "isCell" in e;
46
- }
47
- function Fe({
48
- dendrograms: e,
1
+ import { j as r } from "../../node_modules/react/jsx-runtime.js";
2
+ import { Tooltip as V } from "../../common/Tooltip.js";
3
+ import { useDataFrame as K } from "../../common/useDataFrame.js";
4
+ import { FONT_SIZE as D, FACET_TITLE_OFFSET as Y } from "../constants.js";
5
+ import { Annotations as s } from "./Annotations/index.js";
6
+ import { Captions as X } from "./Captions/index.js";
7
+ import { Dendrograms as M } from "./Dendrograms.js";
8
+ import { Frames as p } from "./Frames.js";
9
+ import { isCellTooltip as W, isAnnotationTooltip as _, getTooltipContent as ee, getAnnotationTooltipContent as re } from "./tooltipUtils.js";
10
+ import { CanvasCells as te } from "./CanvasCells.js";
11
+ import { SvgCells as xe } from "./SvgCells.js";
12
+ function Te({
13
+ dendrograms: B,
49
14
  facetKey: n,
50
- dimensions: o,
51
- scales: r,
52
- cells: a,
53
- xGroupKeys: c,
54
- yGroupKeys: m,
55
- xKeysByGroups: s,
56
- yKeysByGroups: T,
57
- colorScale: z,
58
- chartSettings: g,
59
- cellsMeta: f,
60
- stepX: h,
61
- stepY: C,
15
+ dimensions: f,
16
+ scales: t,
17
+ cells: A,
18
+ xGroupKeys: T,
19
+ yGroupKeys: y,
20
+ xKeysByGroups: C,
21
+ yKeysByGroups: u,
22
+ colorScale: F,
23
+ chartSettings: l,
24
+ cellsMeta: x,
25
+ stepX: d,
26
+ stepY: m,
62
27
  sharedX: H,
63
28
  sharedY: I,
64
- annotations: N,
65
- annotationColorScales: P,
66
- dendrogramAesScales: R,
67
- aes: b,
29
+ annotations: O,
30
+ annotationColorScales: N,
31
+ dendrogramAesScales: S,
32
+ aes: i,
68
33
  labelAngles: Z,
69
- chartSizes: $,
34
+ chartSizes: o,
70
35
  margins: j,
71
- tooltipsContainer: L,
72
- tooltipsData: t
36
+ tooltipsContainer: $,
37
+ tooltipsData: e,
38
+ cellsRenderingMode: b
73
39
  }) {
74
- const q = oe(), [y, J] = te.useState(), { xAxis: Q, yAxis: U, tooltips: E } = g, { width: V, height: v } = o.inner, { padding: l, chartEdgeSides: D, sideElementBBoxes: x } = o, { xGroupLabels: K, yGroupLabels: G, xLabels: M, yLabels: Y } = f, F = r.x.domain(), w = r.y.domain(), _ = {
75
- left: j.left + o.left + l.left,
76
- right: $.totalWidth - (j.left + o.left + l.left),
77
- top: j.top + o.top + l.top,
78
- bottom: $.totalHeight - (j.top + o.top + l.top)
79
- }, k = !1, X = y && t.fixed;
80
- return /* @__PURE__ */ i.jsxs("g", { transform: `translate(${o.left},${o.top})`, fontSize: re, children: [
81
- /* @__PURE__ */ i.jsxs("g", { transform: `translate(${l.left},${l.top})`, children: [
82
- /* @__PURE__ */ i.jsx(
83
- fe,
40
+ const q = K(), { xAxis: z, yAxis: J, tooltips: v } = l, { width: w, height: E } = f.inner, { padding: c, chartEdgeSides: P, sideElementBBoxes: h } = f, { xGroupLabels: Q, yGroupLabels: U, xLabels: R, yLabels: G } = x, g = t.x.domain(), a = t.y.domain(), L = {
41
+ left: j.left + f.left + c.left,
42
+ right: o.totalWidth - (j.left + f.left + c.left),
43
+ top: j.top + f.top + c.top,
44
+ bottom: o.totalHeight - (j.top + f.top + c.top)
45
+ }, k = !1;
46
+ return /* @__PURE__ */ r.jsxs("g", { transform: `translate(${f.left},${f.top})`, fontSize: D, children: [
47
+ /* @__PURE__ */ r.jsxs("g", { transform: `translate(${c.left},${c.top})`, children: [
48
+ /* @__PURE__ */ r.jsx(
49
+ s,
84
50
  {
85
51
  facetKey: n,
86
- sideElementBBoxes: x,
87
- annotations: N,
88
- cellsMeta: f,
89
- annotationColorScales: P,
52
+ sideElementBBoxes: h,
53
+ annotations: O,
54
+ cellsMeta: x,
55
+ annotationColorScales: N,
90
56
  sharedX: H,
91
57
  sharedY: I,
92
- chartEdgeSides: D,
93
- width: V,
94
- height: v,
95
- scales: r,
96
- stepX: h,
97
- stepY: C,
98
- aes: b,
99
- frame: g.frame,
100
- xGroupKeys: c,
101
- yGroupKeys: m,
102
- xKeysByGroups: s,
103
- yKeysByGroups: T,
104
- tooltipsData: t,
105
- activeElementContainer: y
58
+ chartEdgeSides: P,
59
+ width: w,
60
+ height: E,
61
+ scales: t,
62
+ stepX: d,
63
+ stepY: m,
64
+ aes: i,
65
+ frame: l.frame,
66
+ xGroupKeys: T,
67
+ yGroupKeys: y,
68
+ xKeysByGroups: C,
69
+ yKeysByGroups: u,
70
+ tooltipsData: e,
71
+ cellsRenderingMode: b
106
72
  }
107
73
  ),
108
- /* @__PURE__ */ i.jsx(
109
- le,
74
+ /* @__PURE__ */ r.jsx(
75
+ M,
110
76
  {
111
- dendrograms: e,
112
- sideElementBBoxes: x,
113
- xGroupKeys: f.xGroupKeys,
114
- yGroupKeys: f.yGroupKeys,
115
- xDataByKeys: f.xDataByKeys,
116
- yDataByKeys: f.yDataByKeys,
117
- aesScales: R
77
+ dendrograms: B,
78
+ sideElementBBoxes: h,
79
+ xGroupKeys: x.xGroupKeys,
80
+ yGroupKeys: x.yGroupKeys,
81
+ xDataByKeys: x.xDataByKeys,
82
+ yDataByKeys: x.yDataByKeys,
83
+ aesScales: S
118
84
  }
119
85
  ),
120
- x.top.facetTitle.isVisible && /* @__PURE__ */ i.jsx(
86
+ h.top.facetTitle.isVisible && /* @__PURE__ */ r.jsx(
121
87
  "text",
122
88
  {
123
- x: x.top.facetTitle.x,
124
- y: x.top.facetTitle.y + x.top.facetTitle.height - ie,
89
+ x: h.top.facetTitle.x,
90
+ y: h.top.facetTitle.y + h.top.facetTitle.height - Y,
125
91
  fontWeight: "500",
126
92
  fontSize: "20px",
127
- children: f.facetKeyValues[n].join(", ")
93
+ children: x.facetKeyValues[n].join(", ")
128
94
  }
129
95
  ),
130
96
  k,
131
- F.map(
132
- (d) => w.map((A) => {
133
- var O;
134
- const u = (O = a == null ? void 0 : a[d]) == null ? void 0 : O[A], ee = X && W(t.selectedData) && (u == null ? void 0 : u.id) === t.selectedData.id, B = u ? /* @__PURE__ */ i.jsx(
135
- "rect",
136
- {
137
- x: r.x(d),
138
- y: r.y(A),
139
- width: h,
140
- height: C,
141
- stroke: b.cellStrokeColor,
142
- fill: u.value === null ? b.emptyCellColor : z(u.normalizedValue),
143
- onMouseOver: () => t.onMouseEnter(u, n),
144
- onMouseLeave: () => t.onMouseLeave()
145
- },
146
- u ? u.id : `${d}_${A}`
147
- ) : null;
148
- return ee ? ne.createPortal(B, y) : B;
149
- })
97
+ b === "svg" && /* @__PURE__ */ r.jsx(
98
+ xe,
99
+ {
100
+ scales: t,
101
+ facetKey: n,
102
+ cells: A,
103
+ xKeys: g,
104
+ yKeys: a,
105
+ stepX: d,
106
+ stepY: m,
107
+ aes: i,
108
+ colorScale: F,
109
+ tooltipsData: e
110
+ }
150
111
  ),
151
- /* @__PURE__ */ i.jsx(
152
- me,
112
+ b === "canvas" && /* @__PURE__ */ r.jsx(
113
+ te,
153
114
  {
154
- frame: g.frame,
155
- xGroupKeys: c,
156
- yGroupKeys: m,
157
- xKeysByGroups: s,
158
- yKeysByGroups: T,
159
- scales: r,
160
- stepX: h,
161
- stepY: C,
162
- width: V,
163
- height: v
115
+ scales: t,
116
+ facetKey: n,
117
+ cells: A,
118
+ width: w,
119
+ height: E,
120
+ xKeys: g,
121
+ yKeys: a,
122
+ stepX: d,
123
+ stepY: m,
124
+ aes: i,
125
+ colorScale: F,
126
+ tooltipsData: e
127
+ }
128
+ ),
129
+ /* @__PURE__ */ r.jsx(
130
+ p,
131
+ {
132
+ frame: l.frame,
133
+ xGroupKeys: T,
134
+ yGroupKeys: y,
135
+ xKeysByGroups: C,
136
+ yKeysByGroups: u,
137
+ scales: t,
138
+ stepX: d,
139
+ stepY: m,
140
+ width: w,
141
+ height: E
164
142
  }
165
143
  ),
166
- /* @__PURE__ */ i.jsx(
167
- ue,
144
+ /* @__PURE__ */ r.jsx(
145
+ X,
168
146
  {
169
- xAxis: Q,
170
- yAxis: U,
171
- scales: r,
172
- stepX: h,
173
- stepY: C,
147
+ xAxis: z,
148
+ yAxis: J,
149
+ scales: t,
150
+ stepX: d,
151
+ stepY: m,
174
152
  debug: k,
175
- sideElementBBoxes: x,
176
- xKeys: F,
177
- yKeys: w,
178
- xGroupKeys: c,
179
- yGroupKeys: m,
180
- xKeysByGroups: s,
181
- yKeysByGroups: T,
182
- xGroupLabels: K,
183
- yGroupLabels: G,
153
+ sideElementBBoxes: h,
154
+ xKeys: g,
155
+ yKeys: a,
156
+ xGroupKeys: T,
157
+ yGroupKeys: y,
158
+ xKeysByGroups: C,
159
+ yKeysByGroups: u,
160
+ xGroupLabels: Q,
161
+ yGroupLabels: U,
184
162
  labelAngles: Z,
185
- xLabels: M,
186
- yLabels: Y
163
+ xLabels: R,
164
+ yLabels: G
187
165
  }
188
166
  )
189
167
  ] }),
190
- g.tooltips.show && W(t.selectedData) && t.currentFacet === n && /* @__PURE__ */ i.jsx(
191
- S,
168
+ l.tooltips.show && W(e.selectedData) && e.currentFacet === n && /* @__PURE__ */ r.jsx(
169
+ V,
192
170
  {
193
- content: ae(q, t.selectedData, f, E == null ? void 0 : E.content),
194
- x: r.x(String(t.selectedData.x)) + h / 2,
195
- y: r.y(String(t.selectedData.y)) + C / 2,
196
- offset: F.length > 1 ? h / 2 : 0,
171
+ content: ee(q, e.selectedData, x, v == null ? void 0 : v.content),
172
+ x: t.x(String(e.selectedData.x)) + d / 2,
173
+ y: t.y(String(e.selectedData.y)) + m / 2,
174
+ offset: g.length > 1 ? d / 2 : 0,
197
175
  active: !0,
198
- sideDistances: _,
199
- fixed: t.fixed,
200
- onClose: t.onClose,
201
- container: L
176
+ sideDistances: L,
177
+ fixed: e.fixed,
178
+ onClose: e.onClose,
179
+ container: $
202
180
  }
203
181
  ),
204
- g.tooltips.show && he(t.selectedData) && t.currentFacet === n && /* @__PURE__ */ i.jsx(
205
- S,
182
+ l.tooltips.show && _(e.selectedData) && e.currentFacet === n && /* @__PURE__ */ r.jsx(
183
+ V,
206
184
  {
207
- content: ce(t.selectedData, f),
208
- x: t.selectedData.x,
209
- y: t.selectedData.y,
185
+ content: re(e.selectedData, x),
186
+ x: e.selectedData.x,
187
+ y: e.selectedData.y,
210
188
  offset: 0,
211
189
  active: !0,
212
- sideDistances: _,
213
- fixed: t.fixed,
214
- onClose: t.onClose,
215
- container: L
190
+ sideDistances: L,
191
+ fixed: e.fixed,
192
+ onClose: e.onClose,
193
+ container: $
216
194
  }
217
195
  ),
218
- /* @__PURE__ */ i.jsxs("g", { transform: `translate(${l.left},${l.top})`, children: [
219
- t.fixed && /* @__PURE__ */ i.jsx("rect", { width: $.chartWidth, height: $.chartHeight, fill: "rgba(255, 255, 255, 0.8)" }),
220
- /* @__PURE__ */ i.jsx(
221
- "g",
222
- {
223
- ref: (d) => {
224
- d && !y && J(d);
196
+ /* @__PURE__ */ r.jsxs("g", { transform: `translate(${c.left},${c.top})`, children: [
197
+ e.fixed && /* @__PURE__ */ r.jsx("rect", { width: o.chartWidth, height: o.chartHeight, fill: "rgba(255, 255, 255, 0.8)" }),
198
+ /* @__PURE__ */ r.jsxs("g", { children: [
199
+ e.fixed && e.currentFacet === n && W(e.selectedData) && /* @__PURE__ */ r.jsx(
200
+ "rect",
201
+ {
202
+ width: d,
203
+ height: m,
204
+ x: t.x(e.selectedData.x),
205
+ y: t.y(e.selectedData.y),
206
+ fill: F(e.selectedData.normalizedValue ?? e.selectedData.value),
207
+ stroke: i.cellStrokeColor
225
208
  }
226
- }
227
- )
209
+ ),
210
+ e.fixed && e.currentFacet === n && _(e.selectedData) && /* @__PURE__ */ r.jsx(
211
+ "rect",
212
+ {
213
+ x: e.selectedData.cell.x,
214
+ y: e.selectedData.cell.y,
215
+ width: e.selectedData.cell.width,
216
+ height: e.selectedData.cell.height,
217
+ fill: e.selectedData.cell.fill,
218
+ stroke: e.selectedData.cell.stroke
219
+ }
220
+ )
221
+ ] })
228
222
  ] })
229
223
  ] });
230
224
  }
231
225
  export {
232
- Fe as Chart
226
+ Te as Chart
233
227
  };
234
228
  //# sourceMappingURL=Chart.js.map