@syncfusion/ej2-treemap 28.2.3 → 29.2.4
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 +2 -2
- package/dist/ej2-treemap.umd.min.js +2 -2
- package/dist/ej2-treemap.umd.min.js.map +1 -1
- package/dist/es6/ej2-treemap.es2015.js +284 -106
- package/dist/es6/ej2-treemap.es2015.js.map +1 -1
- package/dist/es6/ej2-treemap.es5.js +284 -106
- package/dist/es6/ej2-treemap.es5.js.map +1 -1
- package/dist/global/ej2-treemap.min.js +2 -2
- package/dist/global/ej2-treemap.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/treemap/layout/legend.js +7 -2
- package/src/treemap/layout/render-panel.js +2 -1
- package/src/treemap/treemap.d.ts +26 -1
- package/src/treemap/treemap.js +100 -0
- package/src/treemap/user-interaction/highlight-selection.d.ts +19 -3
- package/src/treemap/user-interaction/highlight-selection.js +138 -84
- package/src/treemap/user-interaction/tooltip.js +4 -2
- package/src/treemap/utils/helper.js +34 -18
|
@@ -1082,12 +1082,10 @@ 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;
|
|
1087
1085
|
if (!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to)
|
|
1088
1086
|
&& !isNullOrUndefined(colorMapping[i].value)) {
|
|
1089
1087
|
if ((value >= colorMapping[i].from && colorMapping[i].to >= value) &&
|
|
1090
|
-
(
|
|
1088
|
+
(colorMapping[i].value === equalValue)) {
|
|
1091
1089
|
isEqualColor = true;
|
|
1092
1090
|
if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
|
|
1093
1091
|
fill = !isEqualColor ? colorCollections(colorMapping[i], dataValue) : colorMapping[i].color[0];
|
|
@@ -1100,8 +1098,8 @@ function colorMap(colorMapping, equalValue, value) {
|
|
|
1100
1098
|
else if ((!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to))
|
|
1101
1099
|
|| !isNullOrUndefined((colorMapping[i].value))) {
|
|
1102
1100
|
if ((value >= colorMapping[i].from && colorMapping[i].to >= value)
|
|
1103
|
-
|| (
|
|
1104
|
-
if (
|
|
1101
|
+
|| (colorMapping[i].value === equalValue)) {
|
|
1102
|
+
if (colorMapping[i].value === equalValue) {
|
|
1105
1103
|
isEqualColor = true;
|
|
1106
1104
|
}
|
|
1107
1105
|
if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
|
|
@@ -1113,7 +1111,7 @@ function colorMap(colorMapping, equalValue, value) {
|
|
|
1113
1111
|
}
|
|
1114
1112
|
}
|
|
1115
1113
|
if (((value >= colorMapping[i].from && value <= colorMapping[i].to)
|
|
1116
|
-
|| (
|
|
1114
|
+
|| (colorMapping[i].value === equalValue))
|
|
1117
1115
|
&& !isNullOrUndefined(colorMapping[i].minOpacity) && !isNullOrUndefined(colorMapping[i].maxOpacity)
|
|
1118
1116
|
&& fill) {
|
|
1119
1117
|
opacity = deSaturationColor(colorMapping[i], value);
|
|
@@ -1390,7 +1388,7 @@ function maintainSelection(treemap, element, className) {
|
|
|
1390
1388
|
for (let index = 0; index < elementId.length; index++) {
|
|
1391
1389
|
if (element.getAttribute('id') === elementId[index] ||
|
|
1392
1390
|
element.children[0].id === elementId[index]) {
|
|
1393
|
-
if (element.childElementCount > 0) {
|
|
1391
|
+
if (element.childElementCount > 0 && element.children[0].id.indexOf('_Group') === -1) {
|
|
1394
1392
|
element.children[0].setAttribute('class', className);
|
|
1395
1393
|
applyOptions(element.childNodes[0], {
|
|
1396
1394
|
border: treemap.selectionSettings.border, fill: treemap.selectionSettings.fill,
|
|
@@ -1420,9 +1418,15 @@ function legendMaintain(treemap, legendGroup) {
|
|
|
1420
1418
|
parseFloat(legendGroup.childNodes[j]['id'].split('Index_')[1]) === parseFloat(elementId[i].split('Index_')[1])) {
|
|
1421
1419
|
const treemapSVGRectElement = legendGroup.childNodes[j];
|
|
1422
1420
|
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
1421
|
treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
|
|
1422
|
+
if (treemapSVGRectElement.id.indexOf('Text') === -1) {
|
|
1423
|
+
treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
|
|
1424
|
+
treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
|
|
1425
|
+
}
|
|
1426
|
+
else {
|
|
1427
|
+
treemapSVGRectElement.setAttribute('stroke', null);
|
|
1428
|
+
treemapSVGRectElement.setAttribute('stroke-width', null);
|
|
1429
|
+
}
|
|
1426
1430
|
}
|
|
1427
1431
|
}
|
|
1428
1432
|
}
|
|
@@ -1430,9 +1434,15 @@ function legendMaintain(treemap, legendGroup) {
|
|
|
1430
1434
|
const legendItem = document.getElementById(elementId[i]);
|
|
1431
1435
|
if (!isNullOrUndefined(legendItem)) {
|
|
1432
1436
|
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
1437
|
legendItem.setAttribute('opacity', treemap.selectionSettings.opacity);
|
|
1438
|
+
if (legendItem.id.indexOf('Text') === -1) {
|
|
1439
|
+
legendItem.setAttribute('stroke', treemap.selectionSettings.border.color);
|
|
1440
|
+
legendItem.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
|
|
1441
|
+
}
|
|
1442
|
+
else {
|
|
1443
|
+
legendItem.setAttribute('stroke', null);
|
|
1444
|
+
legendItem.setAttribute('stroke-width', null);
|
|
1445
|
+
}
|
|
1436
1446
|
}
|
|
1437
1447
|
}
|
|
1438
1448
|
}
|
|
@@ -1735,10 +1745,10 @@ function removeLegend(collection, treeMap) {
|
|
|
1735
1745
|
? document.getElementById(shapeId + '_Text')
|
|
1736
1746
|
: document.getElementById(treeMap.element.id + '_Legend_Text_Index_' + legendIndex);
|
|
1737
1747
|
if (!isNullOrUndefined(legendShape)) {
|
|
1738
|
-
setColor(legendShape, item['oldFill'], item['oldOpacity'],
|
|
1748
|
+
setColor(legendShape, item['oldFill'], item['oldOpacity'], 'none', '0px');
|
|
1739
1749
|
}
|
|
1740
1750
|
if (!isNullOrUndefined(legendText)) {
|
|
1741
|
-
setColor(legendText, treeMap.legendSettings.textStyle.color, item['oldOpacity'],
|
|
1751
|
+
setColor(legendText, treeMap.legendSettings.textStyle.color || treeMap.themeStyle.legendTextColor, item['oldOpacity'], null, null);
|
|
1742
1752
|
}
|
|
1743
1753
|
const dataCount = !isNullOrUndefined(item['ShapeCollection']) ? item['ShapeCollection']['Elements'].length : 0;
|
|
1744
1754
|
for (let k = 0; k < dataCount; k++) {
|
|
@@ -1762,8 +1772,12 @@ function removeLegend(collection, treeMap) {
|
|
|
1762
1772
|
function setColor(element, fill, opacity, borderColor, borderWidth) {
|
|
1763
1773
|
element.setAttribute('fill', fill);
|
|
1764
1774
|
element.setAttribute('opacity', opacity);
|
|
1765
|
-
|
|
1766
|
-
|
|
1775
|
+
if (!isNullOrUndefined(borderColor)) {
|
|
1776
|
+
element.setAttribute('stroke', borderColor);
|
|
1777
|
+
}
|
|
1778
|
+
if (!isNullOrUndefined(borderWidth)) {
|
|
1779
|
+
element.setAttribute('stroke-width', borderWidth);
|
|
1780
|
+
}
|
|
1767
1781
|
}
|
|
1768
1782
|
/**
|
|
1769
1783
|
*
|
|
@@ -1785,16 +1799,18 @@ function removeSelectionWithHighlight(collection, element, treemap) {
|
|
|
1785
1799
|
*/
|
|
1786
1800
|
function getLegendIndex(length, item, treemap) {
|
|
1787
1801
|
let index;
|
|
1788
|
-
const valuePath = treemap.rangeColorValuePath;
|
|
1789
|
-
|
|
1802
|
+
const valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
|
|
1803
|
+
let indexFound = false;
|
|
1804
|
+
for (let i = 0; i < length && !indexFound; i++) {
|
|
1790
1805
|
const dataLength = treemap.treeMapLegendModule.legendCollections[i]['legendData'].length;
|
|
1791
1806
|
if (dataLength > 0) {
|
|
1792
1807
|
for (let j = 0; j < dataLength; j++) {
|
|
1793
|
-
if ((!isNullOrUndefined(valuePath) &&
|
|
1808
|
+
if ((!isNullOrUndefined(valuePath) && treemap.leafItemSettings.colorMapping.length > 0 ?
|
|
1794
1809
|
(treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['data'][valuePath] === item['data'][valuePath])
|
|
1795
1810
|
: treemap.treeMapLegendModule.legendCollections[i]['legendData'][j]['levelOrderName'] === item['levelOrderName']
|
|
1796
1811
|
|| item['levelOrderName'].indexOf(treemap.treeMapLegendModule.legendCollections[i]['legendName']) > -1)) {
|
|
1797
1812
|
index = i;
|
|
1813
|
+
indexFound = true;
|
|
1798
1814
|
break;
|
|
1799
1815
|
}
|
|
1800
1816
|
}
|
|
@@ -2425,10 +2441,11 @@ class LayoutPanel {
|
|
|
2425
2441
|
}
|
|
2426
2442
|
}
|
|
2427
2443
|
itemGroup.setAttribute('aria-label', item['name']);
|
|
2428
|
-
if ((this.treemap.enableDrillDown && isLeafItem) || (this.treemap.selectionSettings.enable ||
|
|
2444
|
+
if ((this.treemap.enableDrillDown && !isLeafItem) || (this.treemap.selectionSettings.enable ||
|
|
2429
2445
|
this.treemap.highlightSettings.enable)) {
|
|
2430
2446
|
itemGroup.setAttribute('role', 'button');
|
|
2431
2447
|
itemGroup.setAttribute('tabindex', this.treemap.tabIndex.toString());
|
|
2448
|
+
itemGroup.style.outline = 'none';
|
|
2432
2449
|
itemGroup.style.cursor = this.treemap.highlightSettings.enable && !this.treemap.selectionSettings.enable && (this.treemap.enableDrillDown && item['groupIndex'] === (this.treemap.levels.length - 1)) ? 'default' :
|
|
2433
2450
|
this.treemap.highlightSettings.enable && !this.treemap.selectionSettings.enable && !this.treemap.enableDrillDown ? 'default' : 'pointer';
|
|
2434
2451
|
}
|
|
@@ -3921,6 +3938,9 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3921
3938
|
EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnTreeMap);
|
|
3922
3939
|
EventHandler.remove(this.element, Browser.touchEndEvent, this.mouseEndOnTreeMap);
|
|
3923
3940
|
EventHandler.remove(this.element, 'pointerleave mouseleave', this.mouseLeaveOnTreeMap);
|
|
3941
|
+
EventHandler.remove(this.element, 'keydown', this.keyDownHandler);
|
|
3942
|
+
EventHandler.remove(this.element, 'keyup', this.keyUpHandler);
|
|
3943
|
+
EventHandler.remove(this.element, 'focusout', this.focusHandler);
|
|
3924
3944
|
window.removeEventListener('resize', this.resizeEvent);
|
|
3925
3945
|
}
|
|
3926
3946
|
/**
|
|
@@ -3936,6 +3956,9 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3936
3956
|
EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnTreeMap, this);
|
|
3937
3957
|
EventHandler.add(this.element, Browser.touchEndEvent, this.mouseEndOnTreeMap, this);
|
|
3938
3958
|
EventHandler.add(this.element, 'pointerleave mouseleave', this.mouseLeaveOnTreeMap, this);
|
|
3959
|
+
EventHandler.add(this.element, 'keydown', this.keyDownHandler, this);
|
|
3960
|
+
EventHandler.add(this.element, 'keyup', this.keyUpHandler, this);
|
|
3961
|
+
EventHandler.add(this.element, 'focusout', this.focusHandler, this);
|
|
3939
3962
|
this.resizeEvent = this.resizeOnTreeMap.bind(this);
|
|
3940
3963
|
window.addEventListener('resize', this.resizeEvent);
|
|
3941
3964
|
}
|
|
@@ -4071,6 +4094,10 @@ let TreeMap = class TreeMap extends Component {
|
|
|
4071
4094
|
if (e.target.id.indexOf('_Item_Index') > -1) {
|
|
4072
4095
|
this.mouseDown = true;
|
|
4073
4096
|
}
|
|
4097
|
+
if (e.type === 'touchstart' || e.type === 'mousedown') {
|
|
4098
|
+
this.removeFocus('none');
|
|
4099
|
+
e.preventDefault();
|
|
4100
|
+
}
|
|
4074
4101
|
this.notify(Browser.touchStartEvent, e);
|
|
4075
4102
|
}
|
|
4076
4103
|
/**
|
|
@@ -4090,6 +4117,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
4090
4117
|
this.trigger(mouseMove, moveArgs);
|
|
4091
4118
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4092
4119
|
let childItems;
|
|
4120
|
+
this.removeFocus('none');
|
|
4093
4121
|
if (targetId.indexOf('_Item_Index') > -1) {
|
|
4094
4122
|
item = this.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
4095
4123
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -4360,6 +4388,95 @@ let TreeMap = class TreeMap extends Component {
|
|
|
4360
4388
|
removeLegend(this.treeMapHighlightModule.shapeHighlightCollection, this);
|
|
4361
4389
|
this.treeMapHighlightModule.highLightId = '';
|
|
4362
4390
|
}
|
|
4391
|
+
this.removeFocus('');
|
|
4392
|
+
}
|
|
4393
|
+
/**
|
|
4394
|
+
* This method is used to perform operations when keyboard up on TreeMap.
|
|
4395
|
+
*
|
|
4396
|
+
* @param {KeyboardEvent} event - Specifies the keyboard event on TreeMap.
|
|
4397
|
+
* @returns {void}
|
|
4398
|
+
* @private
|
|
4399
|
+
*/
|
|
4400
|
+
keyUpHandler(event) {
|
|
4401
|
+
if (event.code !== 'Tab') {
|
|
4402
|
+
return;
|
|
4403
|
+
}
|
|
4404
|
+
const id = event.target['id'];
|
|
4405
|
+
const targetEle = document.getElementById(id);
|
|
4406
|
+
if ((id.indexOf('Item_Index') > -1 || id.indexOf('Legend') > -1)) {
|
|
4407
|
+
if (this.treeMapTooltipModule) {
|
|
4408
|
+
this.treeMapTooltipModule.removeTooltip();
|
|
4409
|
+
}
|
|
4410
|
+
if (this.treeMapHighlightModule && this.highlightSettings.enable) {
|
|
4411
|
+
targetEle.style.setProperty('outline', 'none');
|
|
4412
|
+
targetEle.classList.add('keyboard-focused');
|
|
4413
|
+
const highlightElement = id.indexOf('_Legend_') > -1 && this.legendSettings.mode === 'Default' ?
|
|
4414
|
+
targetEle.children[0] : targetEle;
|
|
4415
|
+
this.treeMapHighlightModule.highlightOnMouseMove(highlightElement);
|
|
4416
|
+
}
|
|
4417
|
+
else {
|
|
4418
|
+
this.removeFocus('');
|
|
4419
|
+
targetEle.style.outline = '2px solid black';
|
|
4420
|
+
targetEle.classList.add('keyboard-focused');
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
else {
|
|
4424
|
+
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
|
|
4425
|
+
if (this.treeMapHighlightModule) {
|
|
4426
|
+
removeLegend(this.treeMapHighlightModule.shapeHighlightCollection, this);
|
|
4427
|
+
}
|
|
4428
|
+
this.removeFocus('none');
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
/**
|
|
4432
|
+
* This method is used to perform operations when keyboard down on treemap.
|
|
4433
|
+
*
|
|
4434
|
+
* @param {KeyboardEvent} event - Specifies the keyboard event on treemap.
|
|
4435
|
+
* @returns {void}
|
|
4436
|
+
* @private
|
|
4437
|
+
*/
|
|
4438
|
+
keyDownHandler(event) {
|
|
4439
|
+
const id = event.target['id'];
|
|
4440
|
+
const targetEle = document.getElementById(id);
|
|
4441
|
+
if (event.code === 'Enter') {
|
|
4442
|
+
if (this.selectionSettings.enable && (id.indexOf('Item_Index') > -1 || id.indexOf('Legend') > -1)) {
|
|
4443
|
+
const selectionElement = id.indexOf('_Legend_') > -1 && this.legendSettings.mode === 'Default' ?
|
|
4444
|
+
targetEle.children[0] : targetEle;
|
|
4445
|
+
this.treeMapSelectionModule.selectionOnMouseDown(selectionElement);
|
|
4446
|
+
}
|
|
4447
|
+
if (this.enableDrillDown && targetEle.childElementCount > 0) {
|
|
4448
|
+
this.mouseEndOnTreeMap(event);
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
/**
|
|
4453
|
+
* This method is used to perform operations when focus out on treemap.
|
|
4454
|
+
*
|
|
4455
|
+
* @param {KeyboardEvent} event - Specifies the keyboard event on treemap.
|
|
4456
|
+
* @returns {void}
|
|
4457
|
+
* @private
|
|
4458
|
+
*/
|
|
4459
|
+
focusHandler(event) {
|
|
4460
|
+
const id = event.target['id'];
|
|
4461
|
+
if (!this.element.contains(event.relatedTarget) ||
|
|
4462
|
+
(id.indexOf('Item_Index') > -1 && event.relatedTarget.id.indexOf('Legend') > -1) ||
|
|
4463
|
+
(id.indexOf('Legend') > -1 && event.relatedTarget.id.indexOf('Item_Index') > -1)) {
|
|
4464
|
+
if (this.treeMapHighlightModule && this.highlightSettings.enable) {
|
|
4465
|
+
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
|
|
4466
|
+
removeLegend(this.treeMapHighlightModule.legendHighlightCollection, this);
|
|
4467
|
+
this.treeMapHighlightModule.highLightId = '';
|
|
4468
|
+
}
|
|
4469
|
+
else {
|
|
4470
|
+
this.removeFocus('none');
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
removeFocus(outline) {
|
|
4475
|
+
const highlightedElement = document.querySelector('.keyboard-focused');
|
|
4476
|
+
if (highlightedElement) {
|
|
4477
|
+
highlightedElement.style.outline = outline;
|
|
4478
|
+
highlightedElement.classList.remove('keyboard-focused');
|
|
4479
|
+
}
|
|
4363
4480
|
}
|
|
4364
4481
|
/**
|
|
4365
4482
|
* This method is used to select or remove the selection of treemap item based on the provided selection settings.
|
|
@@ -5219,7 +5336,7 @@ class TreeMapLegend {
|
|
|
5219
5336
|
legendIndex++;
|
|
5220
5337
|
}
|
|
5221
5338
|
for (let k = this.legendCollections.length - 1; k >= 0; k--) {
|
|
5222
|
-
if (this.legendCollections[k]['
|
|
5339
|
+
if (this.legendCollections[k]['actualValue'] === (colorMap.label || 'Others')) {
|
|
5223
5340
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5224
5341
|
this.legendCollections[k]['legendData'].push(data[i]);
|
|
5225
5342
|
break;
|
|
@@ -5316,7 +5433,10 @@ class TreeMapLegend {
|
|
|
5316
5433
|
const text = this.treemap.enableHtmlSanitizer ? (SanitizeHtmlHelper.sanitize(item['text'])) : item['text'];
|
|
5317
5434
|
textOptions = new TextOption(textId, textLocation.x, textLocation.y, 'middle', text, '', '');
|
|
5318
5435
|
renderTextElement(textOptions, textFont, textFont.color || this.treemap.themeStyle.legendTextColor, this.legendGroup);
|
|
5319
|
-
|
|
5436
|
+
const legendElement = render.drawRectangle(rectOptions);
|
|
5437
|
+
legendElement.setAttribute('tabindex', this.treemap.tabIndex.toString());
|
|
5438
|
+
legendElement.style.outline = '';
|
|
5439
|
+
this.legendGroup.appendChild(legendElement);
|
|
5320
5440
|
}
|
|
5321
5441
|
}
|
|
5322
5442
|
legendMaintain(this.treemap, this.legendGroup);
|
|
@@ -5367,6 +5487,8 @@ class TreeMapLegend {
|
|
|
5367
5487
|
const legendElement = render.createGroup({ id: treemap.element.id + '_Legend_Index_' + i });
|
|
5368
5488
|
legendElement.setAttribute('aria-label', legendText + ' Legend');
|
|
5369
5489
|
legendElement.setAttribute('role', 'region');
|
|
5490
|
+
legendElement.setAttribute('tabindex', this.treemap.tabIndex.toString());
|
|
5491
|
+
legendElement.style.outline = 'none';
|
|
5370
5492
|
const shapeId = treemap.element.id + '_Legend_Shape_Index_' + i;
|
|
5371
5493
|
const textId = treemap.element.id + '_Legend_Text_Index_' + i;
|
|
5372
5494
|
let shapeLocation = collection['Shape'];
|
|
@@ -5810,16 +5932,27 @@ class TreeMapHighlight {
|
|
|
5810
5932
|
this.addEventListener();
|
|
5811
5933
|
}
|
|
5812
5934
|
/**
|
|
5813
|
-
* Mouse
|
|
5935
|
+
* Mouse Move event in highlight
|
|
5814
5936
|
*
|
|
5815
5937
|
* @param {PointerEvent} e - Specifies the pointer argument.
|
|
5816
5938
|
* @returns {boolean} - return the highlight process is true or false.
|
|
5817
5939
|
* @private
|
|
5818
5940
|
*/
|
|
5819
5941
|
mouseMove(e) {
|
|
5942
|
+
const targetEle = e.target;
|
|
5943
|
+
return this.highlightOnMouseMove(targetEle);
|
|
5944
|
+
}
|
|
5945
|
+
/**
|
|
5946
|
+
* This method highlights the target element for mouse move event.
|
|
5947
|
+
*
|
|
5948
|
+
* @param {Element} targetElement - Specifies the target element to highlight.
|
|
5949
|
+
* @returns {boolean} - return the highlight process is true or false.
|
|
5950
|
+
* @private
|
|
5951
|
+
*/
|
|
5952
|
+
highlightOnMouseMove(targetElement) {
|
|
5820
5953
|
const treemap = this.treemap;
|
|
5821
5954
|
let processHighlight;
|
|
5822
|
-
const targetId =
|
|
5955
|
+
const targetId = targetElement.id;
|
|
5823
5956
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5824
5957
|
let eventArgs;
|
|
5825
5958
|
const items = [];
|
|
@@ -5847,7 +5980,8 @@ class TreeMapHighlight {
|
|
|
5847
5980
|
}
|
|
5848
5981
|
}
|
|
5849
5982
|
if (targetId.indexOf('_Item_Index') > -1 && !shapeSelected) {
|
|
5850
|
-
if (this.highLightId !== targetId
|
|
5983
|
+
if (this.highLightId !== targetId ||
|
|
5984
|
+
(this.legendHighlightCollection[0] ? this.legendHighlightCollection[0]['ShapeCollection']['Elements'].length > 1 : false)) {
|
|
5851
5985
|
treeMapElement = document.getElementById(treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout');
|
|
5852
5986
|
const selectionElements = document.getElementsByClassName('treeMapSelection');
|
|
5853
5987
|
item = this.treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
@@ -5859,10 +5993,16 @@ class TreeMapHighlight {
|
|
|
5859
5993
|
index = (!treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
|
|
5860
5994
|
treemap.leafItemSettings.colorMapping.length === 0 && treemap.levels.length === 0) ?
|
|
5861
5995
|
parseFloat(targetId.split('_Item_Index_')[1]) : getLegendIndex(length, item, treemap);
|
|
5996
|
+
if (isNullOrUndefined(index)) {
|
|
5997
|
+
removeLegend(this.legendHighlightCollection, treemap);
|
|
5998
|
+
removeLegend(this.shapeHighlightCollection, treemap);
|
|
5999
|
+
this.legendHighlightCollection = [];
|
|
6000
|
+
treemap.treeMapLegendModule.removeInteractivePointer();
|
|
6001
|
+
}
|
|
5862
6002
|
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);
|
|
5863
|
-
if (this.shapeElement !== null
|
|
5864
|
-
|
|
5865
|
-
|
|
6003
|
+
if (this.shapeElement !== null) {
|
|
6004
|
+
if (selectionModule ? this.shapeElement.id !== ((selectionModule && selectionModule.shapeElement)
|
|
6005
|
+
? selectionModule.shapeElement.id : null) : true) {
|
|
5866
6006
|
this.currentElement.push({ currentElement: this.shapeElement });
|
|
5867
6007
|
removeLegend(this.shapeHighlightCollection, treemap);
|
|
5868
6008
|
this.shapeHighlightCollection.push({ legendEle: this.shapeElement, oldFill: collection[index]['legendFill'],
|
|
@@ -5871,7 +6011,7 @@ class TreeMapHighlight {
|
|
|
5871
6011
|
});
|
|
5872
6012
|
const legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
|
|
5873
6013
|
: document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
|
|
5874
|
-
setColor(legendText, highlight.fill, highlight.opacity,
|
|
6014
|
+
setColor(legendText, highlight.fill, highlight.opacity, null, null);
|
|
5875
6015
|
setColor(this.shapeElement, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5876
6016
|
this.target = 'highlight';
|
|
5877
6017
|
}
|
|
@@ -5880,52 +6020,39 @@ class TreeMapHighlight {
|
|
|
5880
6020
|
this.highLightId = '';
|
|
5881
6021
|
}
|
|
5882
6022
|
}
|
|
5883
|
-
else if (this.currentElement.length > 0 && this.currentElement[this.currentElement.length - 1]['currentElement'] !== this.shapeElement) {
|
|
5884
|
-
removeSelectionWithHighlight(this.shapeHighlightCollection, this.currentElement, treemap);
|
|
5885
|
-
this.highLightId = '';
|
|
5886
|
-
if (this.treemap.legendSettings.mode === 'Interactive') {
|
|
5887
|
-
this.treemap.treeMapLegendModule.removeInteractivePointer();
|
|
5888
|
-
}
|
|
5889
|
-
}
|
|
5890
6023
|
}
|
|
5891
6024
|
orders = findHightLightItems(item, [], highlight.mode, treemap);
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
process = false;
|
|
5905
|
-
break;
|
|
5906
|
-
}
|
|
5907
|
-
}
|
|
5908
|
-
if (orders.indexOf(item['levelOrderName']) > -1 && process &&
|
|
5909
|
-
(!isNullOrUndefined(valuePath) && valuePath !== '' ?
|
|
5910
|
-
item['data'][valuePath] === targetItem['data'][valuePath] : true)) {
|
|
5911
|
-
highLightElements.push(element);
|
|
5912
|
-
items.push(item);
|
|
5913
|
-
}
|
|
5914
|
-
}
|
|
5915
|
-
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
|
|
5916
|
-
for (let k = 0; k < highLightElements.length; k++) {
|
|
5917
|
-
element = highLightElements[k];
|
|
5918
|
-
applyOptions(element.childNodes[0], { border: highlight.border, fill: highlight.fill, opacity: highlight.opacity });
|
|
5919
|
-
element.classList.add('treeMapHighLight');
|
|
5920
|
-
this.highLightId = targetId;
|
|
6025
|
+
for (let i = 0; i < treeMapElement.childElementCount; i++) {
|
|
6026
|
+
element = treeMapElement.childNodes[i];
|
|
6027
|
+
process = true;
|
|
6028
|
+
const valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
|
|
6029
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6030
|
+
const targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
6031
|
+
item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
|
|
6032
|
+
for (let j = 0; j < selectionElements.length; j++) {
|
|
6033
|
+
if (element.id === selectionElements[j].id ||
|
|
6034
|
+
element.id === selectionElements[j].parentElement.id) {
|
|
6035
|
+
process = false;
|
|
6036
|
+
break;
|
|
5921
6037
|
}
|
|
5922
|
-
eventArgs = { cancel: false, name: itemHighlight, treemap: treemap, items: items, elements: highLightElements };
|
|
5923
|
-
treemap.trigger(itemHighlight, eventArgs);
|
|
5924
6038
|
}
|
|
5925
|
-
|
|
5926
|
-
|
|
6039
|
+
if (orders.indexOf(item['levelOrderName']) > -1 && process &&
|
|
6040
|
+
(!isNullOrUndefined(valuePath) ?
|
|
6041
|
+
(item['data'][valuePath] === targetItem['data'][valuePath] ||
|
|
6042
|
+
(highlight.mode !== 'Item' && treemap.levels.length > 0)) : true)) {
|
|
6043
|
+
highLightElements.push(element);
|
|
6044
|
+
items.push(item);
|
|
5927
6045
|
}
|
|
5928
6046
|
}
|
|
6047
|
+
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
|
|
6048
|
+
for (let k = 0; k < highLightElements.length; k++) {
|
|
6049
|
+
element = highLightElements[k];
|
|
6050
|
+
applyOptions(element.childNodes[0], { border: highlight.border, fill: highlight.fill, opacity: highlight.opacity });
|
|
6051
|
+
element.classList.add('treeMapHighLight');
|
|
6052
|
+
this.highLightId = targetId;
|
|
6053
|
+
}
|
|
6054
|
+
eventArgs = { cancel: false, name: itemHighlight, treemap: treemap, items: items, elements: highLightElements };
|
|
6055
|
+
treemap.trigger(itemHighlight, eventArgs);
|
|
5929
6056
|
}
|
|
5930
6057
|
}
|
|
5931
6058
|
else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1 || targetId.indexOf('_Legend_Text_Index') > -1) {
|
|
@@ -5941,7 +6068,7 @@ class TreeMapHighlight {
|
|
|
5941
6068
|
let itemIndex;
|
|
5942
6069
|
let groupIndex;
|
|
5943
6070
|
let length;
|
|
5944
|
-
const valuePath = treemap.rangeColorValuePath;
|
|
6071
|
+
const valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
|
|
5945
6072
|
const targetEle = document.getElementById(targetId);
|
|
5946
6073
|
if (this.shapeTarget === 'highlight') {
|
|
5947
6074
|
removeLegend(this.legendHighlightCollection, this.treemap);
|
|
@@ -5953,7 +6080,8 @@ class TreeMapHighlight {
|
|
|
5953
6080
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5954
6081
|
for (let i = 0; i < dataLength; i++) {
|
|
5955
6082
|
for (let j = 0; j < this.treemap.layout.renderItems.length; j++) {
|
|
5956
|
-
if ((!isNullOrUndefined(valuePath) &&
|
|
6083
|
+
if ((!isNullOrUndefined(valuePath) && treemap.leafItemSettings.colorMapping.length > 0 &&
|
|
6084
|
+
treemap.levels.length === 0)
|
|
5957
6085
|
? treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['data'][valuePath] === treemap.layout.renderItems[j]['data'][valuePath]
|
|
5958
6086
|
: (treemap.treeMapLegendModule.legendCollections[targetIndex]['legendData'][i]['levelOrderName'] === treemap.layout.renderItems[j]['levelOrderName'])) {
|
|
5959
6087
|
itemIndex = j;
|
|
@@ -5965,17 +6093,20 @@ class TreeMapHighlight {
|
|
|
5965
6093
|
length = this.legendHighlightCollection.length;
|
|
5966
6094
|
this.legendHighlightCollection[length - 1]['ShapeCollection'] = { Elements: [] };
|
|
5967
6095
|
}
|
|
5968
|
-
|
|
5969
|
-
let
|
|
6096
|
+
let legendShape;
|
|
6097
|
+
let legendText;
|
|
5970
6098
|
if (targetEle.id.indexOf('Text') > -1) {
|
|
5971
|
-
|
|
6099
|
+
legendShape = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
5972
6100
|
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
|
|
6101
|
+
setColor(targetEle, highlight.fill, highlight.opacity, null, null);
|
|
6102
|
+
setColor(legendShape, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5973
6103
|
}
|
|
5974
6104
|
else {
|
|
5975
|
-
|
|
6105
|
+
legendText = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
5976
6106
|
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
|
|
6107
|
+
setColor(legendText, highlight.fill, highlight.opacity, null, null);
|
|
6108
|
+
setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5977
6109
|
}
|
|
5978
|
-
setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5979
6110
|
setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
5980
6111
|
length = this.legendHighlightCollection.length;
|
|
5981
6112
|
this.legendHighlightCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
@@ -5986,7 +6117,8 @@ class TreeMapHighlight {
|
|
|
5986
6117
|
for (let j = 0; j < this.treemap.layout.renderItems.length; j++) {
|
|
5987
6118
|
if ((this.treemap.treeMapLegendModule.legendCollections[targetIndex]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
|
|
5988
6119
|
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
|
|
6120
|
+
((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
|
|
6121
|
+
!this.treemap.layout.renderItems[j].parent.isDrilled) ?
|
|
5990
6122
|
targetIndex === j : true)) {
|
|
5991
6123
|
itemIndex = j;
|
|
5992
6124
|
groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
|
|
@@ -5998,13 +6130,15 @@ class TreeMapHighlight {
|
|
|
5998
6130
|
if (targetEle.id.indexOf('Text') > -1) {
|
|
5999
6131
|
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
6000
6132
|
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + targetIndex);
|
|
6133
|
+
setColor(targetEle, highlight.fill, highlight.opacity, null, null);
|
|
6134
|
+
setColor(legendItem, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
6001
6135
|
}
|
|
6002
6136
|
else {
|
|
6003
6137
|
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
6004
6138
|
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + targetIndex);
|
|
6139
|
+
setColor(legendItem, highlight.fill, highlight.opacity, null, null);
|
|
6140
|
+
setColor(targetEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
6005
6141
|
}
|
|
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());
|
|
6008
6142
|
setColor(nodeEle, highlight.fill, highlight.opacity, highlight.border.color, highlight.border.width.toString());
|
|
6009
6143
|
length = this.legendHighlightCollection.length;
|
|
6010
6144
|
this.legendHighlightCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
@@ -6012,6 +6146,11 @@ class TreeMapHighlight {
|
|
|
6012
6146
|
}
|
|
6013
6147
|
}
|
|
6014
6148
|
}
|
|
6149
|
+
else {
|
|
6150
|
+
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
|
|
6151
|
+
removeLegend(this.legendHighlightCollection, treemap);
|
|
6152
|
+
this.legendHighlightCollection = [];
|
|
6153
|
+
}
|
|
6015
6154
|
}
|
|
6016
6155
|
else {
|
|
6017
6156
|
if (selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true) {
|
|
@@ -6104,8 +6243,24 @@ class TreeMapSelection {
|
|
|
6104
6243
|
*/
|
|
6105
6244
|
mouseDown(e) {
|
|
6106
6245
|
const targetEle = e.target;
|
|
6246
|
+
e.preventDefault();
|
|
6247
|
+
this.selectionOnMouseDown(targetEle);
|
|
6248
|
+
}
|
|
6249
|
+
/**
|
|
6250
|
+
* This method selects the target element for mouse down event.
|
|
6251
|
+
*
|
|
6252
|
+
* @param {Element} targetEle - Specifies the target element that was clicked.
|
|
6253
|
+
* @returns {void}
|
|
6254
|
+
* @private
|
|
6255
|
+
*/
|
|
6256
|
+
selectionOnMouseDown(targetEle) {
|
|
6107
6257
|
let eventArgs;
|
|
6108
6258
|
const treemap = this.treemap;
|
|
6259
|
+
targetEle.setAttribute('tabindex', '-1');
|
|
6260
|
+
targetEle.style.outline = 'none';
|
|
6261
|
+
if (!targetEle.id.includes('Legend_Shape_Index')) {
|
|
6262
|
+
targetEle.focus();
|
|
6263
|
+
}
|
|
6109
6264
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6110
6265
|
const items = [];
|
|
6111
6266
|
const targetId = targetEle.id;
|
|
@@ -6121,10 +6276,13 @@ class TreeMapSelection {
|
|
|
6121
6276
|
const layoutID = treemap.element.id + '_TreeMap_' + treemap.layoutType + '_Layout';
|
|
6122
6277
|
item = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
6123
6278
|
const isDrillItem = (item && !item.isLeafItem && treemap.enableDrillDown) &&
|
|
6124
|
-
(targetEle.
|
|
6279
|
+
(targetEle.textContent.indexOf('[+]') > -1 || targetEle.textContent.indexOf('[-]') > -1 ||
|
|
6280
|
+
(!isNullOrUndefined(targetEle.nextElementSibling) &&
|
|
6281
|
+
(targetEle.nextSibling.textContent.indexOf('[+]') > -1 || targetEle.nextSibling.textContent.indexOf('[-]') > -1)));
|
|
6125
6282
|
if (targetId.indexOf('_Item_Index') > -1 && !isDrillItem) {
|
|
6126
|
-
|
|
6127
|
-
|
|
6283
|
+
if ((this.treemap.selectionId !== targetId &&
|
|
6284
|
+
(treemap.selectionId ? parseFloat(treemap.selectionId.split('_Item_Index_')[1]) !== parseFloat(targetId.split('_Item_Index_')[1]) : true)) ||
|
|
6285
|
+
(this.legendSelectionCollection[0] ? this.legendSelectionCollection[0]['ShapeCollection']['Elements'].length > 1 : false)) {
|
|
6128
6286
|
treemap.levelSelection = [];
|
|
6129
6287
|
treemap.legendId = [];
|
|
6130
6288
|
this.shapeSelectId = '';
|
|
@@ -6156,7 +6314,7 @@ class TreeMapSelection {
|
|
|
6156
6314
|
});
|
|
6157
6315
|
const legendText = this.treemap.legendSettings.mode === 'Default' ? document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index)
|
|
6158
6316
|
: document.getElementById(this.treemap.element.id + '_Legend_Index_' + index + '_Text');
|
|
6159
|
-
setColor(legendText, selection.fill, selection.opacity,
|
|
6317
|
+
setColor(legendText, selection.fill, selection.opacity, null, null);
|
|
6160
6318
|
setColor(this.shapeElement, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6161
6319
|
treemap.legendId.push(this.shapeElement.id);
|
|
6162
6320
|
treemap.legendId.push(legendText.id);
|
|
@@ -6168,13 +6326,14 @@ class TreeMapSelection {
|
|
|
6168
6326
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6169
6327
|
const targetItem = treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
6170
6328
|
item = treemap.layout.renderItems[parseFloat(element.id.split('_Item_Index_')[1])];
|
|
6171
|
-
const valuePath = treemap.rangeColorValuePath;
|
|
6329
|
+
const valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
|
|
6172
6330
|
if (orders.indexOf(item['levelOrderName']) > -1 &&
|
|
6173
|
-
(!isNullOrUndefined(valuePath)
|
|
6174
|
-
item['data'][valuePath] === targetItem['data'][valuePath]
|
|
6331
|
+
(!isNullOrUndefined(valuePath) ?
|
|
6332
|
+
(item['data'][valuePath] === targetItem['data'][valuePath] ||
|
|
6333
|
+
(selection.mode !== 'Item' && treemap.levels.length > 0)) : true)) {
|
|
6175
6334
|
selectionElements.push(element);
|
|
6176
6335
|
if (targetId.indexOf('_RectPath') > -1) {
|
|
6177
|
-
treemap.levelSelection.push(
|
|
6336
|
+
treemap.levelSelection.push(element.id);
|
|
6178
6337
|
}
|
|
6179
6338
|
items.push(item);
|
|
6180
6339
|
}
|
|
@@ -6207,14 +6366,17 @@ class TreeMapSelection {
|
|
|
6207
6366
|
}
|
|
6208
6367
|
}
|
|
6209
6368
|
else {
|
|
6369
|
+
removeLegend(this.legendSelectionCollection, treemap);
|
|
6210
6370
|
removeLegend(this.shapeSelectionCollection, treemap);
|
|
6211
6371
|
this.treemap.legendId = [];
|
|
6212
6372
|
this.shapeSelectionCollection = [];
|
|
6373
|
+
this.legendSelectionCollection = [];
|
|
6213
6374
|
this.shapeElement = undefined;
|
|
6214
6375
|
this.shapeSelect = true;
|
|
6215
6376
|
this.shapeSelectId = '';
|
|
6216
6377
|
this.treemap.levelSelection = [];
|
|
6217
|
-
|
|
6378
|
+
this.legendSelectId = '';
|
|
6379
|
+
if (this.legendSelect || this.shapeSelect) {
|
|
6218
6380
|
removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
|
|
6219
6381
|
this.treemap.selectionId = '';
|
|
6220
6382
|
}
|
|
@@ -6244,13 +6406,14 @@ class TreeMapSelection {
|
|
|
6244
6406
|
highlightModule.shapeTarget = 'selection';
|
|
6245
6407
|
highlightModule.legendHighlightCollection = [];
|
|
6246
6408
|
}
|
|
6247
|
-
const valuePath = treemap.rangeColorValuePath;
|
|
6409
|
+
const valuePath = (treemap.rangeColorValuePath !== '') ? treemap.rangeColorValuePath : null;
|
|
6248
6410
|
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
6411
|
: parseFloat(targetId.split('_Legend_Index_')[1]);
|
|
6250
6412
|
const dataLength = this.treemap.treeMapLegendModule.legendCollections[index]['legendData'].length;
|
|
6251
6413
|
for (let k = 0; k < dataLength; k++) {
|
|
6252
6414
|
for (let l = 0; l < this.treemap.layout.renderItems.length; l++) {
|
|
6253
|
-
if ((!isNullOrUndefined(valuePath) &&
|
|
6415
|
+
if ((!isNullOrUndefined(valuePath) && treemap.leafItemSettings.colorMapping.length > 0 &&
|
|
6416
|
+
treemap.levels.length === 0) ?
|
|
6254
6417
|
(treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['data'][valuePath] === treemap.layout.renderItems[l]['data'][valuePath])
|
|
6255
6418
|
: (this.treemap.treeMapLegendModule.legendCollections[index]['legendData'][k]['levelOrderName'] === this.treemap.layout.renderItems[l]['levelOrderName'])) {
|
|
6256
6419
|
itemIndex = l;
|
|
@@ -6263,29 +6426,30 @@ class TreeMapSelection {
|
|
|
6263
6426
|
this.legendSelectionCollection[length - 1]['ShapeCollection'] = { Elements: [] };
|
|
6264
6427
|
}
|
|
6265
6428
|
this.treemap.selectionId = nodeEle.id;
|
|
6266
|
-
let
|
|
6429
|
+
let legendShape;
|
|
6430
|
+
let legendText;
|
|
6267
6431
|
if (targetEle.id.indexOf('Text') > -1) {
|
|
6268
|
-
|
|
6432
|
+
legendShape = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
6269
6433
|
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
|
|
6270
|
-
|
|
6271
|
-
|
|
6434
|
+
setColor(legendShape, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6435
|
+
setColor(targetEle, selection.fill, selection.opacity, null, null);
|
|
6436
|
+
this.legendSelectId = legendShape.id;
|
|
6437
|
+
this.shapeElement = legendShape;
|
|
6438
|
+
treemap.legendId.push(targetEle.id);
|
|
6439
|
+
treemap.legendId.push(legendShape.id);
|
|
6272
6440
|
}
|
|
6273
6441
|
else {
|
|
6274
|
-
|
|
6442
|
+
legendText = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
6275
6443
|
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
|
|
6444
|
+
setColor(legendText, selection.fill, selection.opacity, null, null);
|
|
6445
|
+
setColor(targetEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6276
6446
|
this.shapeElement = targetEle;
|
|
6447
|
+
treemap.legendId.push(targetEle.id);
|
|
6448
|
+
treemap.legendId.push(legendText.id);
|
|
6277
6449
|
}
|
|
6278
|
-
setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6279
|
-
setColor(targetEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6280
6450
|
setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6281
6451
|
length = this.legendSelectionCollection.length;
|
|
6282
6452
|
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
6453
|
this.legendSelectionCollection[length - 1]['ShapeCollection']['Elements'].push(nodeEle);
|
|
6290
6454
|
}
|
|
6291
6455
|
}
|
|
@@ -6294,7 +6458,8 @@ class TreeMapSelection {
|
|
|
6294
6458
|
for (let j = 0; j < this.treemap.layout.renderItems.length; j++) {
|
|
6295
6459
|
if ((this.treemap.treeMapLegendModule.legendCollections[index]['levelOrderName'] === this.treemap.layout.renderItems[j]['levelOrderName'] ||
|
|
6296
6460
|
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
|
|
6461
|
+
((!this.treemap.legendSettings.removeDuplicateLegend && treemap.palette && treemap.palette.length > 0 &&
|
|
6462
|
+
!this.treemap.layout.renderItems[j].parent.isDrilled) ?
|
|
6298
6463
|
index === j : true)) {
|
|
6299
6464
|
itemIndex = j;
|
|
6300
6465
|
groupIndex = this.treemap.layout.renderItems[j]['groupIndex'];
|
|
@@ -6307,17 +6472,19 @@ class TreeMapSelection {
|
|
|
6307
6472
|
if (targetEle.id.indexOf('Text') > -1) {
|
|
6308
6473
|
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id.replace('_Text', ''))
|
|
6309
6474
|
: document.getElementById(this.treemap.element.id + '_Legend_Shape_Index_' + index);
|
|
6475
|
+
setColor(targetEle, selection.fill, selection.opacity, null, null);
|
|
6476
|
+
setColor(legendItem, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6310
6477
|
this.legendSelectId = legendItem.id;
|
|
6311
6478
|
this.shapeElement = legendItem;
|
|
6312
6479
|
}
|
|
6313
6480
|
else {
|
|
6314
6481
|
legendItem = this.treemap.legendSettings.mode === 'Interactive' ? document.getElementById(targetEle.id + '_Text')
|
|
6315
6482
|
: document.getElementById(this.treemap.element.id + '_Legend_Text_Index_' + index);
|
|
6483
|
+
setColor(legendItem, selection.fill, selection.opacity, null, null);
|
|
6484
|
+
setColor(targetEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6316
6485
|
this.legendSelectId = targetId;
|
|
6317
6486
|
this.shapeElement = targetEle;
|
|
6318
6487
|
}
|
|
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
6488
|
setColor(nodeEle, selection.fill, selection.opacity, selection.border.color, selection.border.width.toString());
|
|
6322
6489
|
treemap.levelSelection.push(nodeEle.id);
|
|
6323
6490
|
if (treemap.legendId.indexOf(legendItem.id) === -1) {
|
|
@@ -6334,6 +6501,7 @@ class TreeMapSelection {
|
|
|
6334
6501
|
}
|
|
6335
6502
|
else {
|
|
6336
6503
|
removeLegend(this.legendSelectionCollection, this.treemap);
|
|
6504
|
+
removeLegend(this.shapeSelectionCollection, this.treemap);
|
|
6337
6505
|
this.legendSelectionCollection = [];
|
|
6338
6506
|
if (highlightModule) {
|
|
6339
6507
|
highlightModule.shapeTarget = 'highlight';
|
|
@@ -6342,6 +6510,12 @@ class TreeMapSelection {
|
|
|
6342
6510
|
this.legendSelectId = '';
|
|
6343
6511
|
this.treemap.legendId = [];
|
|
6344
6512
|
this.treemap.levelSelection = [];
|
|
6513
|
+
this.shapeElement = null;
|
|
6514
|
+
this.shapeSelectId = '';
|
|
6515
|
+
if (this.legendSelect || this.shapeSelect) {
|
|
6516
|
+
removeClassNames(document.getElementsByClassName('treeMapSelection'), 'treeMapSelection', treemap);
|
|
6517
|
+
this.treemap.selectionId = '';
|
|
6518
|
+
}
|
|
6345
6519
|
}
|
|
6346
6520
|
}
|
|
6347
6521
|
else if (isDrillItem) {
|
|
@@ -6351,6 +6525,8 @@ class TreeMapSelection {
|
|
|
6351
6525
|
this.legendSelectId = '';
|
|
6352
6526
|
this.treemap.legendId = [];
|
|
6353
6527
|
this.treemap.levelSelection = [];
|
|
6528
|
+
this.treemap.selectionId = '';
|
|
6529
|
+
this.shapeElement = null;
|
|
6354
6530
|
}
|
|
6355
6531
|
}
|
|
6356
6532
|
/**
|
|
@@ -6538,7 +6714,7 @@ class TreeMapTooltip {
|
|
|
6538
6714
|
let toolTipData = {};
|
|
6539
6715
|
let tooltipContent = [];
|
|
6540
6716
|
let markerFill;
|
|
6541
|
-
if (targetId.indexOf('_Item_Index') > -1) {
|
|
6717
|
+
if (targetId.indexOf('_Item_Index') > -1 && e.type.indexOf('key') === -1) {
|
|
6542
6718
|
item = this.treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
6543
6719
|
if (!isNullOrUndefined(item)) {
|
|
6544
6720
|
value = item['weight'];
|
|
@@ -6707,6 +6883,8 @@ class TreeMapTooltip {
|
|
|
6707
6883
|
destroy() {
|
|
6708
6884
|
if (!isNullOrUndefined(this.svgTooltip)) {
|
|
6709
6885
|
this.svgTooltip.destroy();
|
|
6886
|
+
this.svgTooltip.controlInstance = null;
|
|
6887
|
+
removeElement(this.treemap.element.id + '_TreeMapTooltip');
|
|
6710
6888
|
}
|
|
6711
6889
|
this.svgTooltip = null;
|
|
6712
6890
|
this.tooltipSettings = null;
|