@unovis/ts 1.6.2-pre.6 → 1.7.0-Phoenix.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/components/crosshair/index.js +1 -2
- package/components/crosshair/index.js.map +1 -1
- package/components/sankey/config.d.ts +8 -0
- package/components/sankey/config.js +1 -1
- package/components/sankey/config.js.map +1 -1
- package/components/sankey/index.d.ts +29 -0
- package/components/sankey/index.js +70 -0
- package/components/sankey/index.js.map +1 -1
- package/components/sankey/modules/link.js +16 -3
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/types.d.ts +2 -0
- package/components/sankey/types.js.map +1 -1
- package/components/treemap/config.d.ts +17 -10
- package/components/treemap/config.js +2 -1
- package/components/treemap/config.js.map +1 -1
- package/components/treemap/index.d.ts +0 -2
- package/components/treemap/index.js +78 -91
- package/components/treemap/index.js.map +1 -1
- package/components/treemap/style.d.ts +3 -8
- package/components/treemap/style.js +10 -15
- package/components/treemap/style.js.map +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/utils/color.d.ts +1 -0
- package/utils/color.js +7 -1
- package/utils/color.js.map +1 -1
- package/utils/index.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sources":["../../../../src/components/sankey/modules/link.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { interpolateNumber } from 'd3-interpolate'\n\n// Utils\nimport { getColor } from 'utils/color'\nimport { getString } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\n\n// Local Types\nimport { SankeyInputLink, SankeyInputNode, SankeyLink } from '../types'\n\n// Config\nimport { SankeyConfigInterface } from '../config'\n\n// Styles\nimport * as s from '../style'\n\nexport type LinkPathOptions = {\n x0: number;\n x1: number;\n y0: number;\n y1: number;\n width: number;\n}\n\nexport function linkPath ({ x0, x1, y0, y1, width }: LinkPathOptions): string {\n const top0 = y0 - width / 2\n const top1 = y1 - width / 2\n const bottom0 = y0 + width / 2\n const bottom1 = y1 + width / 2\n const centerX = (x0 + x1) / 2\n\n return `\n M ${x0}, ${top0}\n\n C ${centerX}, ${top0}\n ${centerX}, ${top1}\n ${x1}, ${top1}\n\n L ${x1}, ${bottom1}\n\n C ${centerX}, ${bottom1}\n ${centerX}, ${bottom0}\n ${x0}, ${bottom0}\n z\n `\n}\n\nexport type LinkAnimState = { x0: number; x1: number; y0: number; y1: number; width: number }\n\nexport interface LinkElement extends SVGPathElement {\n _animState?: LinkAnimState;\n}\n\nexport function createLinks<N extends SankeyInputNode, L extends SankeyInputLink> (\n sel: Selection<SVGGElement, SankeyLink<N, L>, SVGGElement, unknown>\n): void {\n sel.append('path').attr('class', s.linkPath)\n .attr('d', (d: SankeyLink<N, L>, i: number, el: ArrayLike<LinkElement>) => {\n el[i]._animState = {\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(1, d.width),\n }\n return linkPath(el[i]._animState)\n })\n sel.append('path').attr('class', s.linkSelectionHelper)\n sel.style('opacity', 0)\n}\n\nexport function updateLinks<N extends SankeyInputNode, L extends SankeyInputLink> (\n sel: Selection<SVGGElement, SankeyLink<N, L>, SVGGElement, unknown>,\n config: SankeyConfigInterface<N, L>,\n duration: number\n): void {\n smartTransition(sel, duration)\n .style('opacity', (d: SankeyLink<N, L>) => d._state.greyout ? 0.2 : 1)\n\n const linkSelection = sel.select<SVGPathElement>(`.${s.linkPath}`)\n .style('cursor', (d: SankeyLink<N, L>) => getString(d, config.linkCursor))\n\n const selectionTransition = smartTransition(linkSelection, duration)\n .style('fill', (link: SankeyLink<N, L>) => getColor(link, config.linkColor))\n\n if (duration) {\n (selectionTransition as Transition<SVGPathElement, SankeyLink<N, L>, SVGGElement, unknown>)\n .attrTween('d', (d: SankeyLink<N, L>, i: number, el: ArrayLike<LinkElement>) => {\n const previous = el[i]._animState\n const next = {\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(1, d.width),\n }\n const interpolator = {\n x0: interpolateNumber(previous.x0, next.x0),\n x1: interpolateNumber(previous.x1, next.x1),\n y0: interpolateNumber(previous.y0, next.y0),\n y1: interpolateNumber(previous.y1, next.y1),\n width: interpolateNumber(previous.width, next.width),\n }\n el[i]._animState = next\n\n return function (t: number) {\n return linkPath({\n x0: interpolator.x0(t),\n x1: interpolator.x1(t),\n y0: interpolator.y0(t),\n y1: interpolator.y1(t),\n width: interpolator.width(t),\n })\n }\n })\n } else {\n linkSelection.attr('d', (d: SankeyLink<N, L>) => linkPath({\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(1, d.width),\n }))\n }\n\n sel.select(`.${s.linkSelectionHelper}`)\n .attr('d', (d: SankeyLink<N, L>) => linkPath({\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(10, d.width),\n }))\n .style('cursor', d => getString(d, config.linkCursor))\n}\n\nexport function removeLinks<N extends SankeyInputNode, L extends SankeyInputLink> (\n sel: Selection<SVGGElement, SankeyLink<N, L>, SVGGElement, unknown>\n): void {\n sel.remove()\n}\n"],"names":["s.linkPath","s.linkSelectionHelper"],"mappings":";;;;;;AA0BgB,SAAA,QAAQ,CAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAmB,EAAA;AAClE,IAAA,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAC3B,IAAA,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAC3B,IAAA,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAC9B,IAAA,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;IAC9B,MAAM,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IAE7B,OAAO,CAAA;AACD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E,CAAC;SACpC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAmB,KAAK,QAAQ,CAAC;AAC3C,QAAA,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE;AACf,QAAA,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE;QACf,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;AAC7B,KAAA,CAAC,CAAC;AACF,SAAA,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;AAC1D,CAAC;AAEK,SAAU,WAAW,CACzB,GAAmE,EAAA;IAEnE,GAAG,CAAC,MAAM,EAAE,CAAA;AACd;;;;"}
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../../../src/components/sankey/modules/link.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { interpolateNumber } from 'd3-interpolate'\n\n// Utils\nimport { getColor } from 'utils/color'\nimport { getString } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\n\n// Local Types\nimport { SankeyInputLink, SankeyInputNode, SankeyLink } from '../types'\n\n// Config\nimport { SankeyConfigInterface } from '../config'\n\n// Styles\nimport * as s from '../style'\n\nexport type LinkPathOptions = {\n x0: number;\n x1: number;\n y0: number;\n y1: number;\n width: number;\n}\n\nexport function linkPath ({ x0, x1, y0, y1, width }: LinkPathOptions): string {\n const top0 = y0 - width / 2\n const top1 = y1 - width / 2\n const bottom0 = y0 + width / 2\n const bottom1 = y1 + width / 2\n const centerX = (x0 + x1) / 2\n\n return `\n M ${x0}, ${top0}\n\n C ${centerX}, ${top0}\n ${centerX}, ${top1}\n ${x1}, ${top1}\n\n L ${x1}, ${bottom1}\n\n C ${centerX}, ${bottom1}\n ${centerX}, ${bottom0}\n ${x0}, ${bottom0}\n z\n `\n}\n\nexport type LinkAnimState = { x0: number; x1: number; y0: number; y1: number; width: number }\n\nexport interface LinkElement extends SVGPathElement {\n _animState?: LinkAnimState;\n}\n\nexport function createLinks<N extends SankeyInputNode, L extends SankeyInputLink> (\n sel: Selection<SVGGElement, SankeyLink<N, L>, SVGGElement, unknown>\n): void {\n sel.append('path').attr('class', s.linkPath)\n .attr('d', (d: SankeyLink<N, L>, i: number, el: ArrayLike<LinkElement>) => {\n el[i]._animState = {\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(1, d.width),\n }\n return linkPath(el[i]._animState)\n })\n sel.append('path').attr('class', s.linkSelectionHelper)\n sel.style('opacity', 0)\n}\n\nexport function updateLinks<N extends SankeyInputNode, L extends SankeyInputLink> (\n sel: Selection<SVGGElement, SankeyLink<N, L>, SVGGElement, unknown>,\n config: SankeyConfigInterface<N, L>,\n duration: number\n): void {\n smartTransition(sel, duration)\n .style('opacity', (d: SankeyLink<N, L>) => {\n // Hide links if either connected node is collapsed\n if (d.source._state?.collapsed || d.target._state?.collapsed) return 0\n // Apply greyout effect\n return d._state?.greyout ? 0.2 : 1\n })\n\n const linkSelection = sel.select<SVGPathElement>(`.${s.linkPath}`)\n .style('cursor', (d: SankeyLink<N, L>) => getString(d, config.linkCursor))\n .style('pointer-events', (d: SankeyLink<N, L>) => {\n // Disable pointer events for collapsed links to prevent hover interference\n return (d.source._state?.collapsed || d.target._state?.collapsed) ? 'none' : null\n })\n\n const selectionTransition = smartTransition(linkSelection, duration)\n .style('fill', (link: SankeyLink<N, L>) => getColor(link, config.linkColor))\n\n if (duration) {\n (selectionTransition as Transition<SVGPathElement, SankeyLink<N, L>, SVGGElement, unknown>)\n .attrTween('d', (d: SankeyLink<N, L>, i: number, el: ArrayLike<LinkElement>) => {\n const previous = el[i]._animState\n const next = {\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(1, d.width),\n }\n const interpolator = {\n x0: interpolateNumber(previous.x0, next.x0),\n x1: interpolateNumber(previous.x1, next.x1),\n y0: interpolateNumber(previous.y0, next.y0),\n y1: interpolateNumber(previous.y1, next.y1),\n width: interpolateNumber(previous.width, next.width),\n }\n el[i]._animState = next\n\n return function (t: number) {\n return linkPath({\n x0: interpolator.x0(t),\n x1: interpolator.x1(t),\n y0: interpolator.y0(t),\n y1: interpolator.y1(t),\n width: interpolator.width(t),\n })\n }\n })\n } else {\n linkSelection.attr('d', (d: SankeyLink<N, L>) => linkPath({\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(1, d.width),\n }))\n }\n\n sel.select(`.${s.linkSelectionHelper}`)\n .attr('d', (d: SankeyLink<N, L>) => linkPath({\n x0: d.source.x1,\n x1: d.target.x0,\n y0: d.y0,\n y1: d.y1,\n width: Math.max(10, d.width),\n }))\n .style('cursor', d => getString(d, config.linkCursor))\n .style('pointer-events', (d: SankeyLink<N, L>) => (d.source._state?.collapsed || d.target._state?.collapsed) ? 'none' : null)\n}\n\nexport function removeLinks<N extends SankeyInputNode, L extends SankeyInputLink> (\n sel: Selection<SVGGElement, SankeyLink<N, L>, SVGGElement, unknown>\n): void {\n sel.remove()\n}\n"],"names":["s.linkPath","s.linkSelectionHelper"],"mappings":";;;;;;AA0BgB,SAAA,QAAQ,CAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAmB,EAAA;AAClE,IAAA,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAC3B,IAAA,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAC3B,IAAA,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAC9B,IAAA,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;IAC9B,MAAM,OAAO,GAAG,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C,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;AAC7B,KAAA,CAAC,CAAC;AACF,SAAA,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;AACrD,SAAA,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAmB,KAAK,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA,CAAA,OAAA,CAAC,CAAA,MAAA,CAAC,CAAC,MAAM,CAAC,MAAM,0CAAE,SAAS,MAAI,CAAA,EAAA,GAAA,CAAC,CAAC,MAAM,CAAC,MAAM,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAS,CAAA,IAAI,MAAM,GAAG,IAAI,CAAA,EAAA,CAAC,CAAA;AACjI,CAAC;AAEK,SAAU,WAAW,CACzB,GAAmE,EAAA;IAEnE,GAAG,CAAC,MAAM,EAAE,CAAA;AACd;;;;"}
|
|
@@ -37,6 +37,8 @@ export declare type SankeyNode<N extends SankeyInputNode, L extends SankeyInputL
|
|
|
37
37
|
_state?: {
|
|
38
38
|
greyout?: boolean;
|
|
39
39
|
precalculatedHeight?: number;
|
|
40
|
+
/** Whether this node is collapsed (hides all connected links) */
|
|
41
|
+
collapsed?: boolean;
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
export declare type SankeyLink<N extends SankeyInputNode, L extends SankeyInputLink> = GraphLinkCore<N, L> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/components/sankey/types.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport { sankeyLeft, sankeyRight, sankeyCenter, sankeyJustify } from 'd3-sankey'\nimport { GraphInputLink, GraphLinkCore, GraphNodeCore } from 'types/graph'\nimport { GraphInputNode } from '../../types'\n\nexport type SankeyInputNode = GraphInputNode\n\nexport type SankeyInputLink = GraphInputLink\n\nexport type SankeyNode<N extends SankeyInputNode, L extends SankeyInputLink> = GraphNodeCore<N, L> & {\n id: string;\n /** the node’s value; this is the sum of link.value for the node’s incoming links, or node.fixedValue if defined */\n value: number;\n /** */\n fixedValue?: number;\n /** the node’s zero-based column index, corresponding to its horizontal position */\n layer: number;\n /** */\n isConnected: boolean;\n /** the array of incoming links which have this node as their source */\n sourceLinks?: SankeyLink<N, L>[];\n /** the array of outgoing links which have this node as their target */\n targetLinks: SankeyLink<N, L>[];\n /** the node’s zero-based index within the array of nodes */\n index: number;\n /** the node’s zero-based graph depth, derived from the graph topology */\n depth: number;\n /** node.height - the node’s zero-based graph height, derived from the graph topology */\n height: number;\n /** the node’s minimum horizontal position, derived from node.depth */\n x0: number;\n /** the node’s maximum horizontal position (node.x0 + sankey.nodeWidth) */\n x1: number;\n /** the node’s minimum vertical position */\n y0: number;\n /** the node’s maximum vertical position (node.y1 - node.y0 is proportional to node.value) */\n y1: number;\n /** calculated node width */\n width: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n /* Pre-calculated node height value in pixels that will be used to manually generate the layout when data has no links */\n precalculatedHeight?: number;\n };\n}\n\nexport type SankeyLink<N extends SankeyInputNode, L extends SankeyInputLink> = GraphLinkCore<N, L> & {\n value: number;\n /** the link’s source node */\n source: SankeyNode<N, L>;\n /** the link’s target node */\n target: SankeyNode<N, L>;\n /** the link’s vertical starting position (at source node) */\n y0: number;\n /** the link’s vertical end position (at target node) */\n y1: number;\n /** the link’s width (proportional to link.value) */\n width: number;\n /** the zero-based index of link within the array of links */\n index: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n };\n}\n\nexport enum SankeySubLabelPlacement {\n Inline = 'inline',\n Below = 'below',\n}\n\nexport enum SankeyNodeAlign {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n Justify = 'justify',\n}\n\nexport const SankeyLayout = {\n [SankeyNodeAlign.Left]: sankeyLeft,\n [SankeyNodeAlign.Right]: sankeyRight,\n [SankeyNodeAlign.Center]: sankeyCenter,\n [SankeyNodeAlign.Justify]: sankeyJustify,\n}\n\nexport enum SankeyExitTransitionType {\n Default = 'default',\n ToAncestor = 'to ancestor',\n}\n\nexport enum SankeyEnterTransitionType {\n Default = 'default',\n FromAncestor = 'from ancestor',\n}\n"],"names":[],"mappings":";;AAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/sankey/types.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport { sankeyLeft, sankeyRight, sankeyCenter, sankeyJustify } from 'd3-sankey'\nimport { GraphInputLink, GraphLinkCore, GraphNodeCore } from 'types/graph'\nimport { GraphInputNode } from '../../types'\n\nexport type SankeyInputNode = GraphInputNode\n\nexport type SankeyInputLink = GraphInputLink\n\nexport type SankeyNode<N extends SankeyInputNode, L extends SankeyInputLink> = GraphNodeCore<N, L> & {\n id: string;\n /** the node’s value; this is the sum of link.value for the node’s incoming links, or node.fixedValue if defined */\n value: number;\n /** */\n fixedValue?: number;\n /** the node’s zero-based column index, corresponding to its horizontal position */\n layer: number;\n /** */\n isConnected: boolean;\n /** the array of incoming links which have this node as their source */\n sourceLinks?: SankeyLink<N, L>[];\n /** the array of outgoing links which have this node as their target */\n targetLinks: SankeyLink<N, L>[];\n /** the node’s zero-based index within the array of nodes */\n index: number;\n /** the node’s zero-based graph depth, derived from the graph topology */\n depth: number;\n /** node.height - the node’s zero-based graph height, derived from the graph topology */\n height: number;\n /** the node’s minimum horizontal position, derived from node.depth */\n x0: number;\n /** the node’s maximum horizontal position (node.x0 + sankey.nodeWidth) */\n x1: number;\n /** the node’s minimum vertical position */\n y0: number;\n /** the node’s maximum vertical position (node.y1 - node.y0 is proportional to node.value) */\n y1: number;\n /** calculated node width */\n width: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n /* Pre-calculated node height value in pixels that will be used to manually generate the layout when data has no links */\n precalculatedHeight?: number;\n /** Whether this node is collapsed (hides all connected links) */\n collapsed?: boolean;\n };\n}\n\nexport type SankeyLink<N extends SankeyInputNode, L extends SankeyInputLink> = GraphLinkCore<N, L> & {\n value: number;\n /** the link’s source node */\n source: SankeyNode<N, L>;\n /** the link’s target node */\n target: SankeyNode<N, L>;\n /** the link’s vertical starting position (at source node) */\n y0: number;\n /** the link’s vertical end position (at target node) */\n y1: number;\n /** the link’s width (proportional to link.value) */\n width: number;\n /** the zero-based index of link within the array of links */\n index: number;\n /** internal ui state */\n _state?: {\n greyout?: boolean;\n };\n}\n\nexport enum SankeySubLabelPlacement {\n Inline = 'inline',\n Below = 'below',\n}\n\nexport enum SankeyNodeAlign {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n Justify = 'justify',\n}\n\nexport const SankeyLayout = {\n [SankeyNodeAlign.Left]: sankeyLeft,\n [SankeyNodeAlign.Right]: sankeyRight,\n [SankeyNodeAlign.Center]: sankeyCenter,\n [SankeyNodeAlign.Justify]: sankeyJustify,\n}\n\nexport enum SankeyExitTransitionType {\n Default = 'default',\n ToAncestor = 'to ancestor',\n}\n\nexport enum SankeyEnterTransitionType {\n Default = 'default',\n FromAncestor = 'from ancestor',\n}\n"],"names":[],"mappings":";;AAAA;IAqEY,wBAGX;AAHD,CAAA,UAAY,uBAAuB,EAAA;AACjC,IAAA,uBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,uBAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,GAGlC,EAAA,CAAA,CAAA,CAAA;IAEW,gBAKX;AALD,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,eAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EALW,eAAe,KAAf,eAAe,GAK1B,EAAA,CAAA,CAAA,CAAA;AAEY,MAAA,YAAY,GAAG;AAC1B,IAAA,CAAC,eAAe,CAAC,IAAI,GAAG,UAAU;AAClC,IAAA,CAAC,eAAe,CAAC,KAAK,GAAG,WAAW;AACpC,IAAA,CAAC,eAAe,CAAC,MAAM,GAAG,YAAY;AACtC,IAAA,CAAC,eAAe,CAAC,OAAO,GAAG,aAAa;EACzC;IAEW,yBAGX;AAHD,CAAA,UAAY,wBAAwB,EAAA;AAClC,IAAA,wBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,wBAAA,CAAA,YAAA,CAAA,GAAA,aAA0B,CAAA;AAC5B,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,GAGnC,EAAA,CAAA,CAAA,CAAA;IAEW,0BAGX;AAHD,CAAA,UAAY,yBAAyB,EAAA;AACnC,IAAA,yBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,eAA8B,CAAA;AAChC,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,GAGpC,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { ComponentConfigInterface } from "../../core/component/config";
|
|
2
2
|
import { ColorAccessor, NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
3
|
+
import { FitMode, TrimMode } from "../../types/text";
|
|
3
4
|
import { TreemapNode } from './types';
|
|
4
5
|
export interface TreemapConfigInterface<Datum> extends ComponentConfigInterface {
|
|
5
6
|
id?: ((d: Datum, i: number) => string | number);
|
|
6
7
|
value?: NumericAccessor<Datum>;
|
|
7
8
|
/** Array of accessor functions to defined the nested groups. Default: `[]` */
|
|
8
9
|
layers: StringAccessor<Datum>[];
|
|
9
|
-
/**
|
|
10
|
+
/** @deprecated Define `tileLabel` instead.
|
|
11
|
+
* A function that accepts a value number and returns a string. Default: `(value: number) => `${value}`` */
|
|
10
12
|
numberFormat?: (value: number) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Function to generate the label text for each tile. Receives the `TreemapNode` and returns a `string`.
|
|
15
|
+
* Default: shows key and formatted value (e.g., "label: value").
|
|
16
|
+
*/
|
|
17
|
+
tileLabel?: (node: TreemapNode<Datum>) => string;
|
|
11
18
|
/** Color accessor function for tiles. Default: `undefined` */
|
|
12
19
|
tileColor?: ColorAccessor<TreemapNode<Datum>>;
|
|
13
20
|
/** Padding passed to D3 treemap layout. Default: `2` */
|
|
@@ -24,6 +31,10 @@ export interface TreemapConfigInterface<Datum> extends ComponentConfigInterface
|
|
|
24
31
|
labelOffsetX?: number;
|
|
25
32
|
/** Label offset in the Y direction. Default: `4` */
|
|
26
33
|
labelOffsetY?: number;
|
|
34
|
+
/** How labels should fit within tiles: wrap or trim. Applicable only for leaf nodes. Default: `FitMode.Wrap` */
|
|
35
|
+
labelFit?: FitMode;
|
|
36
|
+
/** Label trimming mode. Default: `TrimMode.Middle` */
|
|
37
|
+
labelTrimMode?: TrimMode;
|
|
27
38
|
/** Border radius of the tiles in pixels. Default: `2` */
|
|
28
39
|
tileBorderRadius?: number;
|
|
29
40
|
/** Minimum fraction of width for border radius. Default: `1/8` */
|
|
@@ -32,21 +43,17 @@ export interface TreemapConfigInterface<Datum> extends ComponentConfigInterface
|
|
|
32
43
|
enableLightnessVariance?: boolean;
|
|
33
44
|
/** Enable font size variation for leaf node labels based on value. Default: `false` */
|
|
34
45
|
enableTileLabelFontSizeVariation?: boolean;
|
|
35
|
-
/** Small font size for leaf labels (used when enableTileLabelFontSizeVariation is true). Default: `8` */
|
|
46
|
+
/** Small font size for leaf labels (used when `enableTileLabelFontSizeVariation` is `true`). Default: `8` */
|
|
36
47
|
tileLabelSmallFontSize?: number;
|
|
37
|
-
/** Medium font size for leaf labels (used when enableTileLabelFontSizeVariation is true). Default: `12` */
|
|
48
|
+
/** Medium font size for leaf labels (used when `enableTileLabelFontSizeVariation` is `true`). Default: `12` */
|
|
38
49
|
tileLabelMediumFontSize?: number;
|
|
39
|
-
/** Large font size for leaf labels (used when enableTileLabelFontSizeVariation is true). Default: `24` */
|
|
50
|
+
/** Large font size for leaf labels (used when `enableTileLabelFontSizeVariation` is `true`). Default: `24` */
|
|
40
51
|
tileLabelLargeFontSize?: number;
|
|
41
52
|
/** Flag for showing cursor:pointer to indicate leaf tiles are clickable. Default: `undefined` */
|
|
42
53
|
showTileClickAffordance?: boolean;
|
|
43
|
-
/** Amount of lightness variation applied to sibling tiles when enableLightnessVariance is true
|
|
54
|
+
/** Amount of lightness variation applied to sibling tiles when `enableLightnessVariance` is `true`. Default: `0.08` */
|
|
44
55
|
lightnessVariationAmount?: number;
|
|
56
|
+
/** Minimum size for labels in pixels. Default: `20` */
|
|
45
57
|
minTileSizeForLabel?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Function to generate the label text for each tile. Receives the TreemapNode and returns a string.
|
|
48
|
-
* Default: shows key and formatted value (e.g., "label: value").
|
|
49
|
-
*/
|
|
50
|
-
tileLabel?: (node: TreemapNode<Datum>) => string;
|
|
51
58
|
}
|
|
52
59
|
export declare const TreemapDefaultConfig: TreemapConfigInterface<unknown>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentDefaultConfig } from '../../core/component/config.js';
|
|
2
|
+
import { FitMode, TrimMode } from '../../types/text.js';
|
|
2
3
|
|
|
3
|
-
const TreemapDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { id: (d, i) => { var _a; return (_a = d.id) !== null && _a !== void 0 ? _a : i; }, value: undefined, tileColor: undefined, layers: [], tilePadding: 2, tilePaddingTop: undefined, labelInternalNodes: false, labelOffsetX: 4, labelOffsetY: 4, tileBorderRadius: 2, tileBorderRadiusFactor: 1 / 8, enableLightnessVariance: false, enableTileLabelFontSizeVariation: true, tileLabelSmallFontSize: 8, tileLabelMediumFontSize: 12, tileLabelLargeFontSize: 22, showTileClickAffordance: false, lightnessVariationAmount: 0.08, minTileSizeForLabel: 20, tileLabel:
|
|
4
|
+
const TreemapDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { id: (d, i) => { var _a; return (_a = d.id) !== null && _a !== void 0 ? _a : i; }, value: undefined, tileColor: undefined, layers: [], tilePadding: 2, tilePaddingTop: undefined, labelInternalNodes: false, labelOffsetX: 4, labelOffsetY: 4, labelFit: FitMode.Wrap, labelTrimMode: TrimMode.Middle, tileBorderRadius: 2, tileBorderRadiusFactor: 1 / 8, enableLightnessVariance: false, enableTileLabelFontSizeVariation: true, tileLabelSmallFontSize: 8, tileLabelMediumFontSize: 12, tileLabelLargeFontSize: 22, showTileClickAffordance: false, lightnessVariationAmount: 0.08, minTileSizeForLabel: 20, numberFormat: (value) => `${value}`, tileLabel: function (d) { return `${d.data.key}: ${this.numberFormat(d.value)}`; } });
|
|
4
5
|
|
|
5
6
|
export { TreemapDefaultConfig };
|
|
6
7
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/treemap/config.ts"],"sourcesContent":["import { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { TreemapNode } from './types'\n\nexport interface TreemapConfigInterface<Datum> extends ComponentConfigInterface {\n id?: ((d: Datum, i: number) => string | number);\n /* Numeric accessor for segment size value. Default: `undefined`. */\n value?: NumericAccessor<Datum>;\n\n /** Array of accessor functions to defined the nested groups. Default: `[]` */\n layers: StringAccessor<Datum>[];\n\n /** A function that accepts a value number and returns a string. Default: `
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/treemap/config.ts"],"sourcesContent":["import { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\nimport { FitMode, TrimMode } from 'types/text'\nimport { TreemapNode } from './types'\n\nexport interface TreemapConfigInterface<Datum> extends ComponentConfigInterface {\n id?: ((d: Datum, i: number) => string | number);\n /* Numeric accessor for segment size value. Default: `undefined`. */\n value?: NumericAccessor<Datum>;\n\n /** Array of accessor functions to defined the nested groups. Default: `[]` */\n layers: StringAccessor<Datum>[];\n\n /** @deprecated Define `tileLabel` instead.\n * A function that accepts a value number and returns a string. Default: `(value: number) => `${value}`` */\n numberFormat?: (value: number) => string;\n\n /**\n * Function to generate the label text for each tile. Receives the `TreemapNode` and returns a `string`.\n * Default: shows key and formatted value (e.g., \"label: value\").\n */\n tileLabel?: (node: TreemapNode<Datum>) => string;\n\n /** Color accessor function for tiles. Default: `undefined` */\n tileColor?: ColorAccessor<TreemapNode<Datum>>;\n\n /** Padding passed to D3 treemap layout. Default: `2` */\n tilePadding?: number;\n\n /**\n * Top padding passed to D3 treemap layout.\n * Useful to make room for internal node labels.\n * Default: `undefined`\n */\n tilePaddingTop?: number;\n\n /** Label internal nodes. Default: `false` */\n labelInternalNodes?: boolean;\n\n /** Label offset in the X direction. Default: `4` */\n labelOffsetX?: number;\n\n /** Label offset in the Y direction. Default: `4` */\n labelOffsetY?: number;\n\n /** How labels should fit within tiles: wrap or trim. Applicable only for leaf nodes. Default: `FitMode.Wrap` */\n labelFit?: FitMode;\n\n /** Label trimming mode. Default: `TrimMode.Middle` */\n labelTrimMode?: TrimMode;\n\n /** Border radius of the tiles in pixels. Default: `2` */\n tileBorderRadius?: number;\n\n /** Minimum fraction of width for border radius. Default: `1/8` */\n tileBorderRadiusFactor?: number;\n\n /** Enable lightness variance for sibling tiles. Default: `false` */\n enableLightnessVariance?: boolean;\n\n /** Enable font size variation for leaf node labels based on value. Default: `false` */\n enableTileLabelFontSizeVariation?: boolean;\n\n /** Small font size for leaf labels (used when `enableTileLabelFontSizeVariation` is `true`). Default: `8` */\n tileLabelSmallFontSize?: number;\n\n /** Medium font size for leaf labels (used when `enableTileLabelFontSizeVariation` is `true`). Default: `12` */\n tileLabelMediumFontSize?: number;\n\n /** Large font size for leaf labels (used when `enableTileLabelFontSizeVariation` is `true`). Default: `24` */\n tileLabelLargeFontSize?: number;\n\n\n /** Flag for showing cursor:pointer to indicate leaf tiles are clickable. Default: `undefined` */\n showTileClickAffordance?: boolean;\n\n /** Amount of lightness variation applied to sibling tiles when `enableLightnessVariance` is `true`. Default: `0.08` */\n lightnessVariationAmount?: number;\n\n /** Minimum size for labels in pixels. Default: `20` */\n minTileSizeForLabel?: number;\n}\n\nexport const TreemapDefaultConfig: TreemapConfigInterface<unknown> = {\n ...ComponentDefaultConfig,\n id: (d: unknown, i: number): string | number => (d as { id: string }).id ?? i,\n value: undefined,\n tileColor: undefined,\n layers: [],\n tilePadding: 2,\n tilePaddingTop: undefined,\n labelInternalNodes: false,\n labelOffsetX: 4,\n labelOffsetY: 4,\n labelFit: FitMode.Wrap,\n labelTrimMode: TrimMode.Middle,\n tileBorderRadius: 2,\n tileBorderRadiusFactor: 1 / 8,\n enableLightnessVariance: false,\n enableTileLabelFontSizeVariation: true,\n tileLabelSmallFontSize: 8,\n tileLabelMediumFontSize: 12,\n tileLabelLargeFontSize: 22,\n showTileClickAffordance: false,\n lightnessVariationAmount: 0.08,\n minTileSizeForLabel: 20,\n numberFormat: (value: number) => `${value}`,\n tileLabel: function (d: TreemapNode<unknown>): string { return `${d.data.key}: ${this.numberFormat(d.value)}` },\n}\n"],"names":[],"mappings":";;;AAmFO,MAAM,oBAAoB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC5B,sBAAsB,CACzB,EAAA,EAAA,EAAE,EAAE,CAAC,CAAU,EAAE,CAAS,eAAsB,OAAA,CAAA,EAAA,GAAC,CAAoB,CAAC,EAAE,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAA,EAAA,EAC7E,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,EAAE,EACV,WAAW,EAAE,CAAC,EACd,cAAc,EAAE,SAAS,EACzB,kBAAkB,EAAE,KAAK,EACzB,YAAY,EAAE,CAAC,EACf,YAAY,EAAE,CAAC,EACf,QAAQ,EAAE,OAAO,CAAC,IAAI,EACtB,aAAa,EAAE,QAAQ,CAAC,MAAM,EAC9B,gBAAgB,EAAE,CAAC,EACnB,sBAAsB,EAAE,CAAC,GAAG,CAAC,EAC7B,uBAAuB,EAAE,KAAK,EAC9B,gCAAgC,EAAE,IAAI,EACtC,sBAAsB,EAAE,CAAC,EACzB,uBAAuB,EAAE,EAAE,EAC3B,sBAAsB,EAAE,EAAE,EAC1B,uBAAuB,EAAE,KAAK,EAC9B,wBAAwB,EAAE,IAAI,EAC9B,mBAAmB,EAAE,EAAE,EACvB,YAAY,EAAE,CAAC,KAAa,KAAK,GAAG,KAAK,CAAA,CAAE,EAC3C,SAAS,EAAE,UAAU,CAAuB,EAAY,EAAA,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAA,EAAA,EAAK,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAE,CAAA,CAAA,EAAE;;;;"}
|
|
@@ -7,8 +7,6 @@ export declare class Treemap<Datum> extends ComponentCore<Datum[], TreemapConfig
|
|
|
7
7
|
static selectors: typeof s;
|
|
8
8
|
protected _defaultConfig: TreemapConfigInterface<Datum>;
|
|
9
9
|
config: TreemapConfigInterface<Datum>;
|
|
10
|
-
/** Default number format for tile labels. */
|
|
11
|
-
private _defaultNumberFormat;
|
|
12
10
|
datamodel: SeriesDataModel<Datum>;
|
|
13
11
|
tiles: Selection<SVGGElement, unknown, SVGGElement, unknown>;
|
|
14
12
|
private _isTileLargeEnough;
|
|
@@ -5,14 +5,15 @@ import { scaleLinear, scaleThreshold } from 'd3-scale';
|
|
|
5
5
|
import { hsl } from 'd3-color';
|
|
6
6
|
import { ComponentCore } from '../../core/component/index.js';
|
|
7
7
|
import { SeriesDataModel } from '../../data-models/series.js';
|
|
8
|
-
import { getColor, getHexValue, brighter } from '../../utils/color.js';
|
|
8
|
+
import { getColor, getHexValue, brighter, isColorDark } from '../../utils/color.js';
|
|
9
9
|
import { isNumber, getString, getNumber } from '../../utils/data.js';
|
|
10
10
|
import { smartTransition } from '../../utils/d3.js';
|
|
11
|
-
import { trimSVGText } from '../../utils/text.js';
|
|
12
|
-
import {
|
|
11
|
+
import { wrapSVGText, trimSVGText } from '../../utils/text.js';
|
|
12
|
+
import { cssvar } from '../../utils/style.js';
|
|
13
|
+
import { FitMode } from '../../types/text.js';
|
|
13
14
|
import { TreemapDefaultConfig } from './config.js';
|
|
14
15
|
import * as style from './style.js';
|
|
15
|
-
import { tiles, tileGroup, tile, clickableTile, labelGroup, label, internalLabel } from './style.js';
|
|
16
|
+
import { tiles, tileGroup, tile, clickableTile, labelGroup, label, variables, internalLabel } from './style.js';
|
|
16
17
|
|
|
17
18
|
class Treemap extends ComponentCore {
|
|
18
19
|
constructor(config) {
|
|
@@ -24,10 +25,6 @@ class Treemap extends ComponentCore {
|
|
|
24
25
|
this.setConfig(config);
|
|
25
26
|
this.tiles = this.g.append('g').attr('class', tiles);
|
|
26
27
|
}
|
|
27
|
-
/** Default number format for tile labels. */
|
|
28
|
-
_defaultNumberFormat(value) {
|
|
29
|
-
return `${value}`;
|
|
30
|
-
}
|
|
31
28
|
_isTileLargeEnough(d) {
|
|
32
29
|
const w = d.x1 - d.x0;
|
|
33
30
|
const h = d.y1 - d.y0;
|
|
@@ -44,11 +41,9 @@ class Treemap extends ComponentCore {
|
|
|
44
41
|
return this.config.lightnessVariationAmount * ((maxValue - node.value) / (maxValue - minValue));
|
|
45
42
|
}
|
|
46
43
|
_render(customDuration) {
|
|
47
|
-
var _a
|
|
44
|
+
var _a;
|
|
48
45
|
super._render(customDuration);
|
|
49
46
|
const { config, datamodel: { data }, _width, _height } = this;
|
|
50
|
-
const { numberFormat } = config;
|
|
51
|
-
const formatNumber = numberFormat !== null && numberFormat !== void 0 ? numberFormat : this._defaultNumberFormat.bind(this);
|
|
52
47
|
const duration = isNumber(customDuration) ? customDuration : config.duration;
|
|
53
48
|
if (!((_a = config.layers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
54
49
|
console.warn('Unovis | Treemap: No layers defined');
|
|
@@ -66,7 +61,7 @@ class Treemap extends ComponentCore {
|
|
|
66
61
|
const rootNode = hierarchy(nestedData);
|
|
67
62
|
// Compute the aggregation
|
|
68
63
|
if (config.value) {
|
|
69
|
-
rootNode.sum(index =>
|
|
64
|
+
rootNode.sum(index => isNumber(index) && getNumber(data[index], config.value, index));
|
|
70
65
|
}
|
|
71
66
|
else {
|
|
72
67
|
rootNode.count();
|
|
@@ -127,36 +122,33 @@ class Treemap extends ComponentCore {
|
|
|
127
122
|
config.tileLabelMediumFontSize,
|
|
128
123
|
config.tileLabelLargeFontSize,
|
|
129
124
|
]);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const siblings = node.parent.children;
|
|
145
|
-
const lightnessAdjustment = this._getTileLightness(node, siblings);
|
|
146
|
-
hslColor.l = Math.min(1, hslColor.l + lightnessAdjustment);
|
|
147
|
-
}
|
|
148
|
-
// Brightness increase for depth
|
|
149
|
-
node._fill = brighter(hslColor.toString(), brightnessIncrease(node.depth));
|
|
125
|
+
const visibleTiles = descendants.filter(d => d.depth > 0);
|
|
126
|
+
const firstLevelTiles = visibleTiles.filter(d => d.depth === 1);
|
|
127
|
+
const nonFirstLevelTiles = visibleTiles.filter(d => d.depth > 1);
|
|
128
|
+
// Set the fill color for the first level tiles
|
|
129
|
+
firstLevelTiles.forEach((d, i) => {
|
|
130
|
+
d._fill = getColor(d, config.tileColor, i);
|
|
131
|
+
});
|
|
132
|
+
// Set the fill color for the non-first level tiles
|
|
133
|
+
nonFirstLevelTiles.forEach((d, i) => {
|
|
134
|
+
var _a;
|
|
135
|
+
const providedColor = getColor(d, config.tileColor, i, true);
|
|
136
|
+
if (providedColor) {
|
|
137
|
+
d._fill = providedColor;
|
|
138
|
+
return;
|
|
150
139
|
}
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
const hslColor = hsl(getHexValue((_a = d.parent) === null || _a === void 0 ? void 0 : _a._fill, this.element));
|
|
141
|
+
if (config.enableLightnessVariance && !d.children && d.parent) {
|
|
142
|
+
const siblings = d.parent.children;
|
|
143
|
+
const lightnessAdjustment = this._getTileLightness(d, siblings);
|
|
144
|
+
hslColor.l = Math.min(1, hslColor.l + lightnessAdjustment);
|
|
153
145
|
}
|
|
146
|
+
d._fill = brighter(hslColor.toString(), brightnessIncrease(d.depth));
|
|
154
147
|
});
|
|
155
148
|
// Render tiles
|
|
156
|
-
const visibleNodes = descendants.filter(d => d.depth > 0);
|
|
157
149
|
const tiles = this.tiles
|
|
158
150
|
.selectAll(`g.${tileGroup}`)
|
|
159
|
-
.data(
|
|
151
|
+
.data(visibleTiles, d => `${d.data.key}-${d.depth}`);
|
|
160
152
|
const tilesEnter = tiles
|
|
161
153
|
.enter()
|
|
162
154
|
.append('g')
|
|
@@ -168,92 +160,87 @@ class Treemap extends ComponentCore {
|
|
|
168
160
|
// This ensures that the tile border radius is not
|
|
169
161
|
// larger than the tile size, which makes small tiles
|
|
170
162
|
// look better.
|
|
171
|
-
const
|
|
172
|
-
//
|
|
163
|
+
const getTileBorderRadius = (d) => Math.min(config.tileBorderRadius, (d.x1 - d.x0) * config.tileBorderRadiusFactor);
|
|
164
|
+
// Add clipPath elements
|
|
173
165
|
tilesEnter
|
|
166
|
+
.append('clipPath')
|
|
167
|
+
.attr('id', d => `clip-${this.uid}-${d._id}`)
|
|
168
|
+
.append('rect')
|
|
169
|
+
.attr('rx', getTileBorderRadius)
|
|
170
|
+
.attr('ry', getTileBorderRadius);
|
|
171
|
+
// Tile rectangles
|
|
172
|
+
const tileRects = tilesEnter
|
|
174
173
|
.append('rect')
|
|
175
174
|
.classed(tile, true)
|
|
176
|
-
// Make the leaf tiles clickable if a click handler is provided
|
|
177
175
|
.classed(clickableTile, d => config.showTileClickAffordance && !d.children)
|
|
178
|
-
.attr('rx',
|
|
179
|
-
.attr('ry',
|
|
180
|
-
// Initialize tile positions so that the initial transition is smooth
|
|
176
|
+
.attr('rx', getTileBorderRadius)
|
|
177
|
+
.attr('ry', getTileBorderRadius)
|
|
181
178
|
.attr('x', d => d.x0)
|
|
182
179
|
.attr('y', d => d.y0)
|
|
183
180
|
.attr('width', d => d.x1 - d.x0)
|
|
184
181
|
.attr('height', d => d.y1 - d.y0)
|
|
185
|
-
.style('fill', d =>
|
|
182
|
+
.style('fill', d => d._fill)
|
|
186
183
|
.style('opacity', 0)
|
|
187
184
|
.style('cursor', config.showTileClickAffordance ? d => !d.children ? 'pointer' : null : null);
|
|
188
|
-
|
|
189
|
-
smartTransition(mergedTiles.select(`rect.${tile}`), duration)
|
|
190
|
-
.style('fill', d => { var _a; return (_a = d._fill) !== null && _a !== void 0 ? _a : getColor(d, config.tileColor); })
|
|
191
|
-
.style('opacity', 1)
|
|
192
|
-
.attr('x', d => d.x0)
|
|
193
|
-
.attr('y', d => d.y0)
|
|
194
|
-
.attr('width', d => d.x1 - d.x0)
|
|
195
|
-
.attr('height', d => d.y1 - d.y0);
|
|
196
|
-
// Update clipPath rects
|
|
197
|
-
let svg = this.g.node();
|
|
198
|
-
while (svg && !(svg instanceof SVGSVGElement))
|
|
199
|
-
svg = svg.parentElement;
|
|
200
|
-
const defs = svg ? (select(svg).select('defs').empty() ? select(svg).append('defs') : select(svg).select('defs')) : null;
|
|
201
|
-
if (!defs)
|
|
202
|
-
return;
|
|
203
|
-
const defsSelection = defs;
|
|
204
|
-
const clipPaths = defsSelection.selectAll('clipPath')
|
|
205
|
-
.data(visibleNodes, (d) => d._id);
|
|
206
|
-
clipPaths.enter()
|
|
207
|
-
.append('clipPath')
|
|
208
|
-
.attr('id', (d) => `clip-${d._id}`)
|
|
209
|
-
.append('rect')
|
|
210
|
-
.attr('x', (d) => d.x0)
|
|
211
|
-
.attr('y', (d) => d.y0)
|
|
212
|
-
.attr('width', (d) => Math.max(0.1, d.x1 - d.x0))
|
|
213
|
-
.attr('height', (d) => Math.max(0.1, d.y1 - d.y0))
|
|
214
|
-
.attr('rx', rx)
|
|
215
|
-
.attr('ry', rx);
|
|
216
|
-
clipPaths.exit().remove();
|
|
185
|
+
tileRects.append('title');
|
|
217
186
|
tilesEnter
|
|
218
187
|
.append('g')
|
|
219
188
|
.attr('class', labelGroup)
|
|
189
|
+
.attr('clip-path', d => `url(#clip-${this.uid}-${d._id})`)
|
|
220
190
|
.attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`)
|
|
191
|
+
.style('opacity', 0)
|
|
221
192
|
.append('text')
|
|
222
193
|
.attr('class', label)
|
|
223
194
|
.attr('x', 0)
|
|
224
|
-
.attr('y', 0)
|
|
225
|
-
|
|
226
|
-
const
|
|
195
|
+
.attr('y', 0);
|
|
196
|
+
const mergedTiles = tiles.merge(tilesEnter);
|
|
197
|
+
const tileRectsMerged = mergedTiles.select(`rect.${tile}`);
|
|
198
|
+
smartTransition(tileRectsMerged, duration)
|
|
199
|
+
.style('fill', d => d._fill)
|
|
200
|
+
.style('opacity', 1)
|
|
201
|
+
.attr('x', d => d.x0)
|
|
202
|
+
.attr('y', d => d.y0)
|
|
203
|
+
.attr('width', d => d.x1 - d.x0)
|
|
204
|
+
.attr('height', d => d.y1 - d.y0);
|
|
205
|
+
tileRectsMerged.select('title')
|
|
206
|
+
.text(d => config.tileLabel(d));
|
|
207
|
+
// Update clipPath rects
|
|
208
|
+
mergedTiles.select('clipPath rect')
|
|
209
|
+
.attr('width', d => d.x1 - d.x0 - 2 * config.labelOffsetX)
|
|
210
|
+
.attr('height', d => d.y1 - d.y0 - 2 * config.labelOffsetY);
|
|
227
211
|
const textSelection = mergedTiles.selectAll(`g.${labelGroup} text`);
|
|
228
212
|
textSelection
|
|
229
|
-
.text(d =>
|
|
230
|
-
.
|
|
213
|
+
.text(d => config.tileLabel(d))
|
|
214
|
+
.attr('title', d => config.tileLabel(d))
|
|
215
|
+
.property('font-size-px', d => {
|
|
231
216
|
var _a;
|
|
232
217
|
const sqrtVal = Math.sqrt((_a = d.value) !== null && _a !== void 0 ? _a : 0);
|
|
233
218
|
return config.enableTileLabelFontSizeVariation && !d.children
|
|
234
|
-
?
|
|
235
|
-
:
|
|
219
|
+
? fontSizeScale(sqrtVal)
|
|
220
|
+
: null; // Use the default css variable value
|
|
236
221
|
})
|
|
237
|
-
.
|
|
238
|
-
|
|
239
|
-
|
|
222
|
+
.style('font-size', (_, i, els) => `${select(els[i]).property('font-size-px')}px`)
|
|
223
|
+
.style('fill', d => cssvar(isColorDark(d._fill) ? variables.treemapLabelTextColorLight : variables.treemapLabelTextColor));
|
|
224
|
+
// Fit label (wrap or trim)
|
|
225
|
+
textSelection.each((d, i, els) => {
|
|
240
226
|
var _a;
|
|
241
|
-
const
|
|
227
|
+
const isLeafNode = !d.children;
|
|
228
|
+
const el = els[i];
|
|
229
|
+
const text = select(el);
|
|
242
230
|
const tileWidth = d.x1 - d.x0 - ((_a = config.labelOffsetX) !== null && _a !== void 0 ? _a : 0) * 2;
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
231
|
+
const fontSize = parseFloat(text.property('font-size-px')) || parseFloat(window.getComputedStyle(el).fontSize);
|
|
232
|
+
if (config.labelFit === FitMode.Wrap && isLeafNode) {
|
|
233
|
+
wrapSVGText(text, tileWidth);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
trimSVGText(text, tileWidth, config.labelTrimMode, true, fontSize);
|
|
247
237
|
}
|
|
248
|
-
trimSVGText(text, tileWidth, TrimMode.End, true, fontSize);
|
|
249
|
-
text.attr('title', fullLabel);
|
|
250
|
-
text.selectAll('tspan').attr('dominant-baseline', 'middle');
|
|
251
238
|
});
|
|
252
239
|
// Transition group position
|
|
253
240
|
smartTransition(mergedTiles.select(`g.${labelGroup}`), duration)
|
|
254
241
|
.attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`);
|
|
255
242
|
// Transition text opacity only (fade-in)
|
|
256
|
-
smartTransition(mergedTiles.select(`g.${labelGroup}
|
|
243
|
+
smartTransition(mergedTiles.select(`g.${labelGroup}`), duration)
|
|
257
244
|
.style('opacity', 1);
|
|
258
245
|
// Hide labels that don't meet criteria
|
|
259
246
|
mergedTiles.select(`text.${label}`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/treemap/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\nimport { hierarchy, HierarchyNode, treemap } from 'd3-hierarchy'\nimport { group, max, extent } from 'd3-array'\nimport { scaleLinear, scaleThreshold } from 'd3-scale'\nimport { hsl } from 'd3-color'\nimport { ComponentCore } from 'core/component'\nimport { SeriesDataModel } from 'data-models/series'\nimport { getColor, brighter, getHexValue } from 'utils/color'\nimport { getString, getNumber, isNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { trimSVGText } from 'utils/text'\nimport { TrimMode } from 'types/text'\nimport { TreemapConfigInterface, TreemapDefaultConfig } from './config'\nimport { TreemapDatum, TreemapNode } from './types'\nimport * as s from './style'\n\nexport class Treemap<Datum> extends ComponentCore<Datum[], TreemapConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = TreemapDefaultConfig as TreemapConfigInterface<Datum>\n public config: TreemapConfigInterface<Datum> = this._defaultConfig\n\n /** Default number format for tile labels. */\n private _defaultNumberFormat (value: number): string {\n return `${value}`\n }\n\n datamodel: SeriesDataModel<Datum> = new SeriesDataModel()\n tiles: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private _isTileLargeEnough (d: TreemapNode<Datum>): boolean {\n const w = d.x1 - d.x0\n const h = d.y1 - d.y0\n return (w >= this.config.minTileSizeForLabel) && (h >= this.config.minTileSizeForLabel)\n }\n\n private _getTileLightness (node: TreemapNode<Datum>, siblings: TreemapNode<Datum>[]): number {\n // Get the value extent of the sibling group\n const [minValue, maxValue] = extent(siblings, d => d.value)\n\n // If there's no range or no value, return default lightness\n if (minValue === maxValue || !node.value) return 0\n\n // Calculate relative position in the range (0 to 1)\n // Larger values will be closer to 0 (darker)\n return this.config.lightnessVariationAmount * ((maxValue - node.value) / (maxValue - minValue))\n }\n\n constructor (config?: TreemapConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n this.tiles = this.g.append('g').attr('class', s.tiles)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data }, _width, _height } = this\n const { numberFormat } = config\n const formatNumber = numberFormat ?? this._defaultNumberFormat.bind(this)\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n if (!config.layers?.length) {\n console.warn('Unovis | Treemap: No layers defined')\n return\n }\n\n // Map each layer accessor function to get string values from the data array\n const layerAccessors = config.layers.map(layerAccessor => {\n return (i: number) => getString(data[i], layerAccessor, i)\n })\n\n // Group the data indices by the layer accessors to create a hierarchical structure\n const nestedData = group(data.keys(), ...layerAccessors as [(d: number) => string])\n\n // Create the hierarchy from the grouped data,\n // which by itself is not quite right because there is an extra\n // level of nesting that we don't want, just above the leaf nodes.\n const rootNode = hierarchy(nestedData)\n\n // Compute the aggregation\n if (config.value) {\n rootNode.sum(index => typeof index === 'number' && getNumber(data[index], config.value, index))\n } else {\n rootNode.count()\n }\n\n // Fix the hierarchy by removing the extra level of nesting\n rootNode.each(node => {\n if (!node.children && node.parent) {\n node.parent.children = null\n }\n })\n\n const treemapLayout = treemap()\n .size([_width, _height])\n .round(true)\n .padding(config.tilePadding)\n\n // Apply padding to the top of each tile,\n // but not for the root node.\n if (this.config.tilePaddingTop !== undefined) {\n treemapLayout.paddingTop(d => d.parent ? config.tilePaddingTop : 0)\n }\n\n // Compute the treemap layout\n const treemapData = treemapLayout(rootNode) as TreemapNode<Datum>\n\n // Process the resulting hierarchy into the type we need\n let nodeId = 0\n treemapData.each(node => {\n const n = node as unknown as HierarchyNode<[string, number[]]>\n // Generate unique IDs for each node\n node._id = `node-${nodeId++}`\n\n const treemapDatum: TreemapDatum<Datum> = {\n key: n.data[0],\n }\n\n // Populate the index and datum for leaf nodes\n const isLeafNode = !n.children\n if (isLeafNode) {\n treemapDatum.index = n.data[1][0]\n treemapDatum.datum = data[treemapDatum.index]\n }\n\n node.data = treemapDatum\n })\n\n const descendants = treemapData.descendants()\n\n // Set up the brightness increase scale based on depth\n const maxDepth = max(descendants, d => d.depth)\n\n const brightnessIncrease = scaleLinear()\n .domain([1, maxDepth])\n .range([0, 1])\n\n // Get all leaf node values and calculate their square roots\n // (since area is proportional to value)\n const leafValues = descendants.filter(d => !d.children).map(d => d.value)\n const maxLeafValue = Math.sqrt(max(leafValues)) || 0\n // Divide the range into three equal intervals based on the square root of values\n // This accounts for the fact that area is proportional to value\n const fontSizeScale = scaleThreshold<number, number>()\n .domain([\n maxLeafValue / 3, // First third of the max value\n (maxLeafValue * 2) / 3, // Second third of the max value\n ])\n .range([\n config.tileLabelSmallFontSize,\n config.tileLabelMediumFontSize,\n config.tileLabelLargeFontSize,\n ])\n\n // First pass: Set base colors without considering tileColor config\n treemapData.eachBefore((node) => {\n // Get base color: user accessor or default\n let color = config.tileColor\n ? getColor(node, config.tileColor)\n : getColor(node, undefined, node.parent?.children?.indexOf(node), node.depth !== 1)\n\n // Fallback to parent color if needed\n color = color ?? (node.parent as TreemapNode<Datum>)?._fill\n\n const hexColor = color ? getHexValue(color, this.g.node()) : null\n\n if (hexColor) {\n const hslColor = hsl(hexColor)\n\n // Lightness adjustment for siblings (if enabled)\n if (config.enableLightnessVariance && !node.children && node.parent) {\n const siblings = node.parent.children\n const lightnessAdjustment = this._getTileLightness(node, siblings)\n hslColor.l = Math.min(1, hslColor.l + lightnessAdjustment)\n }\n\n // Brightness increase for depth\n node._fill = brighter(hslColor.toString(), brightnessIncrease(node.depth))\n } else {\n node._fill = null\n }\n })\n\n // Render tiles\n const visibleNodes = descendants.filter(d => d.depth > 0)\n const tiles = this.tiles\n .selectAll<SVGGElement, TreemapNode<Datum>>(`g.${s.tileGroup}`)\n .data(visibleNodes, d => `${d.data.key}-${d.depth}`)\n\n const tilesEnter = tiles\n .enter()\n .append('g')\n .attr('class', s.tileGroup)\n\n // Computes the rect border radius for a given tile.\n // The rx and ry values are the minimum of the tile\n // border radius and some fraction the width of the tile,\n // based on the tileBorderRadiusFactor config.\n // This ensures that the tile border radius is not\n // larger than the tile size, which makes small tiles\n // look better.\n const rx = (d: TreemapNode<Datum>): number =>\n Math.min(config.tileBorderRadius, (d.x1 - d.x0) * config.tileBorderRadiusFactor)\n\n // Tile rectangles\n tilesEnter\n .append('rect')\n .classed(s.tile, true)\n\n // Make the leaf tiles clickable if a click handler is provided\n .classed(s.clickableTile, d => config.showTileClickAffordance && !d.children)\n\n .attr('rx', rx)\n .attr('ry', rx)\n // Initialize tile positions so that the initial transition is smooth\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('height', d => d.y1 - d.y0)\n .style('fill', d => d._fill ?? getColor(d, config.tileColor))\n .style('opacity', 0)\n .style('cursor', config.showTileClickAffordance ? d => !d.children ? 'pointer' : null : null)\n\n\n const mergedTiles = tiles.merge(tilesEnter)\n\n smartTransition(mergedTiles.select(`rect.${s.tile}`), duration)\n .style('fill', d => d._fill ?? getColor(d, config.tileColor))\n .style('opacity', 1)\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('height', d => d.y1 - d.y0)\n\n // Update clipPath rects\n let svg: Element | null = this.g.node()\n while (svg && !(svg instanceof SVGSVGElement)) svg = svg.parentElement\n const defs = svg ? (select(svg).select('defs').empty() ? select(svg).append('defs') : select(svg).select('defs')) : null\n if (!defs) return\n const defsSelection = (defs as Selection<SVGDefsElement, unknown, null, undefined>)\n const clipPaths = defsSelection.selectAll<SVGClipPathElement, TreemapNode<Datum>>('clipPath')\n .data(visibleNodes, (d: TreemapNode<Datum>) => d._id)\n\n clipPaths.enter()\n .append('clipPath')\n .attr('id', (d: TreemapNode<Datum>) => `clip-${d._id}`)\n .append('rect')\n .attr('x', (d: TreemapNode<Datum>) => d.x0)\n .attr('y', (d: TreemapNode<Datum>) => d.y0)\n .attr('width', (d: TreemapNode<Datum>) => Math.max(0.1, d.x1 - d.x0))\n .attr('height', (d: TreemapNode<Datum>) => Math.max(0.1, d.y1 - d.y0))\n .attr('rx', rx)\n .attr('ry', rx)\n\n clipPaths.exit().remove()\n\n tilesEnter\n .append('g')\n .attr('class', s.labelGroup)\n .attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`)\n .append('text')\n .attr('class', s.label)\n .attr('x', 0)\n .attr('y', 0)\n .style('opacity', 0)\n\n const getTileLabel = config.tileLabel ?? ((d: TreemapNode<Datum>) => `${d.data.key}: ${formatNumber(d.value)}`)\n const textSelection = mergedTiles.selectAll<SVGTextElement, TreemapNode<Datum>>(`g.${s.labelGroup} text`)\n textSelection\n .text(d => getTileLabel(d))\n .style('font-size', function (d) {\n const sqrtVal = Math.sqrt(d.value ?? 0)\n return config.enableTileLabelFontSizeVariation && !d.children\n ? `${fontSizeScale(sqrtVal)}px`\n : `${fontSizeScale.range()[1]}px`\n })\n .attr('dominant-baseline', 'middle')\n\n // Trim label and set dominant-baseline for tspans in one pass\n textSelection.each((d, i, nodes) => {\n const text = select(nodes[i] as SVGTextElement)\n const tileWidth = d.x1 - d.x0 - (config.labelOffsetX ?? 0) * 2\n const fullLabel = text.text()\n let fontSize = parseFloat(text.style('font-size'))\n if (!fontSize) {\n fontSize = parseFloat(window.getComputedStyle(nodes[i] as SVGTextElement).fontSize)\n }\n trimSVGText(text, tileWidth, TrimMode.End, true, fontSize)\n text.attr('title', fullLabel)\n text.selectAll('tspan').attr('dominant-baseline', 'middle')\n })\n\n // Transition group position\n smartTransition(mergedTiles.select(`g.${s.labelGroup}`), duration)\n .attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`)\n\n // Transition text opacity only (fade-in)\n smartTransition(mergedTiles.select(`g.${s.labelGroup} text`), duration)\n .style('opacity', 1)\n\n // Hide labels that don't meet criteria\n mergedTiles.select(`text.${s.label}`)\n .style('display', d => {\n const isAllowedNode = config.labelInternalNodes ? true : !d.children\n return isAllowedNode && this._isTileLargeEnough(d) ? null : 'none'\n })\n // Make the internal labels semibold via class\n .attr('class', d => d.children ? `${s.label} ${s.internalLabel}` : s.label)\n\n smartTransition(tiles.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n}\n"],"names":["s.tiles","s.tileGroup","s.tile","s.clickableTile","s.labelGroup","s.label","s.internalLabel","s"],"mappings":";;;;;;;;;;;;;;;;AAgBM,MAAO,OAAe,SAAQ,aAAqD,CAAA;AA+BvF,IAAA,WAAA,CAAa,MAAsC,EAAA;AACjD,QAAA,KAAK,EAAE,CAAA;QA9BC,IAAc,CAAA,cAAA,GAAG,oBAAqD,CAAA;AACzE,QAAA,IAAA,CAAA,MAAM,GAAkC,IAAI,CAAC,cAAc,CAAA;AAOlE,QAAA,IAAA,CAAA,SAAS,GAA2B,IAAI,eAAe,EAAE,CAAA;AAuBvD,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAEA,KAAO,CAAC,CAAA;KACvD;;AA7BO,IAAA,oBAAoB,CAAE,KAAa,EAAA;QACzC,OAAO,CAAA,EAAG,KAAK,CAAA,CAAE,CAAA;KAClB;AAKO,IAAA,kBAAkB,CAAE,CAAqB,EAAA;QAC/C,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAA;QACrB,MAAM,CAAC,GAAG,CAAC,C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,CAAC,WAAW,EAAE,CAAC,IAAI,CAAA,UAAA,EAAa,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAI,CAAA,EAAA,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAG,CAAA,CAAA,CAAC,CAAA;;AAGnG,QAAA,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA,EAAA,EAAKA,UAAY,CAAA,KAAA,CAAO,CAAC,EAAE,QAAQ,CAAC;AACpE,aAAA,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;;QAGtB,WAAW,CAAC,MAAM,CAAC,CAAA,KAAA,EAAQC,KAAO,EAAE,CAAC;AAClC,aAAA,KAAK,CAAC,SAAS,EAAE,CAAC,IAAG;AACpB,YAAA,MAAM,aAAa,GAAG,MAAM,CAAC,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAA;AACpE,YAAA,OAAO,aAAa,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,CAAA;AACpE,SAAC,CAAC;;AAED,aAAA,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,CAAA,EAAGA,KAAO,CAAA,CAAA,EAAIC,aAAe,CAAA,CAAE,GAAGD,KAAO,CAAC,CAAA;AAE7E,QAAA,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC;AACpC,aAAA,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;AACnB,aAAA,MAAM,EAAE,CAAA;KACZ;;AAtSM,OAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/treemap/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\nimport { hierarchy, HierarchyNode, treemap } from 'd3-hierarchy'\nimport { group, max, extent } from 'd3-array'\nimport { scaleLinear, scaleThreshold } from 'd3-scale'\nimport { hsl } from 'd3-color'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Data Model\nimport { SeriesDataModel } from 'data-models/series'\n\n// Utils\nimport { getColor, brighter, getHexValue, isColorDark } from 'utils/color'\nimport { getString, getNumber, isNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { trimSVGText, wrapSVGText } from 'utils/text'\nimport { cssvar } from 'utils/style'\n\n// Types\nimport { FitMode } from 'types/text'\n\n// Config\nimport { TreemapConfigInterface, TreemapDefaultConfig } from './config'\n\n// Local Types\nimport { TreemapDatum, TreemapNode } from './types'\n\n// Styles\nimport * as s from './style'\n\nexport class Treemap<Datum> extends ComponentCore<Datum[], TreemapConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = TreemapDefaultConfig as TreemapConfigInterface<Datum>\n public config: TreemapConfigInterface<Datum> = this._defaultConfig\n\n datamodel: SeriesDataModel<Datum> = new SeriesDataModel()\n tiles: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private _isTileLargeEnough (d: TreemapNode<Datum>): boolean {\n const w = d.x1 - d.x0\n const h = d.y1 - d.y0\n return (w >= this.config.minTileSizeForLabel) && (h >= this.config.minTileSizeForLabel)\n }\n\n private _getTileLightness (node: TreemapNode<Datum>, siblings: TreemapNode<Datum>[]): number {\n // Get the value extent of the sibling group\n const [minValue, maxValue] = extent(siblings, d => d.value)\n\n // If there's no range or no value, return default lightness\n if (minValue === maxValue || !node.value) return 0\n\n // Calculate relative position in the range (0 to 1)\n // Larger values will be closer to 0 (darker)\n return this.config.lightnessVariationAmount * ((maxValue - node.value) / (maxValue - minValue))\n }\n\n constructor (config?: TreemapConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n this.tiles = this.g.append('g').attr('class', s.tiles)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data }, _width, _height } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n if (!config.layers?.length) {\n console.warn('Unovis | Treemap: No layers defined')\n return\n }\n\n // Map each layer accessor function to get string values from the data array\n const layerAccessors = config.layers.map(layerAccessor => {\n return (i: number) => getString(data[i], layerAccessor, i)\n })\n\n // Group the data indices by the layer accessors to create a hierarchical structure\n const nestedData = group(data.keys(), ...layerAccessors as [(d: number) => string])\n\n // Create the hierarchy from the grouped data,\n // which by itself is not quite right because there is an extra\n // level of nesting that we don't want, just above the leaf nodes.\n const rootNode = hierarchy(nestedData)\n\n // Compute the aggregation\n if (config.value) {\n rootNode.sum(index => isNumber(index) && getNumber(data[index], config.value, index))\n } else {\n rootNode.count()\n }\n\n // Fix the hierarchy by removing the extra level of nesting\n rootNode.each(node => {\n if (!node.children && node.parent) {\n node.parent.children = null\n }\n })\n\n const treemapLayout = treemap()\n .size([_width, _height])\n .round(true)\n .padding(config.tilePadding)\n\n // Apply padding to the top of each tile,\n // but not for the root node.\n if (this.config.tilePaddingTop !== undefined) {\n treemapLayout.paddingTop(d => d.parent ? config.tilePaddingTop : 0)\n }\n\n // Compute the treemap layout\n const treemapData = treemapLayout(rootNode) as TreemapNode<Datum>\n\n // Process the resulting hierarchy into the type we need\n let nodeId = 0\n treemapData.each(node => {\n const n = node as unknown as HierarchyNode<[string, number[]]>\n // Generate unique IDs for each node\n node._id = `node-${nodeId++}`\n\n const treemapDatum: TreemapDatum<Datum> = {\n key: n.data[0],\n }\n\n // Populate the index and datum for leaf nodes\n const isLeafNode = !n.children\n if (isLeafNode) {\n treemapDatum.index = n.data[1][0]\n treemapDatum.datum = data[treemapDatum.index]\n }\n\n node.data = treemapDatum\n })\n\n const descendants = treemapData.descendants()\n\n // Set up the brightness increase scale based on depth\n const maxDepth = max(descendants, d => d.depth)\n\n const brightnessIncrease = scaleLinear()\n .domain([1, maxDepth])\n .range([0, 1])\n\n // Get all leaf node values and calculate their square roots\n // (since area is proportional to value)\n const leafValues = descendants.filter(d => !d.children).map(d => d.value)\n const maxLeafValue = Math.sqrt(max(leafValues)) || 0\n // Divide the range into three equal intervals based on the square root of values\n // This accounts for the fact that area is proportional to value\n const fontSizeScale = scaleThreshold<number, number>()\n .domain([\n maxLeafValue / 3, // First third of the max value\n (maxLeafValue * 2) / 3, // Second third of the max value\n ])\n .range([\n config.tileLabelSmallFontSize,\n config.tileLabelMediumFontSize,\n config.tileLabelLargeFontSize,\n ])\n\n const visibleTiles = descendants.filter(d => d.depth > 0)\n const firstLevelTiles = visibleTiles.filter(d => d.depth === 1)\n const nonFirstLevelTiles = visibleTiles.filter(d => d.depth > 1)\n\n // Set the fill color for the first level tiles\n firstLevelTiles.forEach((d, i) => {\n d._fill = getColor(d, config.tileColor, i)\n })\n\n // Set the fill color for the non-first level tiles\n nonFirstLevelTiles.forEach((d, i) => {\n const providedColor = getColor(d, config.tileColor, i, true)\n if (providedColor) {\n d._fill = providedColor\n return\n }\n\n const hslColor = hsl(getHexValue(d.parent?._fill, this.element))\n\n if (config.enableLightnessVariance && !d.children && d.parent) {\n const siblings = d.parent.children\n const lightnessAdjustment = this._getTileLightness(d, siblings)\n hslColor.l = Math.min(1, hslColor.l + lightnessAdjustment)\n }\n\n d._fill = brighter(hslColor.toString(), brightnessIncrease(d.depth))\n })\n\n\n // Render tiles\n const tiles = this.tiles\n .selectAll<SVGGElement, TreemapNode<Datum>>(`g.${s.tileGroup}`)\n .data(visibleTiles, d => `${d.data.key}-${d.depth}`)\n\n const tilesEnter = tiles\n .enter()\n .append('g')\n .attr('class', s.tileGroup)\n\n // Computes the rect border radius for a given tile.\n // The rx and ry values are the minimum of the tile\n // border radius and some fraction the width of the tile,\n // based on the tileBorderRadiusFactor config.\n // This ensures that the tile border radius is not\n // larger than the tile size, which makes small tiles\n // look better.\n const getTileBorderRadius = (d: TreemapNode<Datum>): number =>\n Math.min(config.tileBorderRadius, (d.x1 - d.x0) * config.tileBorderRadiusFactor)\n\n // Add clipPath elements\n tilesEnter\n .append('clipPath')\n .attr('id', d => `clip-${this.uid}-${d._id}`)\n .append('rect')\n .attr('rx', getTileBorderRadius)\n .attr('ry', getTileBorderRadius)\n\n // Tile rectangles\n const tileRects = tilesEnter\n .append('rect')\n .classed(s.tile, true)\n .classed(s.clickableTile, d => config.showTileClickAffordance && !d.children)\n .attr('rx', getTileBorderRadius)\n .attr('ry', getTileBorderRadius)\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('height', d => d.y1 - d.y0)\n .style('fill', d => d._fill)\n .style('opacity', 0)\n .style('cursor', config.showTileClickAffordance ? d => !d.children ? 'pointer' : null : null)\n\n tileRects.append('title')\n\n tilesEnter\n .append('g')\n .attr('class', s.labelGroup)\n .attr('clip-path', d => `url(#clip-${this.uid}-${d._id})`)\n .attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`)\n .style('opacity', 0)\n .append('text')\n .attr('class', s.label)\n .attr('x', 0)\n .attr('y', 0)\n\n const mergedTiles = tiles.merge(tilesEnter)\n const tileRectsMerged = mergedTiles.select(`rect.${s.tile}`)\n smartTransition(tileRectsMerged, duration)\n .style('fill', d => d._fill)\n .style('opacity', 1)\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('height', d => d.y1 - d.y0)\n\n tileRectsMerged.select('title')\n .text(d => config.tileLabel(d))\n\n // Update clipPath rects\n mergedTiles.select('clipPath rect')\n .attr('width', d => d.x1 - d.x0 - 2 * config.labelOffsetX)\n .attr('height', d => d.y1 - d.y0 - 2 * config.labelOffsetY)\n\n const textSelection = mergedTiles.selectAll<SVGTextElement, TreemapNode<Datum>>(`g.${s.labelGroup} text`)\n textSelection\n .text(d => config.tileLabel(d))\n .attr('title', d => config.tileLabel(d))\n .property('font-size-px', d => {\n const sqrtVal = Math.sqrt(d.value ?? 0)\n return config.enableTileLabelFontSizeVariation && !d.children\n ? fontSizeScale(sqrtVal)\n : null // Use the default css variable value\n })\n .style('font-size', (_, i, els) => `${select(els[i]).property('font-size-px')}px`)\n .style('fill', d => cssvar(\n isColorDark(d._fill) ? s.variables.treemapLabelTextColorLight : s.variables.treemapLabelTextColor)\n )\n\n // Fit label (wrap or trim)\n textSelection.each((d, i, els) => {\n const isLeafNode = !d.children\n const el = els[i] as SVGTextElement\n const text = select(el)\n const tileWidth = d.x1 - d.x0 - (config.labelOffsetX ?? 0) * 2\n const fontSize = parseFloat(text.property('font-size-px')) || parseFloat(window.getComputedStyle(el).fontSize)\n\n if (config.labelFit === FitMode.Wrap && isLeafNode) {\n wrapSVGText(text, tileWidth)\n } else {\n trimSVGText(text, tileWidth, config.labelTrimMode, true, fontSize)\n }\n })\n\n // Transition group position\n smartTransition(mergedTiles.select(`g.${s.labelGroup}`), duration)\n .attr('transform', d => `translate(${d.x0 + config.labelOffsetX},${d.y0 + config.labelOffsetY})`)\n\n // Transition text opacity only (fade-in)\n smartTransition(mergedTiles.select(`g.${s.labelGroup}`), duration)\n .style('opacity', 1)\n\n // Hide labels that don't meet criteria\n mergedTiles.select(`text.${s.label}`)\n .style('display', d => {\n const isAllowedNode = config.labelInternalNodes ? true : !d.children\n return isAllowedNode && this._isTileLargeEnough(d) ? null : 'none'\n })\n // Make the internal labels semibold via class\n .attr('class', d => d.children ? `${s.label} ${s.internalLabel}` : s.label)\n\n smartTransition(tiles.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n}\n"],"names":["s.tiles","s.tileGroup","s.tile","s.clickableTile","s.labelGroup","s.label","s.variables","s.internalLabel","s"],"mappings":";;;;;;;;;;;;;;;;;AA+BM,MAAO,OAAe,SAAQ,aAAqD,CAAA;AA0BvF,IAAA,WAAA,CAAa,MAAsC,EAAA;AACjD,QAAA,KAAK,EAAE,CAAA;QAzBC,IAAc,CAAA,cAAA,GAAG,oBAAqD,CAAA;AACzE,QAAA,IAAA,CAAA,MAAM,GAAkC,IAAI,CAAC,cAAc,CAAA;AAElE,QAAA,IAAA,CAAA,SAAS,GAA2B,IAAI,eAAe,EAAE,CAAA;AAuBvD,QAAA,IAAI,MAAM;AAAE,YAAA,I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IE,aAAe,CAAA,CAAE,GAAGF,KAAO,CAAC,CAAA;AAE7E,QAAA,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC;AACpC,aAAA,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;AACnB,aAAA,MAAM,EAAE,CAAA;KACZ;;AA1RM,OAAS,CAAA,SAAA,GAAGG,KAAC;;;;"}
|
|
@@ -4,16 +4,11 @@ export declare const variables: {
|
|
|
4
4
|
treemapTileStrokeWidth: "--vis-treemap-tile-stroke-width";
|
|
5
5
|
treemapTileHoverStrokeColor: "--vis-treemap-tile-hover-stroke-color";
|
|
6
6
|
treemapTileHoverStrokeOpacity: "--vis-treemap-tile-hover-stroke-opacity";
|
|
7
|
-
treemapTileFillColor: "--vis-treemap-tile-fill-color";
|
|
8
|
-
treemapTileBackgroundColor: "--vis-treemap-tile-background-color";
|
|
9
|
-
treemapTileCursor: "--vis-treemap-tile-cursor";
|
|
10
|
-
treemapLabelTextColor: "--vis-treemap-label-text-color";
|
|
11
|
-
treemapLabelFontSize: "--vis-treemap-label-font-size";
|
|
12
7
|
treemapLabelOpacity: "--vis-treemap-label-opacity";
|
|
13
8
|
treemapLabelFontWeight: "--vis-treemap-label-font-weight";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
treemapLabelTextColor: "--vis-treemap-label-text-color";
|
|
10
|
+
treemapLabelTextColorLight: "--vis-treemap-label-text-color-light";
|
|
11
|
+
treemapLabelFontSize: "--vis-treemap-label-font-size";
|
|
17
12
|
};
|
|
18
13
|
export declare const tiles: string;
|
|
19
14
|
export declare const tileGroup: string;
|