@syncfusion/ej2-treemap 27.2.2 → 28.1.39
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/README.md +2 -2
- package/dist/ej2-treemap.min.js +3 -3
- package/dist/ej2-treemap.umd.min.js +3 -3
- package/dist/ej2-treemap.umd.min.js.map +1 -1
- package/dist/es6/ej2-treemap.es2015.js +427 -86
- package/dist/es6/ej2-treemap.es2015.js.map +1 -1
- package/dist/es6/ej2-treemap.es5.js +427 -86
- package/dist/es6/ej2-treemap.es5.js.map +1 -1
- package/dist/global/ej2-treemap.min.js +3 -3
- package/dist/global/ej2-treemap.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +12 -12
- package/src/treemap/layout/legend.js +53 -18
- package/src/treemap/layout/render-panel.js +12 -3
- package/src/treemap/model/image-export.js +2 -2
- package/src/treemap/model/pdf-export.js +2 -2
- package/src/treemap/model/print.js +2 -2
- package/src/treemap/model/theme.js +50 -2
- package/src/treemap/treemap-model.d.ts +8 -1
- package/src/treemap/treemap.d.ts +6 -0
- package/src/treemap/treemap.js +13 -6
- package/src/treemap/user-interaction/highlight-selection.js +225 -38
- package/src/treemap/user-interaction/tooltip.js +6 -1
- package/src/treemap/utils/enum.d.ts +4 -0
- package/src/treemap/utils/helper.d.ts +2 -1
- package/src/treemap/utils/helper.js +69 -19
|
@@ -1082,10 +1082,12 @@ function colorMap(colorMapping, equalValue, value) {
|
|
|
1082
1082
|
for (let i = 0; i < colorMapping.length; i++) {
|
|
1083
1083
|
let isEqualColor = false;
|
|
1084
1084
|
const dataValue = value;
|
|
1085
|
+
const colorMappingValue = colorMapping[i].value ? colorMapping[i].value.toString() :
|
|
1086
|
+
colorMapping[i].value;
|
|
1085
1087
|
if (!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to)
|
|
1086
1088
|
&& !isNullOrUndefined(colorMapping[i].value)) {
|
|
1087
1089
|
if ((value >= colorMapping[i].from && colorMapping[i].to >= value) &&
|
|
1088
|
-
(
|
|
1090
|
+
(colorMappingValue === equalValue)) {
|
|
1089
1091
|
isEqualColor = true;
|
|
1090
1092
|
if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
|
|
1091
1093
|
fill = !isEqualColor ? colorCollections(colorMapping[i], dataValue) : colorMapping[i].color[0];
|
|
@@ -1098,8 +1100,8 @@ function colorMap(colorMapping, equalValue, value) {
|
|
|
1098
1100
|
else if ((!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to))
|
|
1099
1101
|
|| !isNullOrUndefined((colorMapping[i].value))) {
|
|
1100
1102
|
if ((value >= colorMapping[i].from && colorMapping[i].to >= value)
|
|
1101
|
-
|| (
|
|
1102
|
-
if (
|
|
1103
|
+
|| (colorMappingValue === equalValue)) {
|
|
1104
|
+
if (colorMappingValue === equalValue) {
|
|
1103
1105
|
isEqualColor = true;
|
|
1104
1106
|
}
|
|
1105
1107
|
if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
|
|
@@ -1111,7 +1113,7 @@ function colorMap(colorMapping, equalValue, value) {
|
|
|
1111
1113
|
}
|
|
1112
1114
|
}
|
|
1113
1115
|
if (((value >= colorMapping[i].from && value <= colorMapping[i].to)
|
|
1114
|
-
|| (
|
|
1116
|
+
|| (colorMappingValue === equalValue))
|
|
1115
1117
|
&& !isNullOrUndefined(colorMapping[i].minOpacity) && !isNullOrUndefined(colorMapping[i].maxOpacity)
|
|
1116
1118
|
&& fill) {
|
|
1117
1119
|
opacity = deSaturationColor(colorMapping[i], value);
|
|
@@ -1386,7 +1388,8 @@ function maintainSelection(treemap, element, className) {
|
|
|
1386
1388
|
const elementId = treemap.levelSelection;
|
|
1387
1389
|
if (elementId) {
|
|
1388
1390
|
for (let index = 0; index < elementId.length; index++) {
|
|
1389
|
-
if (element.getAttribute('id') === elementId[index]
|
|
1391
|
+
if (element.getAttribute('id') === elementId[index] ||
|
|
1392
|
+
element.children[0].id === elementId[index]) {
|
|
1390
1393
|
if (element.childElementCount > 0) {
|
|
1391
1394
|
element.children[0].setAttribute('class', className);
|
|
1392
1395
|
applyOptions(element.childNodes[0], {
|
|
@@ -1411,13 +1414,25 @@ function legendMaintain(treemap, legendGroup) {
|
|
|
1411
1414
|
const elementId = treemap.legendId;
|
|
1412
1415
|
if (elementId) {
|
|
1413
1416
|
for (let i = 0; i < elementId.length; i++) {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1417
|
+
if (treemap.legendSettings.mode === 'Interactive') {
|
|
1418
|
+
for (let j = 0; j < legendGroup.childElementCount; j++) {
|
|
1419
|
+
if (legendGroup.childNodes[j]['id'] === elementId[i] ||
|
|
1420
|
+
parseFloat(legendGroup.childNodes[j]['id'].split('Index_')[1]) === parseFloat(elementId[i].split('Index_')[1])) {
|
|
1421
|
+
const treemapSVGRectElement = legendGroup.childNodes[j];
|
|
1422
|
+
treemapSVGRectElement.setAttribute('fill', treemap.selectionSettings.fill);
|
|
1423
|
+
treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
|
|
1424
|
+
treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
|
|
1425
|
+
treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
const legendItem = document.getElementById(elementId[i]);
|
|
1431
|
+
if (!isNullOrUndefined(legendItem)) {
|
|
1432
|
+
legendItem.setAttribute('fill', treemap.selectionSettings.fill);
|
|
1433
|
+
legendItem.setAttribute('stroke', treemap.selectionSettings.border.color);
|
|
1434
|
+
legendItem.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
|
|
1435
|
+
legendItem.setAttribute('opacity', treemap.selectionSettings.opacity);
|
|
1421
1436
|
}
|
|
1422
1437
|
}
|
|
1423
1438
|
}
|
|
@@ -1453,6 +1468,9 @@ function applyOptions(element, options) {
|
|
|
1453
1468
|
if (!isNullOrUndefined(options['fill'])) {
|
|
1454
1469
|
element.setAttribute('fill', options['fill']);
|
|
1455
1470
|
}
|
|
1471
|
+
else {
|
|
1472
|
+
element.setAttribute('fill', 'black');
|
|
1473
|
+
}
|
|
1456
1474
|
element.setAttribute('stroke', options['border']['color']);
|
|
1457
1475
|
element.setAttribute('stroke-width', options['border']['width']);
|
|
1458
1476
|
}
|
|
@@ -1699,17 +1717,35 @@ function removeShape(collection) {
|
|
|
1699
1717
|
/**
|
|
1700
1718
|
*
|
|
1701
1719
|
* @param {any[]} collection - Specifies the legend collection.
|
|
1720
|
+
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
1702
1721
|
* @returns {void}
|
|
1703
1722
|
* @private
|
|
1704
1723
|
*/
|
|
1705
|
-
function removeLegend(collection) {
|
|
1724
|
+
function removeLegend(collection, treeMap) {
|
|
1706
1725
|
if (collection.length > 0) {
|
|
1707
1726
|
for (let j = 0; j < collection.length; j++) {
|
|
1708
1727
|
const item = collection[j];
|
|
1709
|
-
|
|
1710
|
-
const
|
|
1728
|
+
const legendIndex = parseFloat(item['legendEle'].id.split('_Index_')[1]);
|
|
1729
|
+
const isText = item['legendEle'].id.indexOf('Text') > -1;
|
|
1730
|
+
const shapeId = isText ? item['legendEle'].id.replace('_Text', '') : item['legendEle'].id;
|
|
1731
|
+
const legendShape = treeMap.legendSettings.mode === 'Interactive'
|
|
1732
|
+
? document.getElementById(shapeId)
|
|
1733
|
+
: document.getElementById(treeMap.element.id + '_Legend_Shape_Index_' + legendIndex);
|
|
1734
|
+
const legendText = treeMap.legendSettings.mode === 'Interactive'
|
|
1735
|
+
? document.getElementById(shapeId + '_Text')
|
|
1736
|
+
: document.getElementById(treeMap.element.id + '_Legend_Text_Index_' + legendIndex);
|
|
1737
|
+
if (!isNullOrUndefined(legendShape)) {
|
|
1738
|
+
setColor(legendShape, item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
|
|
1739
|
+
}
|
|
1740
|
+
if (!isNullOrUndefined(legendText)) {
|
|
1741
|
+
setColor(legendText, treeMap.legendSettings.textStyle.color, item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
|
|
1742
|
+
}
|
|
1743
|
+
const dataCount = !isNullOrUndefined(item['ShapeCollection']) ? item['ShapeCollection']['Elements'].length : 0;
|
|
1711
1744
|
for (let k = 0; k < dataCount; k++) {
|
|
1712
|
-
|
|
1745
|
+
const shapeElement = document.getElementById(item['ShapeCollection']['Elements'][k].id);
|
|
1746
|
+
if (!isNullOrUndefined(shapeElement)) {
|
|
1747
|
+
setColor(shapeElement, item['shapeOldFill'], item['shapeOldOpacity'], item['shapeOldBorderColor'], item['shapeOldBorderWidth']);
|
|
1748
|
+
}
|
|
1713
1749
|
}
|
|
1714
1750
|
}
|
|
1715
1751
|
}
|
|
@@ -1737,7 +1773,7 @@ function setColor(element, fill, opacity, borderColor, borderWidth) {
|
|
|
1737
1773
|
* @returns {void}
|
|
1738
1774
|
*/
|
|
1739
1775
|
function removeSelectionWithHighlight(collection, element, treemap) {
|
|
1740
|
-
|
|
1776
|
+
removeLegend(collection, treemap);
|
|
1741
1777
|
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
|
|
1742
1778
|
}
|
|
1743
1779
|
/**
|
|
@@ -1749,10 +1785,24 @@ function removeSelectionWithHighlight(collection, element, treemap) {
|
|
|
1749
1785
|
*/
|
|
1750
1786
|
function getLegendIndex(length, item, treemap) {
|
|
1751
1787
|
let index;
|
|
1788
|
+
const valuePath = treemap.rangeColorValuePath;
|
|
1752
1789
|
for (let i = 0; i < length; i++) {
|
|
1753
1790
|
const dataLength = treemap.treeMapLegendModule.legendCollections[i]['legendData'].length;
|
|
1754
|
-
|
|
1755
|
-
|
|
1791
|
+
if (dataLength > 0) {
|
|
1792
|
+
for (let j = 0; j < dataLength; j++) {
|
|
1793
|
+
if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0 ?
|
|
1794
|
+
(treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['data'][valuePath] === item['data'][valuePath])
|
|
1795
|
+
: treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['levelOrderName'] === item['levelOrderName']
|
|
1796
|
+
|| item['levelOrderName'].indexOf(treemap.treeMapLegendModule.legendCollections[i]['legendName']) > -1)) {
|
|
1797
|
+
index = i;
|
|
1798
|
+
break;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
else if (treemap.palette && treemap.palette.length > 0) {
|
|
1803
|
+
if ((treemap.treeMapLegendModule.legendCollections[i]['levelOrderName'] === item['levelOrderName'] ||
|
|
1804
|
+
(item['levelOrderName'].indexOf(treemap.treeMapLegendModule.legendCollections[i]['levelOrderName'])) > -1)
|
|
1805
|
+
&& treemap.treeMapLegendModule.legendCollections[i]['legendName'] === item['name']) {
|
|
1756
1806
|
index = i;
|
|
1757
1807
|
break;
|
|
1758
1808
|
}
|
|
@@ -2283,7 +2333,8 @@ class LayoutPanel {
|
|
|
2283
2333
|
groupId = elementID + '_Level_Index_' + index + '_Item_Index_' + i;
|
|
2284
2334
|
itemGroup = this.renderer.createGroup({ id: groupId + '_Group' });
|
|
2285
2335
|
gap = (isLeafItem ? leaf.gap : levels[index].groupGap) / 2;
|
|
2286
|
-
const treemapItemRect = this.treemap.totalRect ?
|
|
2336
|
+
const treemapItemRect = this.treemap.totalRect ? (treeMap.legendSettings.visible ? this.treemap.totalRect
|
|
2337
|
+
: convertToContainer(this.treemap.totalRect)) : this.treemap.areaRect;
|
|
2287
2338
|
if (treeMap.layoutType === 'Squarified') {
|
|
2288
2339
|
rect.width = Math.abs(rect.x - rect.width) - gap;
|
|
2289
2340
|
rect.height = Math.abs(rect.y - rect.height) - gap;
|
|
@@ -2326,6 +2377,9 @@ class LayoutPanel {
|
|
|
2326
2377
|
renderText = !isLeafItem && childItems && childItems.length > 0 && this.treemap.enableDrillDown ?
|
|
2327
2378
|
!item['isDrilled'] ? treeMap.enableRtl ? renderText + ' [+]' : '[+] ' + renderText :
|
|
2328
2379
|
treeMap.enableRtl ? renderText + ' [-]' : '[-] ' + renderText : renderText;
|
|
2380
|
+
if (treeMap.enableHtmlSanitizer) {
|
|
2381
|
+
renderText = SanitizeHtmlHelper.sanitize(renderText);
|
|
2382
|
+
}
|
|
2329
2383
|
let fontFamily = (isLeafItem ? leaf.labelStyle.fontFamily : levels[index].headerStyle.fontFamily);
|
|
2330
2384
|
fontFamily = fontFamily || this.treemap.themeStyle.labelFontFamily;
|
|
2331
2385
|
let size = (isLeafItem ? leaf.labelStyle.size : levels[index].headerStyle.size);
|
|
@@ -2390,6 +2444,7 @@ class LayoutPanel {
|
|
|
2390
2444
|
secondaryEle.appendChild(templateGroup);
|
|
2391
2445
|
}
|
|
2392
2446
|
this.treemap.svgObject.appendChild(this.layoutGroup);
|
|
2447
|
+
maintainSelection(this.treemap, this.layoutGroup, 'treeMapSelection');
|
|
2393
2448
|
}
|
|
2394
2449
|
renderItemText(text, parentElement, textStyle, rect, interSectAction, groupId, fill, position, connectorText) {
|
|
2395
2450
|
const padding = 5;
|
|
@@ -2479,7 +2534,8 @@ class LayoutPanel {
|
|
|
2479
2534
|
for (let i = 0; i < parentData.length; i++) {
|
|
2480
2535
|
if (parentData[i]['levelOrderName'] === item['levelOrderName'].split('#')[0]) {
|
|
2481
2536
|
itemFill = !isNullOrUndefined(itemFill) ? itemFill : !isNullOrUndefined(treemap.colorValuePath) ?
|
|
2482
|
-
parentData[i]['data'][treemap.colorValuePath] :
|
|
2537
|
+
parentData[i]['data'][treemap.colorValuePath] : !isNullOrUndefined(item['options']) ?
|
|
2538
|
+
item['options'].fill : (!isNullOrUndefined(treemap.palette) && treemap.palette.length > 0) ?
|
|
2483
2539
|
treemap.palette[i % treemap.palette.length] : '#808080';
|
|
2484
2540
|
}
|
|
2485
2541
|
}
|
|
@@ -2512,6 +2568,9 @@ class LayoutPanel {
|
|
|
2512
2568
|
template = template.replace(new regExp('{{:' + keys[i] + '}}', 'g'), item['data'][keys[i].toString()]);
|
|
2513
2569
|
}
|
|
2514
2570
|
}
|
|
2571
|
+
if (this.treemap.enableHtmlSanitizer && typeof template === 'string') {
|
|
2572
|
+
template = SanitizeHtmlHelper.sanitize(template);
|
|
2573
|
+
}
|
|
2515
2574
|
let labelElement;
|
|
2516
2575
|
if (!isNullOrUndefined(document.getElementById(this.treemap.element.id + '_Secondary_Element'))) {
|
|
2517
2576
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2637,9 +2696,9 @@ function getThemeStyle(theme) {
|
|
|
2637
2696
|
fontWeight: 'Normal',
|
|
2638
2697
|
subtitleFontSize: '14px',
|
|
2639
2698
|
legendFontSize: '13px',
|
|
2699
|
+
labelFontFamily: defaultFont,
|
|
2640
2700
|
fontFamily: 'Roboto, Noto, Sans-serif',
|
|
2641
2701
|
labelFontSize: '12px',
|
|
2642
|
-
labelFontFamily: defaultFont,
|
|
2643
2702
|
legendBorderColor: '#000000',
|
|
2644
2703
|
legendBorderWidth: 0
|
|
2645
2704
|
};
|
|
@@ -2716,6 +2775,54 @@ function getThemeStyle(theme) {
|
|
|
2716
2775
|
legendBorderWidth: 0
|
|
2717
2776
|
};
|
|
2718
2777
|
break;
|
|
2778
|
+
case 'tailwind3':
|
|
2779
|
+
style = {
|
|
2780
|
+
backgroundColor: 'transparent',
|
|
2781
|
+
titleFontColor: '#111827',
|
|
2782
|
+
titleFontWeight: '600',
|
|
2783
|
+
subTitleFontColor: '#111827',
|
|
2784
|
+
tooltipFillColor: '#111827',
|
|
2785
|
+
tooltipFontColor: '#F9FAFB',
|
|
2786
|
+
tooltipFontSize: '12px',
|
|
2787
|
+
tooltipFillOpacity: 1,
|
|
2788
|
+
tooltipTextOpacity: 1,
|
|
2789
|
+
legendTitleColor: '#111827',
|
|
2790
|
+
legendTextColor: '#111827',
|
|
2791
|
+
fontFamily: 'Inter',
|
|
2792
|
+
fontSize: '14px',
|
|
2793
|
+
fontWeight: '400',
|
|
2794
|
+
subtitleFontSize: '12px',
|
|
2795
|
+
legendFontSize: '12px',
|
|
2796
|
+
labelFontFamily: 'Inter',
|
|
2797
|
+
labelFontSize: '12px',
|
|
2798
|
+
legendBorderColor: '#000000',
|
|
2799
|
+
legendBorderWidth: 0
|
|
2800
|
+
};
|
|
2801
|
+
break;
|
|
2802
|
+
case 'tailwind3dark':
|
|
2803
|
+
style = {
|
|
2804
|
+
backgroundColor: 'transparent',
|
|
2805
|
+
titleFontColor: '#FFFFFF',
|
|
2806
|
+
titleFontWeight: '600',
|
|
2807
|
+
subTitleFontColor: '#FFFFFF',
|
|
2808
|
+
tooltipFillColor: '#F9FAFB',
|
|
2809
|
+
tooltipFontColor: '#1F2937',
|
|
2810
|
+
tooltipFontSize: '12px',
|
|
2811
|
+
tooltipFillOpacity: 1,
|
|
2812
|
+
tooltipTextOpacity: 1,
|
|
2813
|
+
legendTitleColor: '#FFFFFF',
|
|
2814
|
+
legendTextColor: '#FFFFFF',
|
|
2815
|
+
fontFamily: 'Inter',
|
|
2816
|
+
fontWeight: '400',
|
|
2817
|
+
fontSize: '14px',
|
|
2818
|
+
subtitleFontSize: '12px',
|
|
2819
|
+
legendFontSize: '12px',
|
|
2820
|
+
labelFontFamily: 'Inter',
|
|
2821
|
+
labelFontSize: '12px',
|
|
2822
|
+
legendBorderColor: '#000000',
|
|
2823
|
+
legendBorderWidth: 0
|
|
2824
|
+
};
|
|
2825
|
+
break;
|
|
2719
2826
|
case 'bootstrap5':
|
|
2720
2827
|
style = {
|
|
2721
2828
|
backgroundColor: 'transparent',
|
|
@@ -2947,9 +3054,9 @@ function getThemeStyle(theme) {
|
|
|
2947
3054
|
fontWeight: 'Normal',
|
|
2948
3055
|
subtitleFontSize: '14px',
|
|
2949
3056
|
legendFontSize: '13px',
|
|
2950
|
-
labelFontFamily: defaultFont,
|
|
2951
3057
|
fontFamily: 'Roboto, Noto, Sans-serif',
|
|
2952
3058
|
labelFontSize: '12px',
|
|
3059
|
+
labelFontFamily: defaultFont,
|
|
2953
3060
|
legendBorderColor: '#000000',
|
|
2954
3061
|
legendBorderWidth: 0
|
|
2955
3062
|
};
|
|
@@ -3024,12 +3131,12 @@ class Print {
|
|
|
3024
3131
|
backgroundElement = backgroundElement.childNodes[0];
|
|
3025
3132
|
if (!isNullOrUndefined(backgroundElement)) {
|
|
3026
3133
|
const backgroundColor = backgroundElement.getAttribute('fill');
|
|
3027
|
-
if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
|
|
3134
|
+
if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Tailwind3' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
|
|
3028
3135
|
treeMap.theme === 'Fluent2')
|
|
3029
3136
|
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
3030
3137
|
backgroundElement.setAttribute('fill', 'rgba(255,255,255, 1)');
|
|
3031
3138
|
}
|
|
3032
|
-
else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
|
|
3139
|
+
else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Tailwind3Dark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
|
|
3033
3140
|
treeMap.theme === 'Fluent2Dark' || treeMap.theme === 'Fluent2HighContrast')
|
|
3034
3141
|
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
3035
3142
|
backgroundElement.setAttribute('fill', 'rgba(0, 0, 0, 1)');
|
|
@@ -3097,12 +3204,12 @@ class ImageExport {
|
|
|
3097
3204
|
const backgroundElement = exportElement.childNodes[0];
|
|
3098
3205
|
if (!isNullOrUndefined(backgroundElement)) {
|
|
3099
3206
|
const backgroundColor = backgroundElement.getAttribute('fill');
|
|
3100
|
-
if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
|
|
3207
|
+
if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Tailwind3' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
|
|
3101
3208
|
treeMap.theme === 'Fluent2')
|
|
3102
3209
|
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
3103
3210
|
exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
|
|
3104
3211
|
}
|
|
3105
|
-
else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
|
|
3212
|
+
else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Tailwind3Dark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
|
|
3106
3213
|
treeMap.theme === 'Fluent2Dark' || treeMap.theme === 'Fluent2HighContrast')
|
|
3107
3214
|
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
3108
3215
|
exportElement.childNodes[0].setAttribute('fill', 'rgba(0, 0, 0, 1)');
|
|
@@ -3199,12 +3306,12 @@ class PdfExport {
|
|
|
3199
3306
|
const backgroundElement = exportElement.childNodes[0];
|
|
3200
3307
|
if (!isNullOrUndefined(backgroundElement)) {
|
|
3201
3308
|
const backgroundColor = backgroundElement.getAttribute('fill');
|
|
3202
|
-
if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
|
|
3309
|
+
if ((treeMap.theme === 'Tailwind' || treeMap.theme === 'Tailwind3' || treeMap.theme === 'Bootstrap5' || treeMap.theme === 'Fluent' || treeMap.theme === 'Material3' ||
|
|
3203
3310
|
treeMap.theme === 'Fluent2')
|
|
3204
3311
|
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
3205
3312
|
exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
|
|
3206
3313
|
}
|
|
3207
|
-
else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
|
|
3314
|
+
else if ((treeMap.theme === 'TailwindDark' || treeMap.theme === 'Tailwind3Dark' || treeMap.theme === 'Bootstrap5Dark' || treeMap.theme === 'FluentDark' || treeMap.theme === 'Material3Dark' ||
|
|
3208
3315
|
treeMap.theme === 'Fluent2Dark' || treeMap.theme === 'Fluent2HighContrast')
|
|
3209
3316
|
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
3210
3317
|
exportElement.childNodes[0].setAttribute('fill', 'rgba(0, 0, 0, 1)');
|
|
@@ -3368,6 +3475,9 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3368
3475
|
}
|
|
3369
3476
|
this.layout.processLayoutPanel();
|
|
3370
3477
|
this.element.appendChild(this.svgObject);
|
|
3478
|
+
if (!isNullOrUndefined(this.treeMapLegendModule) && this.legendSettings.visible) {
|
|
3479
|
+
legendMaintain(this, this.treeMapLegendModule.legendGroup);
|
|
3480
|
+
}
|
|
3371
3481
|
this.elementChange();
|
|
3372
3482
|
this.trigger(loaded, { treemap: this, isResized: this.isResize });
|
|
3373
3483
|
this.isResize = false;
|
|
@@ -3463,14 +3573,15 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3463
3573
|
if (isNullOrUndefined(groupEle)) {
|
|
3464
3574
|
groupEle = this.renderer.createGroup({ id: this.element.id + '_Title_Group' });
|
|
3465
3575
|
}
|
|
3466
|
-
const
|
|
3576
|
+
const titleText = this.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(title.text)) : title.text;
|
|
3577
|
+
const trimmedTitle = textTrim(width, titleText, style);
|
|
3467
3578
|
const elementSize = measureText(trimmedTitle, style);
|
|
3468
3579
|
const rect = (isNullOrUndefined(bounds)) ? new Rect(this.margin.left, this.margin.top, this.availableSize.width, this.availableSize.height) : bounds;
|
|
3469
3580
|
const location = findPosition(rect, title.alignment, elementSize, type);
|
|
3470
3581
|
const options = new TextOption(this.element.id + '_TreeMap_' + type, location.x, location.y, 'start', trimmedTitle);
|
|
3471
3582
|
const titleBounds = new Rect(location.x, location.y, elementSize.width, elementSize.height);
|
|
3472
3583
|
const element = renderTextElement(options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor), groupEle);
|
|
3473
|
-
element.setAttribute('aria-label', title.description ||
|
|
3584
|
+
element.setAttribute('aria-label', title.description || titleText);
|
|
3474
3585
|
element.setAttribute('role', 'region');
|
|
3475
3586
|
element.setAttribute('tabindex', this.tabIndex.toString());
|
|
3476
3587
|
if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
|
|
@@ -4246,7 +4357,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
4246
4357
|
}
|
|
4247
4358
|
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
|
|
4248
4359
|
if (this.treeMapHighlightModule) {
|
|
4249
|
-
|
|
4360
|
+
removeLegend(this.treeMapHighlightModule.shapeHighlightCollection, this);
|
|
4250
4361
|
this.treeMapHighlightModule.highLightId = '';
|
|
4251
4362
|
}
|
|
4252
4363
|
}
|
|
@@ -4494,6 +4605,9 @@ __decorate$1([
|
|
|
4494
4605
|
__decorate$1([
|
|
4495
4606
|
Property(false)
|
|
4496
4607
|
], TreeMap.prototype, "drillDownView", void 0);
|
|
4608
|
+
__decorate$1([
|
|
4609
|
+
Property(false)
|
|
4610
|
+
], TreeMap.prototype, "enableHtmlSanitizer", void 0);
|
|
4497
4611
|
__decorate$1([
|
|
4498
4612
|
Complex({}, InitialDrillSettings)
|
|
4499
4613
|
], TreeMap.prototype, "initialDrillDown", void 0);
|
|
@@ -4663,7 +4777,7 @@ class TreeMapLegend {
|
|
|
4663
4777
|
const defaultSize = 25;
|
|
4664
4778
|
const textPadding = 10;
|
|
4665
4779
|
const position = legend.position;
|
|
4666
|
-
const legendTitle = legend.title.text;
|
|
4780
|
+
const legendTitle = treemap.enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(legend.title.text) : legend.title.text;
|
|
4667
4781
|
const titleTextStyle = legend.titleStyle;
|
|
4668
4782
|
const legendMode = legend.mode;
|
|
4669
4783
|
let shapeX = 0;
|
|
@@ -4705,7 +4819,8 @@ class TreeMapLegend {
|
|
|
4705
4819
|
if (isNullOrUndefined(this.totalPages[this.page])) {
|
|
4706
4820
|
this.totalPages[this.page] = { Page: (this.page + 1), Collection: [] };
|
|
4707
4821
|
}
|
|
4708
|
-
const legendTextSize = measureText(
|
|
4822
|
+
const legendTextSize = measureText(treemap.enableHtmlSanitizer ?
|
|
4823
|
+
SanitizeHtmlHelper.sanitize(legendItem['legendName']) : legendItem['legendName'], itemTextStyle);
|
|
4709
4824
|
this.textMaxWidth = Math.max(this.textMaxWidth, legendTextSize.width);
|
|
4710
4825
|
if (i === 0) {
|
|
4711
4826
|
startX = shapeX = (leftPadding + (shapeWidth / 2));
|
|
@@ -4913,7 +5028,16 @@ class TreeMapLegend {
|
|
|
4913
5028
|
if (this.treemap.enableDrillDown && !isNullOrUndefined(this.treemap.drilledLegendItems)) {
|
|
4914
5029
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4915
5030
|
const childElement = this.treemap.drilledLegendItems;
|
|
4916
|
-
|
|
5031
|
+
if (!isNullOrUndefined(childElement['data']['options'])) {
|
|
5032
|
+
legendFillColor = childElement['data']['options']['fill'];
|
|
5033
|
+
}
|
|
5034
|
+
else {
|
|
5035
|
+
for (let k = 0; k < childElement.length; k++) {
|
|
5036
|
+
legendFillColor = this.treemap.palette.length > 0 ? this.treemap.palette[k % this.treemap.palette.length] :
|
|
5037
|
+
childElement[k]['data'][this.treemap.colorValuePath];
|
|
5038
|
+
break;
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
4917
5041
|
if (childElement['data']['isDrilled']) {
|
|
4918
5042
|
child = findChildren(childElement['data'])['values'];
|
|
4919
5043
|
}
|
|
@@ -4943,7 +5067,8 @@ class TreeMapLegend {
|
|
|
4943
5067
|
? legendFillColor : this.treemap.palette[i % this.treemap.palette.length] :
|
|
4944
5068
|
child[i]['data'][this.treemap.colorValuePath],
|
|
4945
5069
|
legendData: [],
|
|
4946
|
-
itemArea: child[i]['weight']
|
|
5070
|
+
itemArea: child[i]['weight'],
|
|
5071
|
+
levelOrderName: child[i]['levelOrderName']
|
|
4947
5072
|
});
|
|
4948
5073
|
}
|
|
4949
5074
|
}
|
|
@@ -5069,7 +5194,7 @@ class TreeMapLegend {
|
|
|
5069
5194
|
this.legendCollections[this.legendCollections.length - 1]['legendData'].push(data[i]);
|
|
5070
5195
|
legendIndex++;
|
|
5071
5196
|
}
|
|
5072
|
-
else if (colorMapProcess
|
|
5197
|
+
else if (colorMapProcess) {
|
|
5073
5198
|
colorMapProcess = false;
|
|
5074
5199
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5075
5200
|
this.legendCollections[isAddData['value']]['legendData'].push(data[i]);
|
|
@@ -5087,14 +5212,19 @@ class TreeMapLegend {
|
|
|
5087
5212
|
if (isNullOrUndefined(this.outOfRangeLegend) && !isDuplicate) {
|
|
5088
5213
|
this.legendCollections.push({
|
|
5089
5214
|
actualValue: labelLegend, legendData: [],
|
|
5090
|
-
legendName: labelLegend, legendFill: outfill
|
|
5215
|
+
legendName: labelLegend, legendFill: outfill, groupIndex: (!isLeafItem || groupIndex > -1) ? groupIndex : -1
|
|
5091
5216
|
});
|
|
5092
5217
|
otherIndex = this.legendCollections.length;
|
|
5093
5218
|
this.outOfRangeLegend = this.legendCollections[otherIndex - 1];
|
|
5094
5219
|
legendIndex++;
|
|
5095
5220
|
}
|
|
5096
|
-
|
|
5097
|
-
|
|
5221
|
+
for (let k = this.legendCollections.length - 1; k >= 0; k--) {
|
|
5222
|
+
if (this.legendCollections[k]['groupIndex'] === data[i]['groupIndex']) {
|
|
5223
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5224
|
+
this.legendCollections[k]['legendData'].push(data[i]);
|
|
5225
|
+
break;
|
|
5226
|
+
}
|
|
5227
|
+
}
|
|
5098
5228
|
}
|
|
5099
5229
|
}
|
|
5100
5230
|
}
|
|
@@ -5183,7 +5313,8 @@ class TreeMapLegend {
|
|
|
5183
5313
|
- this.translate.x - Math.abs(this.legendBorderRect.x - textLocation.x);
|
|
5184
5314
|
}
|
|
5185
5315
|
}
|
|
5186
|
-
|
|
5316
|
+
const text = this.treemap.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(item['text'])) : item['text'];
|
|
5317
|
+
textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'middle', text, '', '');
|
|
5187
5318
|
renderTextElement(textOptions, textFont, textFont.color || this.treemap.themeStyle.legendTextColor, this.legendGroup);
|
|
5188
5319
|
this.legendGroup.appendChild(render.drawRectangle(rectOptions));
|
|
5189
5320
|
}
|
|
@@ -5232,7 +5363,7 @@ class TreeMapLegend {
|
|
|
5232
5363
|
for (let i = 0; i < this.totalPages[page]['Collection'].length; i++) {
|
|
5233
5364
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5234
5365
|
const collection = this.totalPages[page]['Collection'][i];
|
|
5235
|
-
const legendText = collection['DisplayText'];
|
|
5366
|
+
const legendText = this.treemap.enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(collection['DisplayText']) : collection['DisplayText'];
|
|
5236
5367
|
const legendElement = render.createGroup({ id: treemap.element.id + '_Legend_Index_' + i });
|
|
5237
5368
|
legendElement.setAttribute('aria-label', legendText + ' Legend');
|
|
5238
5369
|
legendElement.setAttribute('role', 'region');
|
|
@@ -5336,7 +5467,7 @@ class TreeMapLegend {
|
|
|
5336
5467
|
renderLegendTitle() {
|
|
5337
5468
|
const legend = this.treemap.legendSettings;
|
|
5338
5469
|
const textStyle = legend.titleStyle;
|
|
5339
|
-
const legendTitle = legend.title.text;
|
|
5470
|
+
const legendTitle = this.treemap.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(legend.title.text)) : legend.title.text;
|
|
5340
5471
|
let textOptions;
|
|
5341
5472
|
const spacing = 10;
|
|
5342
5473
|
const trimTitle = textTrim((this.legendItemRect.width + (spacing * 2)), legendTitle, textStyle);
|
|
@@ -5360,6 +5491,7 @@ class TreeMapLegend {
|
|
|
5360
5491
|
const treemap = this.treemap;
|
|
5361
5492
|
let target = e.target;
|
|
5362
5493
|
const interactiveId = treemap.element.id + '_Interactive_Legend';
|
|
5494
|
+
let pointerDrawn = false;
|
|
5363
5495
|
target = !(e.type.indexOf('touch') > -1) ? target :
|
|
5364
5496
|
document.elementFromPoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
5365
5497
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5377,7 +5509,7 @@ class TreeMapLegend {
|
|
|
5377
5509
|
let legendElement;
|
|
5378
5510
|
targetItem = treemap.layout.renderItems[parseFloat(target.id.split('_Item_Index_')[1])];
|
|
5379
5511
|
const svgRect = treemap.svgObject.getBoundingClientRect();
|
|
5380
|
-
for (let i = 0; i < this.legendCollections.length; i++) {
|
|
5512
|
+
for (let i = 0; i < this.legendCollections.length && !pointerDrawn; i++) {
|
|
5381
5513
|
currentData = this.legendCollections[i];
|
|
5382
5514
|
legendElement = document.getElementById(treemap.element.id + '_Legend_Index_' + i);
|
|
5383
5515
|
legendRect = legendElement.getBoundingClientRect();
|
|
@@ -5385,16 +5517,33 @@ class TreeMapLegend {
|
|
|
5385
5517
|
fill = legendElement.getAttribute('fill');
|
|
5386
5518
|
stroke = legend.shapeBorder.color;
|
|
5387
5519
|
strokeWidth = legend.shapeBorder.width;
|
|
5388
|
-
if (!isNullOrUndefined(currentData['legendData'])) {
|
|
5520
|
+
if (!isNullOrUndefined(currentData['legendData']) && currentData['legendData'].length > 0) {
|
|
5389
5521
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5390
5522
|
data = currentData['legendData'];
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5523
|
+
const valuePath = treemap.rangeColorValuePath;
|
|
5524
|
+
if (targetItem['levelOrderName'].indexOf(this.legendCollections[i]['legendName']) > -1) {
|
|
5525
|
+
this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
|
|
5526
|
+
pointerDrawn = true;
|
|
5527
|
+
}
|
|
5528
|
+
else {
|
|
5529
|
+
for (let j = 0; j < data.length; j++) {
|
|
5530
|
+
if ((treemap.rangeColorValuePath && treemap.leafItemSettings.colorMapping.length > 0)
|
|
5531
|
+
? data[j]['data'][valuePath] === targetItem['data'][valuePath]
|
|
5532
|
+
: (data[j]['levelOrderName'] === targetItem['levelOrderName'] ||
|
|
5533
|
+
data[j]['levelOrderName'].indexOf(targetItem['levelOrderName']) > -1)) {
|
|
5534
|
+
this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
|
|
5535
|
+
pointerDrawn = true;
|
|
5536
|
+
break;
|
|
5537
|
+
}
|
|
5395
5538
|
}
|
|
5396
5539
|
}
|
|
5397
5540
|
}
|
|
5541
|
+
else if (this.treemap.leafItemSettings.colorMapping.length === 0 && this.treemap.palette) {
|
|
5542
|
+
if (targetItem['levelOrderName'].indexOf(currentData['levelOrderName']) > -1) {
|
|
5543
|
+
this.drawInteractivePointer(legend, fill, stroke, interactiveId, strokeWidth, rect);
|
|
5544
|
+
pointerDrawn = true;
|
|
5545
|
+
}
|
|
5546
|
+
}
|
|
5398
5547
|
}
|
|
5399
5548
|
}
|
|
5400
5549
|
else {
|
|
@@ -5683,7 +5832,21 @@ class TreeMapHighlight {
|
|
|
5683
5832
|
let element;
|
|
5684
5833
|
let orders;
|
|
5685
5834
|
const selectionModule = this.treemap.treeMapSelectionModule;
|
|
5686
|
-
|
|
5835
|
+
let shapeSelected = false;
|
|
5836
|
+
if (selectionModule && selectionModule.legendSelectionCollection.length > 0) {
|
|
5837
|
+
for (let i = 0; i < selectionModule.legendSelectionCollection.length; i++) {
|
|
5838
|
+
for (let j = 0; j < selectionModule.legendSelectionCollection[i]['ShapeCollection']['Elements'].length; j++) {
|
|
5839
|
+
const selectedElementIndex = parseFloat(selectionModule.legendSelectionCollection[i]['ShapeCollection']['Elements'][j].id.split('Item_Index_')[1].split('_')[0]);
|
|
5840
|
+
const targetElementIndex = targetId.indexOf('_Item_Index_') > -1 ? parseFloat(targetId.split('Item_Index_')[1].split('_')[0]) : null;
|
|
5841
|
+
if (selectionModule.legendSelectionCollection[i]['ShapeCollection']['Elements'][j].id === targetId ||
|
|
5842
|
+
selectedElementIndex === targetElementIndex) {
|
|
5843
|
+
shapeSelected = true;
|
|
5844
|
+
break;
|
|
5845
|
+
}
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
if (targetId.indexOf('_Item_Index') > -1 && !shapeSelected) {
|
|
5687
5850
|
if (this.highLightId !== targetId) {
|
|
5688
5851
|
treeMapElement = document.getElementById(treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout');
|
|
5689
5852
|
const selectionElements = document.getElementsByClassName('treeMapSelection');
|
|
@@ -5693,16 +5856,22 @@ class TreeMapHighlight {
|
|
|
5693
5856
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5694
5857
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5695
5858
|
const length = this.treemap.treeMapLegendModule.legendCollections.length;
|
|
5696
|
-
index =
|
|
5859
|
+
index = (!treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
|
|
5860
|
+
treemap.leafItemSettings.colorMapping.length === 0 && treemap.levels.length === 0) ?
|
|
5861
|
+
parseFloat(targetId.split('_Item_Index_')[1]) : getLegendIndex(length, item, treemap);
|
|
5697
5862
|
this.shapeElement = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index) : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index);
|
|
5698
5863
|
if (this.shapeElement !== null && (selectionModule ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true)) {
|
|
5699
|
-
|
|
5864
|
+
const legendShapeElement = selectionModule ? selectionModule.shapeElement : null;
|
|
5865
|
+
if (selectionModule ? this.shapeElement !== legendShapeElement : true) {
|
|
5700
5866
|
this.currentElement.push({ currentElement: this.shapeElement });
|
|
5701
|
-
|
|
5867
|
+
removeLegend(this.shapeHighlightCollection, treemap);
|
|
5702
5868
|
this.shapeHighlightCollection.push({ legendEle: this.shapeElement, oldFill: collection[index]['legendFill'],
|
|
5703
5869
|
oldOpacity: collection[index]['opacity'], oldBorderColor: collection[index]['borderColor'],
|
|
5704
5870
|
oldBorderWidth: collection[index]['borderWidth']
|
|
5705
5871
|
});
|
|
5872
|
+
const legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
|
|
5873
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
|
|
5874
|
+
setColor(legendText, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5706
5875
|
setColor(this.shapeElement, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5707
5876
|
this.target = 'highlight';
|
|
5708
5877
|
}
|
|
@@ -5714,6 +5883,9 @@ class TreeMapHighlight {
|
|
|
5714
5883
|
else if (this.currentElement.length > 0 && this.currentElement[this.currentElement.length - 1]['currentElement'] !== this.shapeElement) {
|
|
5715
5884
|
removeSelectionWithHighlight(this.shapeHighlightCollection, this.currentElement, treemap);
|
|
5716
5885
|
this.highLightId = '';
|
|
5886
|
+
if (this.treemap.legendSettings.mode === 'Interactive') {
|
|
5887
|
+
this.treemap.treeMapLegendModule.removeInteractivePointer();
|
|
5888
|
+
}
|
|
5717
5889
|
}
|
|
5718
5890
|
}
|
|
5719
5891
|
orders = findHightLightItems(item, [], highlight.mode, treemap);
|
|
@@ -5723,6 +5895,9 @@ class TreeMapHighlight {
|
|
|
5723
5895
|
for (let i = 0; i < treeMapElement.childElementCount; i++) {
|
|
5724
5896
|
element = treeMapElement.childNodes[i];
|
|
5725
5897
|
process = true;
|
|
5898
|
+
const valuePath = treemap.rangeColorValuePath;
|
|
5899
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5900
|
+
const targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
5726
5901
|
item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
|
|
5727
5902
|
for (let j = 0; j < selectionElements.length; j++) {
|
|
5728
5903
|
if (element.id === selectionElements[j].id) {
|
|
@@ -5730,7 +5905,9 @@ class TreeMapHighlight {
|
|
|
5730
5905
|
break;
|
|
5731
5906
|
}
|
|
5732
5907
|
}
|
|
5733
|
-
if (orders.indexOf(item['levelOrderName']) > -1 && process
|
|
5908
|
+
if (orders.indexOf(item['levelOrderName']) > -1 && process &&
|
|
5909
|
+
(!isNullOrUndefined(valuePath) && valuePath !== '' ?
|
|
5910
|
+
item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
|
|
5734
5911
|
highLightElements.push(element);
|
|
5735
5912
|
items.push(item);
|
|
5736
5913
|
}
|
|
@@ -5751,35 +5928,83 @@ class TreeMapHighlight {
|
|
|
5751
5928
|
}
|
|
5752
5929
|
}
|
|
5753
5930
|
}
|
|
5754
|
-
else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1) {
|
|
5755
|
-
if (
|
|
5756
|
-
|
|
5931
|
+
else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1 || targetId.indexOf('_Legend_Text_Index') > -1) {
|
|
5932
|
+
if (!isNullOrUndefined(selectionModule)) {
|
|
5933
|
+
selectionModule.legendSelectId = !isNullOrUndefined(treemap.legendId[0]) ? treemap.legendId[0] : null;
|
|
5934
|
+
}
|
|
5935
|
+
const selectedLegendIndex = selectionModule && selectionModule.legendSelectId ?
|
|
5936
|
+
parseFloat(selectionModule.legendSelectId.split('Index_')[1]) :
|
|
5937
|
+
(selectionModule && selectionModule.shapeSelectId ? parseFloat(selectionModule.shapeSelectId.split('Index_')[1]) : null);
|
|
5938
|
+
const targetIndex = this.treemap.legendSettings.mode === 'Default' ? (targetId.indexOf('Text') === -1 ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Text_Index_')[1]))
|
|
5939
|
+
: parseFloat(targetId.split('_Legend_Index_')[1]);
|
|
5940
|
+
if (this.treemap.legendSettings.visible && targetIndex !== selectedLegendIndex) {
|
|
5757
5941
|
let itemIndex;
|
|
5758
5942
|
let groupIndex;
|
|
5759
5943
|
let length;
|
|
5944
|
+
const valuePath = treemap.rangeColorValuePath;
|
|
5760
5945
|
const targetEle = document.getElementById(targetId);
|
|
5761
5946
|
if (this.shapeTarget === 'highlight') {
|
|
5762
|
-
removeLegend(this.legendHighlightCollection);
|
|
5947
|
+
removeLegend(this.legendHighlightCollection, this.treemap);
|
|
5948
|
+
this.legendHighlightCollection = [];
|
|
5763
5949
|
}
|
|
5764
5950
|
this.shapeTarget = 'highlight';
|
|
5765
|
-
const
|
|
5766
|
-
const dataLength = this.treemap.treeMapLegendModule.legendCollections[index]['legendData'].length;
|
|
5951
|
+
const dataLength = this.treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'].length;
|
|
5767
5952
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5768
5953
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5769
|
-
const legendIndex = parseInt(targetId[targetId.length - 1], 10);
|
|
5770
5954
|
for (let i = 0; i < dataLength; i++) {
|
|
5771
5955
|
for (let j = 0; j < this.treemap.layout.renderItems.length; j++) {
|
|
5772
|
-
if (
|
|
5956
|
+
if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0)
|
|
5957
|
+
? treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['data'][valuePath] === treemap.layout.renderItems[j]['data'][valuePath]
|
|
5958
|
+
: (treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['levelOrderName'] === treemap.layout.renderItems[j]['levelOrderName'])) {
|
|
5773
5959
|
itemIndex = j;
|
|
5774
5960
|
groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
|
|
5775
5961
|
const nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
|
|
5776
|
-
if (i === 0) {
|
|
5962
|
+
if (i === 0 || this.legendHighlightCollection.length === 0) {
|
|
5777
5963
|
this.legendHighlightCollection = [];
|
|
5778
|
-
pushCollection(this.legendHighlightCollection,
|
|
5964
|
+
pushCollection(this.legendHighlightCollection, targetIndex, j, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
|
|
5779
5965
|
length = this.legendHighlightCollection.length;
|
|
5780
5966
|
this.legendHighlightCollection[length - 1]['ShapeCollection'] = { Elements: [] };
|
|
5781
5967
|
}
|
|
5782
5968
|
setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5969
|
+
let legendItem;
|
|
5970
|
+
if (targetEle.id.indexOf('Text') > -1) {
|
|
5971
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
5972
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
|
|
5973
|
+
}
|
|
5974
|
+
else {
|
|
5975
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
5976
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
|
|
5977
|
+
}
|
|
5978
|
+
setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5979
|
+
setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5980
|
+
length = this.legendHighlightCollection.length;
|
|
5981
|
+
this.legendHighlightCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
5982
|
+
}
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5985
|
+
if (dataLength === 0 && this.treemap.palette && this.treemap.palette.length > 0) {
|
|
5986
|
+
for (let j = 0; j < this.treemap.layout.renderItems.length; j++) {
|
|
5987
|
+
if ((this.treemap.treeMapLegendModule.legendCollections[targetIndex]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
|
|
5988
|
+
this.treemap.layout.renderItems[j]['levelOrderName'].indexOf(this.treemap.treeMapLegendModule.legendCollections[targetIndex]['levelOrderName']) > -1) &&
|
|
5989
|
+
((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0) ?
|
|
5990
|
+
targetIndex === j : true)) {
|
|
5991
|
+
itemIndex = j;
|
|
5992
|
+
groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
|
|
5993
|
+
const nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
|
|
5994
|
+
pushCollection(this.legendHighlightCollection, targetIndex, j, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
|
|
5995
|
+
length = this.legendHighlightCollection.length;
|
|
5996
|
+
this.legendHighlightCollection[length - 1]['ShapeCollection'] = { Elements: [] };
|
|
5997
|
+
let legendItem;
|
|
5998
|
+
if (targetEle.id.indexOf('Text') > -1) {
|
|
5999
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
6000
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
|
|
6001
|
+
}
|
|
6002
|
+
else {
|
|
6003
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
6004
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
|
|
6005
|
+
}
|
|
6006
|
+
setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
6007
|
+
setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5783
6008
|
setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5784
6009
|
length = this.legendHighlightCollection.length;
|
|
5785
6010
|
this.legendHighlightCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
@@ -5798,13 +6023,13 @@ class TreeMapHighlight {
|
|
|
5798
6023
|
if (selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true) {
|
|
5799
6024
|
if (selectionModule ? this.shapeElement !== selectionModule.shapeElement : selectionModule ?
|
|
5800
6025
|
selectionModule.legendSelect : true) {
|
|
5801
|
-
|
|
6026
|
+
removeLegend(this.shapeHighlightCollection, treemap);
|
|
5802
6027
|
this.shapeHighlightCollection = [];
|
|
5803
6028
|
}
|
|
5804
6029
|
}
|
|
5805
6030
|
}
|
|
5806
6031
|
if (this.shapeTarget === 'highlight' && this.treemap.legendSettings.visible) {
|
|
5807
|
-
removeLegend(this.legendHighlightCollection);
|
|
6032
|
+
removeLegend(this.legendHighlightCollection, this.treemap);
|
|
5808
6033
|
}
|
|
5809
6034
|
this.highLightId = '';
|
|
5810
6035
|
processHighlight = false;
|
|
@@ -5881,7 +6106,6 @@ class TreeMapSelection {
|
|
|
5881
6106
|
const targetEle = e.target;
|
|
5882
6107
|
let eventArgs;
|
|
5883
6108
|
const treemap = this.treemap;
|
|
5884
|
-
treemap.levelSelection = [];
|
|
5885
6109
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5886
6110
|
const items = [];
|
|
5887
6111
|
const targetId = targetEle.id;
|
|
@@ -5895,11 +6119,18 @@ class TreeMapSelection {
|
|
|
5895
6119
|
const selection = treemap.selectionSettings;
|
|
5896
6120
|
const highlightModule = this.treemap.treeMapHighlightModule;
|
|
5897
6121
|
const layoutID = treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout';
|
|
5898
|
-
|
|
6122
|
+
item = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
6123
|
+
const isDrillItem = (item && !item.isLeafItem && treemap.enableDrillDown) &&
|
|
6124
|
+
(targetEle.nextSibling.textContent.indexOf('[+]') > -1 || targetEle.nextSibling.textContent.indexOf('[-]') > -1);
|
|
6125
|
+
if (targetId.indexOf('_Item_Index') > -1 && !isDrillItem) {
|
|
5899
6126
|
e.preventDefault();
|
|
5900
|
-
if (this.treemap.selectionId !== targetId
|
|
6127
|
+
if (this.treemap.selectionId !== targetId) {
|
|
6128
|
+
treemap.levelSelection = [];
|
|
6129
|
+
treemap.legendId = [];
|
|
6130
|
+
this.shapeSelectId = '';
|
|
6131
|
+
removeLegend(this.legendSelectionCollection, treemap);
|
|
6132
|
+
this.legendSelectionCollection = [];
|
|
5901
6133
|
treeMapElement = document.getElementById(layoutID);
|
|
5902
|
-
item = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
5903
6134
|
let index;
|
|
5904
6135
|
if (this.treemap.legendSettings.visible) {
|
|
5905
6136
|
this.shapeSelect = false;
|
|
@@ -5907,12 +6138,15 @@ class TreeMapSelection {
|
|
|
5907
6138
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5908
6139
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5909
6140
|
this.shapeElement = undefined;
|
|
5910
|
-
|
|
6141
|
+
removeLegend(this.shapeSelectionCollection, treemap);
|
|
5911
6142
|
if (highlightModule) {
|
|
5912
6143
|
highlightModule.shapeTarget = 'selection';
|
|
5913
6144
|
highlightModule.shapeHighlightCollection = [];
|
|
5914
6145
|
}
|
|
5915
|
-
index =
|
|
6146
|
+
index = (!treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
|
|
6147
|
+
treemap.leafItemSettings.colorMapping.length === 0
|
|
6148
|
+
&& treemap.levels.length === 0) ?
|
|
6149
|
+
parseFloat(targetId.split('_Item_Index_')[1]) : getLegendIndex(length, item, treemap);
|
|
5916
6150
|
this.shapeElement = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index) : document.getElementById(this.treemap.element.id + '_Legend_Index_' + index);
|
|
5917
6151
|
if (this.shapeElement !== null) {
|
|
5918
6152
|
this.shapeSelectId = this.shapeElement.getAttribute('id');
|
|
@@ -5920,16 +6154,28 @@ class TreeMapSelection {
|
|
|
5920
6154
|
oldOpacity: collection[index]['opacity'], oldBorderColor: collection[index]['borderColor'],
|
|
5921
6155
|
oldBorderWidth: collection[index]['borderWidth']
|
|
5922
6156
|
});
|
|
6157
|
+
const legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
|
|
6158
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
|
|
6159
|
+
setColor(legendText, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
5923
6160
|
setColor(this.shapeElement, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6161
|
+
treemap.legendId.push(this.shapeElement.id);
|
|
6162
|
+
treemap.legendId.push(legendText.id);
|
|
5924
6163
|
}
|
|
5925
6164
|
}
|
|
5926
6165
|
orders = findHightLightItems(item, [], selection.mode, treemap);
|
|
5927
6166
|
for (let i = 0; i < treeMapElement.childElementCount; i++) {
|
|
5928
6167
|
element = treeMapElement.childNodes[i];
|
|
6168
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6169
|
+
const targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
5929
6170
|
item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
|
|
5930
|
-
|
|
6171
|
+
const valuePath = treemap.rangeColorValuePath;
|
|
6172
|
+
if (orders.indexOf(item['levelOrderName']) > -1 &&
|
|
6173
|
+
(!isNullOrUndefined(valuePath) && valuePath !== '' ?
|
|
6174
|
+
item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
|
|
5931
6175
|
selectionElements.push(element);
|
|
5932
|
-
|
|
6176
|
+
if (targetId.indexOf('_RectPath') > -1) {
|
|
6177
|
+
treemap.levelSelection.push(targetId);
|
|
6178
|
+
}
|
|
5933
6179
|
items.push(item);
|
|
5934
6180
|
}
|
|
5935
6181
|
}
|
|
@@ -5961,61 +6207,151 @@ class TreeMapSelection {
|
|
|
5961
6207
|
}
|
|
5962
6208
|
}
|
|
5963
6209
|
else {
|
|
5964
|
-
|
|
6210
|
+
removeLegend(this.shapeSelectionCollection, treemap);
|
|
6211
|
+
this.treemap.legendId = [];
|
|
5965
6212
|
this.shapeSelectionCollection = [];
|
|
5966
6213
|
this.shapeElement = undefined;
|
|
5967
6214
|
this.shapeSelect = true;
|
|
5968
6215
|
this.shapeSelectId = '';
|
|
5969
|
-
this.treemap.
|
|
5970
|
-
|
|
5971
|
-
|
|
6216
|
+
this.treemap.levelSelection = [];
|
|
6217
|
+
if (this.legendSelect) {
|
|
6218
|
+
removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
|
|
6219
|
+
this.treemap.selectionId = '';
|
|
6220
|
+
}
|
|
5972
6221
|
}
|
|
5973
6222
|
}
|
|
5974
|
-
else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1) {
|
|
6223
|
+
else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1 || targetId.indexOf('_Legend_Text_') > -1) {
|
|
5975
6224
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5976
6225
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5977
|
-
|
|
6226
|
+
const legendSelectIdIndex = !isNullOrUndefined(this.legendSelectId) ? parseFloat(this.legendSelectId.split('_Index_')[1]) : null;
|
|
6227
|
+
if (this.treemap.legendSettings.visible && (legendSelectIdIndex !== parseFloat(targetId.split('_Index_')[1]))) {
|
|
5978
6228
|
let itemIndex;
|
|
5979
6229
|
let groupIndex;
|
|
5980
6230
|
let length;
|
|
6231
|
+
treemap.legendId = [];
|
|
6232
|
+
treemap.levelSelection = [];
|
|
5981
6233
|
this.legendSelectId = targetId;
|
|
5982
6234
|
this.legendSelect = false;
|
|
5983
|
-
const legendIndex = parseInt(targetId[targetId.length - 1], 10)
|
|
6235
|
+
const legendIndex = !isNaN(parseInt(targetId[targetId.length - 1], 10)) ?
|
|
6236
|
+
parseInt(targetId[targetId.length - 1], 10) :
|
|
6237
|
+
parseInt(targetId[targetId.length - 6], 10);
|
|
5984
6238
|
const targetEle = document.getElementById(targetId);
|
|
5985
|
-
removeLegend(this.legendSelectionCollection);
|
|
6239
|
+
removeLegend(this.legendSelectionCollection, treemap);
|
|
6240
|
+
removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
|
|
6241
|
+
removeLegend(this.shapeSelectionCollection, treemap);
|
|
6242
|
+
this.legendSelectionCollection = [];
|
|
5986
6243
|
if (highlightModule) {
|
|
5987
6244
|
highlightModule.shapeTarget = 'selection';
|
|
6245
|
+
highlightModule.legendHighlightCollection = [];
|
|
5988
6246
|
}
|
|
5989
|
-
const
|
|
6247
|
+
const valuePath = treemap.rangeColorValuePath;
|
|
6248
|
+
const index = this.treemap.legendSettings.mode === 'Default' ? (targetId.indexOf('Text') === -1 ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Text_Index_')[1]))
|
|
6249
|
+
: parseFloat(targetId.split('_Legend_Index_')[1]);
|
|
5990
6250
|
const dataLength = this.treemap.treeMapLegendModule.legendCollections[index]['legendData'].length;
|
|
5991
6251
|
for (let k = 0; k < dataLength; k++) {
|
|
5992
6252
|
for (let l = 0; l < this.treemap.layout.renderItems.length; l++) {
|
|
5993
|
-
if (
|
|
6253
|
+
if ((!isNullOrUndefined(valuePath) && valuePath !== '' && treemap.leafItemSettings.colorMapping.length > 0) ?
|
|
6254
|
+
(treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['data'][valuePath] === treemap.layout.renderItems[l]['data'][valuePath])
|
|
6255
|
+
: (this.treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['levelOrderName'] === this.treemap.layout.renderItems[l]['levelOrderName'])) {
|
|
5994
6256
|
itemIndex = l;
|
|
5995
6257
|
groupIndex = this.treemap.layout.renderItems[l]['groupIndex'];
|
|
5996
6258
|
const nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
|
|
5997
|
-
|
|
6259
|
+
this.treemap.selectionId = nodeEle.id;
|
|
6260
|
+
if (k === 0 || this.legendSelectionCollection.length === 0) {
|
|
5998
6261
|
pushCollection(this.legendSelectionCollection, legendIndex, l, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
|
|
5999
6262
|
length = this.legendSelectionCollection.length;
|
|
6000
6263
|
this.legendSelectionCollection[length - 1]['ShapeCollection'] = { Elements: [] };
|
|
6001
6264
|
}
|
|
6265
|
+
this.treemap.selectionId = nodeEle.id;
|
|
6266
|
+
let legendItem;
|
|
6267
|
+
if (targetEle.id.indexOf('Text') > -1) {
|
|
6268
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
6269
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
|
|
6270
|
+
this.legendSelectId = legendItem.id;
|
|
6271
|
+
this.shapeElement = legendItem;
|
|
6272
|
+
}
|
|
6273
|
+
else {
|
|
6274
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
6275
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
|
|
6276
|
+
this.shapeElement = targetEle;
|
|
6277
|
+
}
|
|
6278
|
+
setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6002
6279
|
setColor(targetEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6003
6280
|
setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6004
6281
|
length = this.legendSelectionCollection.length;
|
|
6282
|
+
treemap.levelSelection.push(nodeEle.id);
|
|
6283
|
+
if (treemap.legendId.indexOf(targetEle.id) === -1) {
|
|
6284
|
+
treemap.legendId.push(targetEle.id);
|
|
6285
|
+
}
|
|
6286
|
+
if (treemap.legendId.indexOf(legendItem.id) === -1) {
|
|
6287
|
+
treemap.legendId.push(legendItem.id);
|
|
6288
|
+
}
|
|
6289
|
+
this.legendSelectionCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
6290
|
+
}
|
|
6291
|
+
}
|
|
6292
|
+
}
|
|
6293
|
+
if (dataLength === 0 && this.treemap.palette && this.treemap.palette.length > 0) {
|
|
6294
|
+
for (let j = 0; j < this.treemap.layout.renderItems.length; j++) {
|
|
6295
|
+
if ((this.treemap.treeMapLegendModule.legendCollections[index]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
|
|
6296
|
+
this.treemap.layout.renderItems[j]['levelOrderName'].indexOf(this.treemap.treeMapLegendModule.legendCollections[index]['levelOrderName']) > -1) &&
|
|
6297
|
+
((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0) ?
|
|
6298
|
+
index === j : true)) {
|
|
6299
|
+
itemIndex = j;
|
|
6300
|
+
groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
|
|
6301
|
+
const nodeEle = document.getElementById(this.treemap.element.id + '_Level_Index_' + groupIndex + '_Item_Index_' + itemIndex + '_RectPath');
|
|
6302
|
+
pushCollection(this.legendSelectionCollection, index, j, targetEle, nodeEle, this.treemap.layout.renderItems, collection);
|
|
6303
|
+
this.treemap.selectionId = nodeEle.id;
|
|
6304
|
+
length = this.legendSelectionCollection.length;
|
|
6305
|
+
this.legendSelectionCollection[length - 1]['ShapeCollection'] = { Elements: [] };
|
|
6306
|
+
let legendItem;
|
|
6307
|
+
if (targetEle.id.indexOf('Text') > -1) {
|
|
6308
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
6309
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
|
|
6310
|
+
this.legendSelectId = legendItem.id;
|
|
6311
|
+
this.shapeElement = legendItem;
|
|
6312
|
+
}
|
|
6313
|
+
else {
|
|
6314
|
+
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
6315
|
+
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
|
|
6316
|
+
this.legendSelectId = targetId;
|
|
6317
|
+
this.shapeElement = targetEle;
|
|
6318
|
+
}
|
|
6319
|
+
setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6320
|
+
setColor(targetEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6321
|
+
setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6322
|
+
treemap.levelSelection.push(nodeEle.id);
|
|
6323
|
+
if (treemap.legendId.indexOf(legendItem.id) === -1) {
|
|
6324
|
+
treemap.legendId.push(legendItem.id);
|
|
6325
|
+
}
|
|
6326
|
+
if (treemap.legendId.indexOf(targetEle.id) === -1) {
|
|
6327
|
+
treemap.legendId.push(targetEle.id);
|
|
6328
|
+
}
|
|
6329
|
+
length = this.legendSelectionCollection.length;
|
|
6005
6330
|
this.legendSelectionCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
6006
6331
|
}
|
|
6007
6332
|
}
|
|
6008
6333
|
}
|
|
6009
6334
|
}
|
|
6010
6335
|
else {
|
|
6011
|
-
removeLegend(this.legendSelectionCollection);
|
|
6336
|
+
removeLegend(this.legendSelectionCollection, this.treemap);
|
|
6337
|
+
this.legendSelectionCollection = [];
|
|
6012
6338
|
if (highlightModule) {
|
|
6013
6339
|
highlightModule.shapeTarget = 'highlight';
|
|
6014
6340
|
}
|
|
6015
6341
|
this.legendSelect = true;
|
|
6016
6342
|
this.legendSelectId = '';
|
|
6343
|
+
this.treemap.legendId = [];
|
|
6344
|
+
this.treemap.levelSelection = [];
|
|
6017
6345
|
}
|
|
6018
6346
|
}
|
|
6347
|
+
else if (isDrillItem) {
|
|
6348
|
+
removeLegend(this.legendSelectionCollection, this.treemap);
|
|
6349
|
+
this.legendSelectionCollection = [];
|
|
6350
|
+
this.legendSelect = true;
|
|
6351
|
+
this.legendSelectId = '';
|
|
6352
|
+
this.treemap.legendId = [];
|
|
6353
|
+
this.treemap.levelSelection = [];
|
|
6354
|
+
}
|
|
6019
6355
|
}
|
|
6020
6356
|
/**
|
|
6021
6357
|
* @param {string} levelOrder - Specifies the level order of treemap item
|
|
@@ -6244,6 +6580,11 @@ class TreeMapTooltip {
|
|
|
6244
6580
|
width: this.tooltipSettings.border.width || this.treemap.themeStyle.tooltipBorderWidth || 0,
|
|
6245
6581
|
color: this.tooltipSettings.border.color || this.treemap.themeStyle.tooltipBorderColor || 'transparent'
|
|
6246
6582
|
};
|
|
6583
|
+
if (this.treemap.enableHtmlSanitizer) {
|
|
6584
|
+
for (let a = 0; a < tooltipContent.length; a++) {
|
|
6585
|
+
tooltipContent[a] = SanitizeHtmlHelper.sanitize(tooltipContent[a]);
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6247
6588
|
tootipArgs = {
|
|
6248
6589
|
cancel: false, name: tooltipRendering, item: item,
|
|
6249
6590
|
options: {
|