@syncfusion/ej2-treemap 20.3.56 → 20.4.38
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/.eslintrc.json +16 -1
- package/README.md +53 -41
- 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 +472 -192
- package/dist/es6/ej2-treemap.es2015.js.map +1 -1
- package/dist/es6/ej2-treemap.es5.js +495 -216
- 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 +25 -17
- package/src/treemap/layout/legend.d.ts +15 -0
- package/src/treemap/layout/legend.js +51 -46
- package/src/treemap/layout/render-panel.d.ts +2 -1
- package/src/treemap/layout/render-panel.js +25 -44
- package/src/treemap/model/image-export.d.ts +1 -0
- package/src/treemap/model/image-export.js +4 -2
- package/src/treemap/model/pdf-export.d.ts +1 -0
- package/src/treemap/model/pdf-export.js +5 -4
- package/src/treemap/model/print.d.ts +2 -0
- package/src/treemap/model/print.js +4 -1
- package/src/treemap/treemap-model.d.ts +19 -19
- package/src/treemap/treemap.d.ts +74 -47
- package/src/treemap/treemap.js +74 -59
- package/src/treemap/user-interaction/highlight-selection.d.ts +6 -1
- package/src/treemap/user-interaction/highlight-selection.js +22 -21
- package/src/treemap/user-interaction/tooltip.js +3 -5
- package/src/treemap/utils/helper.d.ts +281 -12
- package/src/treemap/utils/helper.js +308 -77
|
@@ -523,6 +523,12 @@ class Size {
|
|
|
523
523
|
this.height = height;
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
*
|
|
528
|
+
* @param {string} value - specifies the text.
|
|
529
|
+
* @param {number} containerSize - specifies the container size value.
|
|
530
|
+
* @returns {number} - Returns the number value which is converted from string.
|
|
531
|
+
*/
|
|
526
532
|
function stringToNumber(value, containerSize) {
|
|
527
533
|
if (value !== null && value !== undefined) {
|
|
528
534
|
return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);
|
|
@@ -577,7 +583,6 @@ class PathOption {
|
|
|
577
583
|
*
|
|
578
584
|
* @param {string} text - Specifies the text.
|
|
579
585
|
* @param {FontModel} font - Specifies the font.
|
|
580
|
-
* @param {string} id - Specifies the id.
|
|
581
586
|
* @returns {Size} - Returns the size.
|
|
582
587
|
* @private
|
|
583
588
|
*/
|
|
@@ -658,6 +663,12 @@ class Location {
|
|
|
658
663
|
}
|
|
659
664
|
/**
|
|
660
665
|
* Method to calculate x position of title
|
|
666
|
+
*
|
|
667
|
+
* @param {Rect} location - Specifies the location of text.
|
|
668
|
+
* @param {Alignment} alignment - Specifies the alignment of the text.
|
|
669
|
+
* @param {Size} textSize - Specifies the size of the text.
|
|
670
|
+
* @param {type} type - Specifies whether the provided text is title or subtitle.
|
|
671
|
+
* @returns {Location} - Returns the location of text.
|
|
661
672
|
*/
|
|
662
673
|
function findPosition(location, alignment, textSize, type) {
|
|
663
674
|
let x;
|
|
@@ -677,9 +688,14 @@ function findPosition(location, alignment, textSize, type) {
|
|
|
677
688
|
const y = (type === 'title') ? location.y + (textSize.height / 2) : ((location.y + location.height / 2) + textSize.height / 2);
|
|
678
689
|
return new Location(x, y);
|
|
679
690
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
renderer
|
|
691
|
+
/**
|
|
692
|
+
*
|
|
693
|
+
* @param {SvgRenderer} renderer - Specifies the rendering element of the SVG.
|
|
694
|
+
* @param {any} renderOptions - Specifies the settings of the text.
|
|
695
|
+
* @param {string} text - Specifies the text.
|
|
696
|
+
* @returns {HTMLElement} - Returns the HTML element for the text.
|
|
697
|
+
*/
|
|
698
|
+
function createTextStyle(renderer, renderOptions, text) {
|
|
683
699
|
const htmlObject = renderer.createText(renderOptions, text);
|
|
684
700
|
htmlObject.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
|
685
701
|
htmlObject.style['user-select'] = 'none';
|
|
@@ -697,13 +713,12 @@ renderer, renderOptions, text) {
|
|
|
697
713
|
* @param {TextOption} options - Specifies the text option
|
|
698
714
|
* @param {FontModel} font - Specifies the font model
|
|
699
715
|
* @param {string} color - Specifies the color
|
|
700
|
-
* @param {HTMLElement | Element} parent -
|
|
716
|
+
* @param {HTMLElement | Element} parent - Specifies the parent element of the text
|
|
701
717
|
* @param {boolean} isMinus - Specifies the boolean value
|
|
702
718
|
* @returns {Element} - Returns the element
|
|
703
719
|
* @private
|
|
704
720
|
*/
|
|
705
721
|
function renderTextElement(options, font, color, parent, isMinus = false) {
|
|
706
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
707
722
|
const renderOptions = {
|
|
708
723
|
'font-size': font.size,
|
|
709
724
|
'font-style': font.fontStyle,
|
|
@@ -730,7 +745,8 @@ function renderTextElement(options, font, color, parent, isMinus = false) {
|
|
|
730
745
|
const spacing = 5;
|
|
731
746
|
const drillLevelText = drilledLabel.split('#');
|
|
732
747
|
for (let z = 0; z < drillLevelText.length; z++) {
|
|
733
|
-
let drillText = (drillLevelText[z].search(options.connectorText) !== -1 &&
|
|
748
|
+
let drillText = (drillLevelText[z].search(options.connectorText) !== -1 &&
|
|
749
|
+
!isNullOrUndefined(options.connectorText)) ?
|
|
734
750
|
options.connectorText : drillLevelText[z];
|
|
735
751
|
renderOptions['id'] = options.id + '_' + z;
|
|
736
752
|
htmlObject = createTextStyle(renderer, renderOptions, drillText);
|
|
@@ -760,6 +776,13 @@ function renderTextElement(options, font, color, parent, isMinus = false) {
|
|
|
760
776
|
}
|
|
761
777
|
return htmlObject;
|
|
762
778
|
}
|
|
779
|
+
/**
|
|
780
|
+
*
|
|
781
|
+
* @param {string} targetId - Specifies the id of the element to which template is to be appended.
|
|
782
|
+
* @param {Element} targetElement - Specifies the element to which template is to be appended.
|
|
783
|
+
* @param {string} contentItemTemplate - Specifies the content to be appended as template.
|
|
784
|
+
* @returns {void}
|
|
785
|
+
*/
|
|
763
786
|
function setItemTemplateContent(targetId, targetElement, contentItemTemplate) {
|
|
764
787
|
const itemSelect = targetId.split('_RectPath')[0];
|
|
765
788
|
let itemTemplate;
|
|
@@ -773,21 +796,39 @@ function setItemTemplateContent(targetId, targetElement, contentItemTemplate) {
|
|
|
773
796
|
itemTemplate.innerHTML = contentItemTemplate;
|
|
774
797
|
}
|
|
775
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
*
|
|
801
|
+
* @param {string} id - Specifies the id of the element.
|
|
802
|
+
* @returns {Element} - Returns the element.
|
|
803
|
+
*/
|
|
776
804
|
function getElement(id) {
|
|
777
805
|
return document.getElementById(id);
|
|
778
806
|
}
|
|
779
|
-
|
|
807
|
+
/**
|
|
808
|
+
*
|
|
809
|
+
* @param {any} a - Specifies the first order of TreeMap leaf elements.
|
|
810
|
+
* @param {any} b - Specifies the second order of TreeMap leaf elements.
|
|
811
|
+
* @returns {number} - Returns the order of the TreeMap leaf element.
|
|
812
|
+
*/
|
|
780
813
|
function itemsToOrder(a, b) {
|
|
781
814
|
return a['weight'] === b['weight'] ? 0 : a['weight'] < b['weight'] ? 1 : -1;
|
|
782
815
|
}
|
|
783
|
-
|
|
816
|
+
/**
|
|
817
|
+
*
|
|
818
|
+
* @param {string[]} source - Specifies the data from the data source.
|
|
819
|
+
* @param {string} pathName - Specifies the path name in the data source.
|
|
820
|
+
* @param {any} processData - Specifies the data source object.
|
|
821
|
+
* @param {TreeMap} treemap - Specifies the treemap instance.
|
|
822
|
+
* @returns {boolean} - Specifies whether data is available in the data source or not.
|
|
823
|
+
*/
|
|
784
824
|
function isContainsData(source, pathName, processData, treemap) {
|
|
785
825
|
let isExist = false;
|
|
786
826
|
let name = '';
|
|
787
827
|
let path;
|
|
788
828
|
const leaf = treemap.leafItemSettings;
|
|
789
829
|
for (let i = 0; i < source.length; i++) {
|
|
790
|
-
path = treemap.levels[i] ? treemap.levels[i].groupPath : leaf.labelPath ? leaf.labelPath :
|
|
830
|
+
path = treemap.levels[i] ? treemap.levels[i].groupPath : leaf.labelPath ? leaf.labelPath :
|
|
831
|
+
treemap.weightValuePath;
|
|
791
832
|
const data = processData[path] || 'undefined';
|
|
792
833
|
if (source[i] === data) {
|
|
793
834
|
name += data + (i === source.length - 1 ? '' : '#');
|
|
@@ -799,9 +840,12 @@ function isContainsData(source, pathName, processData, treemap) {
|
|
|
799
840
|
}
|
|
800
841
|
return isExist;
|
|
801
842
|
}
|
|
802
|
-
|
|
843
|
+
/**
|
|
844
|
+
*
|
|
845
|
+
* @param {any} data - Specifies the data to which the children elements to be found.
|
|
846
|
+
* @returns {any} - Returns the children elements of the TreeMap leaf element.
|
|
847
|
+
*/
|
|
803
848
|
function findChildren(data) {
|
|
804
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
805
849
|
let children;
|
|
806
850
|
if (data) {
|
|
807
851
|
const keys = Object.keys(data);
|
|
@@ -816,11 +860,17 @@ function findChildren(data) {
|
|
|
816
860
|
}
|
|
817
861
|
return children;
|
|
818
862
|
}
|
|
819
|
-
|
|
863
|
+
/**
|
|
864
|
+
*
|
|
865
|
+
* @param {any} data - Specifies the data to which highlight must be done.
|
|
866
|
+
* @param {items} items - Specifies the data source items.
|
|
867
|
+
* @param {string} mode - Specifies the mode of highlight.
|
|
868
|
+
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
869
|
+
* @returns {string[]} - Returns the highlighted items.
|
|
870
|
+
*/
|
|
820
871
|
function findHightLightItems(data, items, mode, treeMap) {
|
|
821
872
|
if (mode === 'Child') {
|
|
822
873
|
items.push(data['levelOrderName']);
|
|
823
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
824
874
|
const children = findChildren(data)['values'];
|
|
825
875
|
if (children && children.length > 0) {
|
|
826
876
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -841,7 +891,6 @@ function findHightLightItems(data, items, mode, treeMap) {
|
|
|
841
891
|
}
|
|
842
892
|
else if (mode === 'All') {
|
|
843
893
|
const parentName = data['levelOrderName'].split('#')[0];
|
|
844
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
845
894
|
let currentItem;
|
|
846
895
|
for (let i = 0; i < treeMap.layout.renderItems.length; i++) {
|
|
847
896
|
currentItem = treeMap.layout.renderItems[i];
|
|
@@ -862,11 +911,8 @@ function findHightLightItems(data, items, mode, treeMap) {
|
|
|
862
911
|
* @returns {Function} - Returns the template function
|
|
863
912
|
* @private
|
|
864
913
|
*/
|
|
865
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
866
914
|
function getTemplateFunction(template) {
|
|
867
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
868
915
|
let templateFn = null;
|
|
869
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
870
916
|
try {
|
|
871
917
|
if (document.querySelectorAll(template).length) {
|
|
872
918
|
templateFn = compile(document.querySelector(template).innerHTML.trim());
|
|
@@ -884,31 +930,38 @@ function getTemplateFunction(template) {
|
|
|
884
930
|
* @param {Object} data - Specifies the data
|
|
885
931
|
* @returns {HTMLElement} - Returns the element
|
|
886
932
|
*/
|
|
887
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
888
933
|
function convertElement(element, labelId, data) {
|
|
889
934
|
const childElement = createElement('div', {
|
|
890
|
-
id: labelId
|
|
891
|
-
styles: 'position: absolute;pointer-events: auto;'
|
|
935
|
+
id: labelId
|
|
892
936
|
});
|
|
937
|
+
childElement.style.cssText = 'position: absolute;pointer-events: auto;';
|
|
893
938
|
let elementLength = element.length;
|
|
894
939
|
while (elementLength > 0) {
|
|
895
940
|
childElement.appendChild(element[0]);
|
|
896
941
|
elementLength--;
|
|
897
942
|
}
|
|
898
943
|
let templateHtml = childElement.innerHTML;
|
|
899
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
900
944
|
const keys = Object.keys(data);
|
|
901
945
|
for (let i = 0; i < keys.length; i++) {
|
|
902
|
-
|
|
946
|
+
const regExp = RegExp;
|
|
947
|
+
templateHtml = templateHtml.replace(new regExp('{{:' + keys[i] + '}}', 'g'), data[keys[i].toString()]);
|
|
903
948
|
}
|
|
904
949
|
childElement.innerHTML = templateHtml;
|
|
905
950
|
return childElement;
|
|
906
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
*
|
|
954
|
+
* @param {Rect} rect - Specifies the area.
|
|
955
|
+
* @param {LabelPosition} position - Specifies the position
|
|
956
|
+
* @param {Size} labelSize - Specifies the label size.
|
|
957
|
+
* @param {string} type - Specifies the type.
|
|
958
|
+
* @param {TreeMap} treemap - Specifies the treemap instance.
|
|
959
|
+
* @returns {Location} - Returns the text location.
|
|
960
|
+
*/
|
|
907
961
|
function findLabelLocation(rect, position, labelSize, type, treemap) {
|
|
908
962
|
const location = new Location(0, 0);
|
|
909
963
|
const padding = 5;
|
|
910
964
|
const paddings = 2;
|
|
911
|
-
const elementRect = treemap.element.getBoundingClientRect();
|
|
912
965
|
const x = (type === 'Template') ? treemap.areaRect.x : 0;
|
|
913
966
|
const y = (type === 'Template') ? treemap.areaRect.y : 0;
|
|
914
967
|
location.x = (Math.abs(x - ((position.indexOf('Left') > -1) ? rect.x + padding : !(position.indexOf('Right') > -1) ?
|
|
@@ -924,6 +977,12 @@ function findLabelLocation(rect, position, labelSize, type, treemap) {
|
|
|
924
977
|
}
|
|
925
978
|
return location;
|
|
926
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
*
|
|
982
|
+
* @param {HTMLElement} element - Specifies the element to be measured.
|
|
983
|
+
* @param {HTMLElement} parentElement - Specifies the parent element of the element to be measured.
|
|
984
|
+
* @returns {Size} - Returns the element size.
|
|
985
|
+
*/
|
|
927
986
|
function measureElement(element, parentElement) {
|
|
928
987
|
const size = new Size(0, 0);
|
|
929
988
|
parentElement.appendChild(element);
|
|
@@ -933,9 +992,19 @@ function measureElement(element, parentElement) {
|
|
|
933
992
|
measureElementId.parentNode.removeChild(measureElementId);
|
|
934
993
|
return size;
|
|
935
994
|
}
|
|
995
|
+
/**
|
|
996
|
+
*
|
|
997
|
+
* @param {Rect} rect - Specifies the area.
|
|
998
|
+
* @returns {number} - Returns the area width.
|
|
999
|
+
*/
|
|
936
1000
|
function getArea(rect) {
|
|
937
1001
|
return (rect.width - rect.x) * (rect.height - rect.y);
|
|
938
1002
|
}
|
|
1003
|
+
/**
|
|
1004
|
+
*
|
|
1005
|
+
* @param {Rect} input - Specifies input for the calculation.
|
|
1006
|
+
* @returns {number} - Returns the shortest edge.
|
|
1007
|
+
*/
|
|
939
1008
|
function getShortestEdge(input) {
|
|
940
1009
|
const container = convertToContainer(input);
|
|
941
1010
|
const width = container.width;
|
|
@@ -943,6 +1012,11 @@ function getShortestEdge(input) {
|
|
|
943
1012
|
const result = Math.min(width, height);
|
|
944
1013
|
return result;
|
|
945
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
*
|
|
1017
|
+
* @param {Rect} rect - Specifies the rectangle bounds of the container.
|
|
1018
|
+
* @returns {Rect} - Returns the rectangle bounds.
|
|
1019
|
+
*/
|
|
946
1020
|
function convertToContainer(rect) {
|
|
947
1021
|
const x = rect.x;
|
|
948
1022
|
const y = rect.y;
|
|
@@ -955,6 +1029,11 @@ function convertToContainer(rect) {
|
|
|
955
1029
|
height: height - y
|
|
956
1030
|
};
|
|
957
1031
|
}
|
|
1032
|
+
/**
|
|
1033
|
+
*
|
|
1034
|
+
* @param {Rect} container - Specifies the rectangle bounds of the container.
|
|
1035
|
+
* @returns {Rect} - Returns the rectangle bounds.
|
|
1036
|
+
*/
|
|
958
1037
|
function convertToRect(container) {
|
|
959
1038
|
const xOffset = container.x;
|
|
960
1039
|
const yOffset = container.y;
|
|
@@ -967,6 +1046,13 @@ function convertToRect(container) {
|
|
|
967
1046
|
height: yOffset + height
|
|
968
1047
|
};
|
|
969
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
*
|
|
1051
|
+
* @param {number} pageX - Specifies the horizontal position of the mouse location.
|
|
1052
|
+
* @param {number} pageY - Specifies the vertical position of the mouse location.
|
|
1053
|
+
* @param {Element} element - Specifies the element to which the click is done.
|
|
1054
|
+
* @returns {Location} - Returns the clicked location.
|
|
1055
|
+
*/
|
|
970
1056
|
function getMousePosition(pageX, pageY, element) {
|
|
971
1057
|
const elementRect = element.getBoundingClientRect();
|
|
972
1058
|
const pageXOffset = element.ownerDocument.defaultView.pageXOffset;
|
|
@@ -977,9 +1063,15 @@ function getMousePosition(pageX, pageY, element) {
|
|
|
977
1063
|
const positionY = elementRect.top + pageYOffset - clientTop;
|
|
978
1064
|
return new Location((pageX - positionX), (pageY - positionY));
|
|
979
1065
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
*
|
|
1068
|
+
* @param {ColorMappingModel[]} colorMapping - Specifies the color mapping instance.
|
|
1069
|
+
* @param {string} equalValue - Specifies the equal value.
|
|
1070
|
+
* @param {number | string} value - Specifies the range value.
|
|
1071
|
+
* @returns {any} - Returns the color mapping object.
|
|
1072
|
+
* @private
|
|
1073
|
+
*/
|
|
1074
|
+
function colorMap(colorMapping, equalValue, value) {
|
|
983
1075
|
let fill;
|
|
984
1076
|
const paths = [];
|
|
985
1077
|
let opacity;
|
|
@@ -991,7 +1083,8 @@ value, weightValuePath) {
|
|
|
991
1083
|
const dataValue = value;
|
|
992
1084
|
if (!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to)
|
|
993
1085
|
&& !isNullOrUndefined(colorMapping[i].value)) {
|
|
994
|
-
if ((value >= colorMapping[i].from && colorMapping[i].to >= value) &&
|
|
1086
|
+
if ((value >= colorMapping[i].from && colorMapping[i].to >= value) &&
|
|
1087
|
+
(colorMapping[i].value === equalValue)) {
|
|
995
1088
|
isEqualColor = true;
|
|
996
1089
|
if (Object.prototype.toString.call(colorMapping[i].color) === '[object Array]') {
|
|
997
1090
|
fill = !isEqualColor ? colorCollections(colorMapping[i], dataValue) : colorMapping[i].color[0];
|
|
@@ -1003,7 +1096,8 @@ value, weightValuePath) {
|
|
|
1003
1096
|
}
|
|
1004
1097
|
else if ((!isNullOrUndefined(colorMapping[i].from) && !isNullOrUndefined(colorMapping[i].to))
|
|
1005
1098
|
|| !isNullOrUndefined((colorMapping[i].value))) {
|
|
1006
|
-
if ((value >= colorMapping[i].from && colorMapping[i].to >= value)
|
|
1099
|
+
if ((value >= colorMapping[i].from && colorMapping[i].to >= value)
|
|
1100
|
+
|| (colorMapping[i].value === equalValue)) {
|
|
1007
1101
|
if (colorMapping[i].value === equalValue) {
|
|
1008
1102
|
isEqualColor = true;
|
|
1009
1103
|
}
|
|
@@ -1015,9 +1109,11 @@ value, weightValuePath) {
|
|
|
1015
1109
|
}
|
|
1016
1110
|
}
|
|
1017
1111
|
}
|
|
1018
|
-
if (((value >= colorMapping[i].from && value <= colorMapping[i].to)
|
|
1019
|
-
|
|
1020
|
-
|
|
1112
|
+
if (((value >= colorMapping[i].from && value <= colorMapping[i].to)
|
|
1113
|
+
|| (colorMapping[i].value === equalValue))
|
|
1114
|
+
&& !isNullOrUndefined(colorMapping[i].minOpacity) && !isNullOrUndefined(colorMapping[i].maxOpacity)
|
|
1115
|
+
&& fill) {
|
|
1116
|
+
opacity = deSaturationColor(colorMapping[i], value);
|
|
1021
1117
|
}
|
|
1022
1118
|
if ((fill === '' || isNullOrUndefined(fill))
|
|
1023
1119
|
&& isNullOrUndefined(colorMapping[i].from) && isNullOrUndefined(colorMapping[i].to)
|
|
@@ -1035,7 +1131,14 @@ value, weightValuePath) {
|
|
|
1035
1131
|
}
|
|
1036
1132
|
return { fill: fill, opacity: opacity };
|
|
1037
1133
|
}
|
|
1038
|
-
|
|
1134
|
+
/**
|
|
1135
|
+
*
|
|
1136
|
+
* @param {ColorMappingModel} colorMapping - Specifies the color mapping object.
|
|
1137
|
+
* @param {number} rangeValue - Specifies the range value.
|
|
1138
|
+
* @returns {string} - Returns the opacity for the color mapping.
|
|
1139
|
+
* @private
|
|
1140
|
+
*/
|
|
1141
|
+
function deSaturationColor(colorMapping, rangeValue) {
|
|
1039
1142
|
let opacity = 1;
|
|
1040
1143
|
if ((rangeValue >= colorMapping.from && rangeValue <= colorMapping.to)) {
|
|
1041
1144
|
const ratio = (rangeValue - colorMapping.from) / (colorMapping.to - colorMapping.from);
|
|
@@ -1043,13 +1146,32 @@ function deSaturationColor(weightValuePath, colorMapping, color, rangeValue) {
|
|
|
1043
1146
|
}
|
|
1044
1147
|
return opacity.toString();
|
|
1045
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
*
|
|
1151
|
+
* @param {ColorMappingModel} colorMap - Specifies the color mapping object.
|
|
1152
|
+
* @param {number} value - Specifies the range value.
|
|
1153
|
+
* @returns {string} - Returns the fill color.
|
|
1154
|
+
*/
|
|
1046
1155
|
function colorCollections(colorMap, value) {
|
|
1047
1156
|
const gradientFill = getColorByValue(colorMap, value);
|
|
1048
1157
|
return gradientFill;
|
|
1049
1158
|
}
|
|
1159
|
+
/**
|
|
1160
|
+
*
|
|
1161
|
+
* @param {number} r - Specifies the red color value.
|
|
1162
|
+
* @param {number} g - Specifies the green color value.
|
|
1163
|
+
* @param {number} b - Specifies the blue color value.
|
|
1164
|
+
* @returns {string} - Returns the fill color.
|
|
1165
|
+
*/
|
|
1050
1166
|
function rgbToHex(r, g, b) {
|
|
1051
1167
|
return '#' + componentToHex(r) + componentToHex(g) + componentToHex(b);
|
|
1052
1168
|
}
|
|
1169
|
+
/**
|
|
1170
|
+
*
|
|
1171
|
+
* @param {ColorMappingModel} colorMap - Specifies the color mapping.
|
|
1172
|
+
* @param {number} value - Specifies the range value.
|
|
1173
|
+
* @returns {string} - Returns the fill color.
|
|
1174
|
+
*/
|
|
1053
1175
|
function getColorByValue(colorMap, value) {
|
|
1054
1176
|
let color = '';
|
|
1055
1177
|
let rbg;
|
|
@@ -1065,6 +1187,12 @@ function getColorByValue(colorMap, value) {
|
|
|
1065
1187
|
}
|
|
1066
1188
|
return color;
|
|
1067
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
*
|
|
1192
|
+
* @param {number} value - Specifies the range value.
|
|
1193
|
+
* @param {ColorMappingModel} colorMap - Specifies the color mapping.
|
|
1194
|
+
* @returns {ColorValue} - Returns the color value object.
|
|
1195
|
+
*/
|
|
1068
1196
|
function getGradientColor(value, colorMap) {
|
|
1069
1197
|
const previousOffset = colorMap.from;
|
|
1070
1198
|
const nextOffset = colorMap.to;
|
|
@@ -1087,7 +1215,6 @@ function getGradientColor(value, colorMap) {
|
|
|
1087
1215
|
let b;
|
|
1088
1216
|
let c;
|
|
1089
1217
|
const length = colorMap.color.length - 1;
|
|
1090
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1091
1218
|
const splitColorValueOffset = [];
|
|
1092
1219
|
let splitColor = {};
|
|
1093
1220
|
for (let j = 1; j < length; j++) {
|
|
@@ -1125,6 +1252,13 @@ function getGradientColor(value, colorMap) {
|
|
|
1125
1252
|
}
|
|
1126
1253
|
return getPercentageColor(percent, previousColor, nextColor);
|
|
1127
1254
|
}
|
|
1255
|
+
/**
|
|
1256
|
+
*
|
|
1257
|
+
* @param {number} percent - Specifies the percentage of the color.
|
|
1258
|
+
* @param {number} previous - Specifies the previous color.
|
|
1259
|
+
* @param {number} next - Specifies the next color.
|
|
1260
|
+
* @returns {ColorValue} - Returns the color value object.
|
|
1261
|
+
*/
|
|
1128
1262
|
function getPercentageColor(percent, previous, next) {
|
|
1129
1263
|
const nextColor = next.split('#')[1];
|
|
1130
1264
|
const prevColor = previous.split('#')[1];
|
|
@@ -1133,10 +1267,24 @@ function getPercentageColor(percent, previous, next) {
|
|
|
1133
1267
|
const b = getPercentage(percent, parseInt(prevColor.substr(4, 2), 16), parseInt(nextColor.substr(4, 2), 16));
|
|
1134
1268
|
return new ColorValue(r, g, b);
|
|
1135
1269
|
}
|
|
1270
|
+
/**
|
|
1271
|
+
*
|
|
1272
|
+
* @param {number} percent - Specifies the percentage of the color.
|
|
1273
|
+
* @param {number} previous - Specifies the previous color.
|
|
1274
|
+
* @param {number} next - Specifies the next color.
|
|
1275
|
+
* @returns {number} - Returns the color value.
|
|
1276
|
+
*/
|
|
1136
1277
|
function getPercentage(percent, previous, next) {
|
|
1137
1278
|
const full = next - previous;
|
|
1138
1279
|
return Math.round((previous + (full * percent)));
|
|
1139
1280
|
}
|
|
1281
|
+
/**
|
|
1282
|
+
*
|
|
1283
|
+
* @param {number} maximumWidth - Specifies the length of the text.
|
|
1284
|
+
* @param {string} dataLabel - Specifies the label.
|
|
1285
|
+
* @param {FontModel} font - Specifies the font of the label.
|
|
1286
|
+
* @returns {string[]} - Returns the labels.
|
|
1287
|
+
*/
|
|
1140
1288
|
function wordWrap(maximumWidth, dataLabel, font) {
|
|
1141
1289
|
const textCollection = dataLabel.split(' ');
|
|
1142
1290
|
let label = '';
|
|
@@ -1163,6 +1311,13 @@ function wordWrap(maximumWidth, dataLabel, font) {
|
|
|
1163
1311
|
}
|
|
1164
1312
|
return labelCollection;
|
|
1165
1313
|
}
|
|
1314
|
+
/**
|
|
1315
|
+
*
|
|
1316
|
+
* @param {number} maxWidth - Specifies the length of the text.
|
|
1317
|
+
* @param {string} label - Specifies the label.
|
|
1318
|
+
* @param {FontModel} font - Specifies the font of the label.
|
|
1319
|
+
* @returns {string[]} - Returns the labels.
|
|
1320
|
+
*/
|
|
1166
1321
|
function textWrap(maxWidth, label, font) {
|
|
1167
1322
|
const resultText = [];
|
|
1168
1323
|
let currentLength = 0;
|
|
@@ -1191,11 +1346,11 @@ function textWrap(maxWidth, label, font) {
|
|
|
1191
1346
|
/**
|
|
1192
1347
|
* hide function
|
|
1193
1348
|
*
|
|
1194
|
-
* @param {number} maxWidth - Specifies the maximum width
|
|
1195
|
-
* @param {number} maxHeight - Specifies the maximum height
|
|
1196
|
-
* @param {string} text - Specifies the text
|
|
1197
|
-
* @param {FontModel} font - Specifies the font
|
|
1198
|
-
* @returns {string} - Returns the
|
|
1349
|
+
* @param {number} maxWidth - Specifies the maximum width.
|
|
1350
|
+
* @param {number} maxHeight - Specifies the maximum height.
|
|
1351
|
+
* @param {string} text - Specifies the text.
|
|
1352
|
+
* @param {FontModel} font - Specifies the font.
|
|
1353
|
+
* @returns {string} - Returns the hidden text.
|
|
1199
1354
|
*/
|
|
1200
1355
|
function hide(maxWidth, maxHeight, text, font) {
|
|
1201
1356
|
let hideText = text;
|
|
@@ -1203,6 +1358,12 @@ function hide(maxWidth, maxHeight, text, font) {
|
|
|
1203
1358
|
hideText = (textSize.width > maxWidth || textSize.height > maxHeight) ? ' ' : text;
|
|
1204
1359
|
return hideText;
|
|
1205
1360
|
}
|
|
1361
|
+
/**
|
|
1362
|
+
*
|
|
1363
|
+
* @param {number} a - Specifies the first value of the leaf.
|
|
1364
|
+
* @param {number} b - Specifies the second value of the leaf.
|
|
1365
|
+
* @returns {number} - Returns whether values are equal or not.
|
|
1366
|
+
*/
|
|
1206
1367
|
function orderByArea(a, b) {
|
|
1207
1368
|
if (a['itemArea'] === b['itemArea']) {
|
|
1208
1369
|
return 0;
|
|
@@ -1212,6 +1373,13 @@ function orderByArea(a, b) {
|
|
|
1212
1373
|
}
|
|
1213
1374
|
return -1;
|
|
1214
1375
|
}
|
|
1376
|
+
/**
|
|
1377
|
+
*
|
|
1378
|
+
* @param {TreeMap} treemap - Specifies the treemap instance.
|
|
1379
|
+
* @param {Element} element - Specifies the selected TreeMap leaf item.
|
|
1380
|
+
* @param {string} className -Specifies the selected class name.
|
|
1381
|
+
* @returns {void}
|
|
1382
|
+
*/
|
|
1215
1383
|
function maintainSelection(treemap, element, className) {
|
|
1216
1384
|
const elementId = treemap.levelSelection;
|
|
1217
1385
|
if (elementId) {
|
|
@@ -1231,21 +1399,35 @@ function maintainSelection(treemap, element, className) {
|
|
|
1231
1399
|
}
|
|
1232
1400
|
}
|
|
1233
1401
|
}
|
|
1402
|
+
/**
|
|
1403
|
+
*
|
|
1404
|
+
* @param {TreeMap} treemap - Specifies the treemap instance.
|
|
1405
|
+
* @param {Element} legendGroup - Specifies the selected element.
|
|
1406
|
+
* @returns {void}
|
|
1407
|
+
*/
|
|
1234
1408
|
function legendMaintain(treemap, legendGroup) {
|
|
1235
1409
|
const elementId = treemap.legendId;
|
|
1236
1410
|
if (elementId) {
|
|
1237
1411
|
for (let i = 0; i < elementId.length; i++) {
|
|
1238
1412
|
for (let j = 0; j < legendGroup.childElementCount; j++) {
|
|
1239
1413
|
if (legendGroup.childNodes[j]['id'] === elementId[i]) {
|
|
1240
|
-
legendGroup.childNodes[j]
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1414
|
+
const treemapSVGRectElement = legendGroup.childNodes[j];
|
|
1415
|
+
treemapSVGRectElement.setAttribute('fill', treemap.selectionSettings.fill);
|
|
1416
|
+
treemapSVGRectElement.setAttribute('stroke', treemap.selectionSettings.border.color);
|
|
1417
|
+
treemapSVGRectElement.setAttribute('stroke-width', (treemap.selectionSettings.border.width).toString());
|
|
1418
|
+
treemapSVGRectElement.setAttribute('opacity', treemap.selectionSettings.opacity);
|
|
1244
1419
|
}
|
|
1245
1420
|
}
|
|
1246
1421
|
}
|
|
1247
1422
|
}
|
|
1248
1423
|
}
|
|
1424
|
+
/**
|
|
1425
|
+
*
|
|
1426
|
+
* @param {HTMLCollection} elements - Specifies the selected TreeMap element.
|
|
1427
|
+
* @param {string} type - Specifies the selection type.
|
|
1428
|
+
* @param {TreeMap} treemap - Specifies the TreeMap instance.
|
|
1429
|
+
* @returns {void}
|
|
1430
|
+
*/
|
|
1249
1431
|
function removeClassNames(elements, type, treemap) {
|
|
1250
1432
|
let element;
|
|
1251
1433
|
let options = {};
|
|
@@ -1258,7 +1440,12 @@ function removeClassNames(elements, type, treemap) {
|
|
|
1258
1440
|
j -= 1;
|
|
1259
1441
|
}
|
|
1260
1442
|
}
|
|
1261
|
-
|
|
1443
|
+
/**
|
|
1444
|
+
*
|
|
1445
|
+
* @param {SVGPathElement} element - Specifies the SVG path element.
|
|
1446
|
+
* @param {any} options - Specifies the settings for the SVG path element.
|
|
1447
|
+
* @returns {void}
|
|
1448
|
+
*/
|
|
1262
1449
|
function applyOptions(element, options) {
|
|
1263
1450
|
element.setAttribute('opacity', options['opacity']);
|
|
1264
1451
|
if (!isNullOrUndefined(options['fill'])) {
|
|
@@ -1267,7 +1454,13 @@ function applyOptions(element, options) {
|
|
|
1267
1454
|
element.setAttribute('stroke', options['border']['color']);
|
|
1268
1455
|
element.setAttribute('stroke-width', options['border']['width']);
|
|
1269
1456
|
}
|
|
1270
|
-
|
|
1457
|
+
/**
|
|
1458
|
+
*
|
|
1459
|
+
* @param {string} format - Specifies the format value.
|
|
1460
|
+
* @param {any} data - Specifies the data source object.
|
|
1461
|
+
* @param {TreeMap} treemap - Specifies the TreeMap instance.
|
|
1462
|
+
* @returns {string} - Returns the formatted text.
|
|
1463
|
+
*/
|
|
1271
1464
|
function textFormatter(format, data, treemap) {
|
|
1272
1465
|
if (isNullOrUndefined(format)) {
|
|
1273
1466
|
return null;
|
|
@@ -1278,8 +1471,13 @@ function textFormatter(format, data, treemap) {
|
|
|
1278
1471
|
}
|
|
1279
1472
|
return format;
|
|
1280
1473
|
}
|
|
1474
|
+
/**
|
|
1475
|
+
*
|
|
1476
|
+
* @param {number} value - Specifies the text to be formatted.
|
|
1477
|
+
* @param {TreeMap} treemap - Specifies the TreeMap instance.
|
|
1478
|
+
* @returns {string | number} - Returns the formatted text.
|
|
1479
|
+
*/
|
|
1281
1480
|
function formatValue(value, treemap) {
|
|
1282
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1283
1481
|
let formatValue;
|
|
1284
1482
|
let formatFunction;
|
|
1285
1483
|
if (treemap.format && !isNaN(Number(value))) {
|
|
@@ -1310,7 +1508,7 @@ function convertToHexCode(value) {
|
|
|
1310
1508
|
return '#' + componentToHex(value.r) + componentToHex(value.g) + componentToHex(value.b);
|
|
1311
1509
|
}
|
|
1312
1510
|
/**
|
|
1313
|
-
* @param {number} value -
|
|
1511
|
+
* @param {number} value - Specifies the value
|
|
1314
1512
|
* @returns {string} - Returns the string
|
|
1315
1513
|
* @private */
|
|
1316
1514
|
function componentToHex(value) {
|
|
@@ -1337,9 +1535,8 @@ function colorNameToHex(color) {
|
|
|
1337
1535
|
const element = document.getElementById('treeMapMeasureText');
|
|
1338
1536
|
element.style.color = color;
|
|
1339
1537
|
color = window.getComputedStyle(element).color;
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1342
|
-
return convertToHexCode(new ColorValue(parseInt(isRGBValue[3], 10), parseInt(isRGBValue[4], 10), parseInt(isRGBValue[5], 10)));
|
|
1538
|
+
const isRGBValue = color.replace(/[()RGBrgba ]/g, '').split(',');
|
|
1539
|
+
return convertToHexCode(new ColorValue(parseInt(isRGBValue[0], 10), parseInt(isRGBValue[1], 10), parseInt(isRGBValue[2], 10)));
|
|
1343
1540
|
}
|
|
1344
1541
|
/**
|
|
1345
1542
|
* @param {Location} location - Specifies the location
|
|
@@ -1457,7 +1654,12 @@ function renderLegendShape(location, size, shape, options, url) {
|
|
|
1457
1654
|
}
|
|
1458
1655
|
return { renderOption: options, functionName: functionName };
|
|
1459
1656
|
}
|
|
1460
|
-
|
|
1657
|
+
/**
|
|
1658
|
+
*
|
|
1659
|
+
* @param {any} data - Specifies the data source object.
|
|
1660
|
+
* @param {any} item - Specifies the leaf item.
|
|
1661
|
+
* @returns {boolean} - Returns whether the TreeMap item is level item or leaf item.
|
|
1662
|
+
*/
|
|
1461
1663
|
function isParentItem(data, item) {
|
|
1462
1664
|
let isParentItem = false;
|
|
1463
1665
|
for (let j = 0; j < data.length; j++) {
|
|
@@ -1472,7 +1674,6 @@ function isParentItem(data, item) {
|
|
|
1472
1674
|
* Ajax support for treemap
|
|
1473
1675
|
*/
|
|
1474
1676
|
class TreeMapAjax {
|
|
1475
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1476
1677
|
constructor(options, type, async, contentType, sendData) {
|
|
1477
1678
|
this.dataOptions = options;
|
|
1478
1679
|
this.type = type || 'GET';
|
|
@@ -1481,21 +1682,29 @@ class TreeMapAjax {
|
|
|
1481
1682
|
this.sendData = sendData;
|
|
1482
1683
|
}
|
|
1483
1684
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1685
|
+
/**
|
|
1686
|
+
*
|
|
1687
|
+
* @param {any[]} collection - Specifies the legend collection.
|
|
1688
|
+
* @returns {void}
|
|
1689
|
+
* @private
|
|
1690
|
+
*/
|
|
1691
|
+
function removeShape(collection) {
|
|
1486
1692
|
if (collection.length > 0) {
|
|
1487
1693
|
for (let i = 0; i < collection.length; i++) {
|
|
1488
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1489
1694
|
const item = collection[i];
|
|
1490
1695
|
setColor(item['legendEle'], item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
|
|
1491
1696
|
}
|
|
1492
1697
|
}
|
|
1493
1698
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1699
|
+
/**
|
|
1700
|
+
*
|
|
1701
|
+
* @param {any[]} collection - Specifies the legend collection.
|
|
1702
|
+
* @returns {void}
|
|
1703
|
+
* @private
|
|
1704
|
+
*/
|
|
1705
|
+
function removeLegend(collection) {
|
|
1496
1706
|
if (collection.length > 0) {
|
|
1497
1707
|
for (let j = 0; j < collection.length; j++) {
|
|
1498
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1499
1708
|
const item = collection[j];
|
|
1500
1709
|
setColor(item['legendEle'], item['oldFill'], item['oldOpacity'], item['oldBorderColor'], item['oldBorderWidth']);
|
|
1501
1710
|
const dataCount = item['ShapeCollection']['Elements'].length;
|
|
@@ -1505,19 +1714,40 @@ function removeLegend(collection, value) {
|
|
|
1505
1714
|
}
|
|
1506
1715
|
}
|
|
1507
1716
|
}
|
|
1717
|
+
/**
|
|
1718
|
+
*
|
|
1719
|
+
* @param {Element} element - Specifies the selected element.
|
|
1720
|
+
* @param {string} fill - Specifies the fill color.
|
|
1721
|
+
* @param {string} opacity - Specifies the opacity.
|
|
1722
|
+
* @param {string} borderColor - Specifies the border color.
|
|
1723
|
+
* @param {string} borderWidth - Specifies the border width.
|
|
1724
|
+
* @returns {void}
|
|
1725
|
+
*/
|
|
1508
1726
|
function setColor(element, fill, opacity, borderColor, borderWidth) {
|
|
1509
1727
|
element.setAttribute('fill', fill);
|
|
1510
1728
|
element.setAttribute('opacity', opacity);
|
|
1511
1729
|
element.setAttribute('stroke', borderColor);
|
|
1512
1730
|
element.setAttribute('stroke-width', borderWidth);
|
|
1513
1731
|
}
|
|
1514
|
-
|
|
1732
|
+
/**
|
|
1733
|
+
*
|
|
1734
|
+
* @param {any[]} collection - Specifies the selected item collection.
|
|
1735
|
+
* @param {any[]} element - Specifies the selected element collection.
|
|
1736
|
+
* @param {TreeMap} treemap - Specifies the TreeMap instance.
|
|
1737
|
+
* @returns {void}
|
|
1738
|
+
*/
|
|
1515
1739
|
function removeSelectionWithHighlight(collection, element, treemap) {
|
|
1516
|
-
removeShape(collection
|
|
1740
|
+
removeShape(collection);
|
|
1517
1741
|
element = [];
|
|
1518
1742
|
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', treemap);
|
|
1519
1743
|
}
|
|
1520
|
-
|
|
1744
|
+
/**
|
|
1745
|
+
*
|
|
1746
|
+
* @param {number} length - Specifies the length of the legend group.
|
|
1747
|
+
* @param {any} item - Specifies the legend item.
|
|
1748
|
+
* @param {TreeMap} treemap - Specifies the TreeMap instance.
|
|
1749
|
+
* @returns {number} - Returns the legend index.
|
|
1750
|
+
*/
|
|
1521
1751
|
function getLegendIndex(length, item, treemap) {
|
|
1522
1752
|
let index;
|
|
1523
1753
|
for (let i = 0; i < length; i++) {
|
|
@@ -1531,11 +1761,18 @@ function getLegendIndex(length, item, treemap) {
|
|
|
1531
1761
|
}
|
|
1532
1762
|
return index;
|
|
1533
1763
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
collection
|
|
1537
|
-
|
|
1538
|
-
|
|
1764
|
+
/**
|
|
1765
|
+
*
|
|
1766
|
+
* @param {any[]} collection - Specifies the legend collection.
|
|
1767
|
+
* @param {number} index - Specifies the index of legend.
|
|
1768
|
+
* @param {number} number - Specifies the leaf item index.
|
|
1769
|
+
* @param {Element} legendElement - Specifies the legend element.
|
|
1770
|
+
* @param {Element} shapeElement - Specifies the shape element.
|
|
1771
|
+
* @param {any[]} renderItems - Specifies the item index.
|
|
1772
|
+
* @param {any[]} legendCollection - Specifies the legend collection.
|
|
1773
|
+
* @returns {void}
|
|
1774
|
+
*/
|
|
1775
|
+
function pushCollection(collection, index, number, legendElement, shapeElement, renderItems, legendCollection) {
|
|
1539
1776
|
collection.push({
|
|
1540
1777
|
legendEle: legendElement, oldFill: legendCollection[index]['legendFill'],
|
|
1541
1778
|
oldOpacity: legendCollection[index]['opacity'], oldBorderColor: legendCollection[index]['borderColor'],
|
|
@@ -1567,6 +1804,11 @@ function triggerDownload(fileName, type, url, isDownload) {
|
|
|
1567
1804
|
cancelable: true
|
|
1568
1805
|
}));
|
|
1569
1806
|
}
|
|
1807
|
+
/**
|
|
1808
|
+
*
|
|
1809
|
+
* @param {string} id - Specifies the id of the element to be removed.
|
|
1810
|
+
* @returns {void}
|
|
1811
|
+
*/
|
|
1570
1812
|
function removeElement(id) {
|
|
1571
1813
|
const element = document.getElementById(id);
|
|
1572
1814
|
return element ? remove(element) : null;
|
|
@@ -1576,7 +1818,6 @@ function removeElement(id) {
|
|
|
1576
1818
|
* To calculate and render the shape layer
|
|
1577
1819
|
*/
|
|
1578
1820
|
class LayoutPanel {
|
|
1579
|
-
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
|
|
1580
1821
|
constructor(treemap) {
|
|
1581
1822
|
this.treemap = treemap;
|
|
1582
1823
|
}
|
|
@@ -1609,7 +1850,7 @@ class LayoutPanel {
|
|
|
1609
1850
|
this.treemap.currentLevel = this.treemap.drilledItems[count]['data']['groupIndex'];
|
|
1610
1851
|
}
|
|
1611
1852
|
this.calculateLayoutItems(y || LevelsData.levelsData[0], totalRect);
|
|
1612
|
-
this.renderLayoutItems(
|
|
1853
|
+
this.renderLayoutItems();
|
|
1613
1854
|
}
|
|
1614
1855
|
else {
|
|
1615
1856
|
if (!isNullOrUndefined(this.treemap.initialDrillDown.groupIndex) &&
|
|
@@ -1618,7 +1859,7 @@ class LayoutPanel {
|
|
|
1618
1859
|
this.treemap.currentLevel = this.treemap.initialDrillDown.groupIndex;
|
|
1619
1860
|
}
|
|
1620
1861
|
this.calculateLayoutItems(data || LevelsData.levelsData[0], totalRect);
|
|
1621
|
-
this.renderLayoutItems(
|
|
1862
|
+
this.renderLayoutItems();
|
|
1622
1863
|
}
|
|
1623
1864
|
}
|
|
1624
1865
|
}
|
|
@@ -1644,7 +1885,7 @@ class LayoutPanel {
|
|
|
1644
1885
|
}
|
|
1645
1886
|
return drillData;
|
|
1646
1887
|
}
|
|
1647
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1888
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
1648
1889
|
calculateLayoutItems(data, rect) {
|
|
1649
1890
|
this.renderItems = [];
|
|
1650
1891
|
this.parentData = [];
|
|
@@ -1678,7 +1919,8 @@ class LayoutPanel {
|
|
|
1678
1919
|
isLeafItem = (groups.length === 0 || groupIndex === groups.length);
|
|
1679
1920
|
gap = isLeafItem ? leafItem.gap : groups[groupIndex].groupGap;
|
|
1680
1921
|
headerHeight = groups.length === 0 ? 0 : groups[groupIndex] ? groups[groupIndex].showHeader ?
|
|
1681
|
-
groups[groupIndex].headerHeight : 0 : groups[groupIndex - 1].showHeader ?
|
|
1922
|
+
groups[groupIndex].headerHeight : 0 : groups[groupIndex - 1].showHeader ?
|
|
1923
|
+
groups[groupIndex - 1].headerHeight : 0;
|
|
1682
1924
|
rect = children[i]['rect'];
|
|
1683
1925
|
rect = new Rect(rect.x + (gap / 2), rect.y + (headerHeight + (gap / 2)), rect.width - gap, Math.abs(rect.height - (gap + headerHeight)));
|
|
1684
1926
|
this.computeSliceAndDiceDimensional(children[i], rect);
|
|
@@ -1750,8 +1992,9 @@ class LayoutPanel {
|
|
|
1750
1992
|
rect = item['rect'];
|
|
1751
1993
|
padding = (item['isLeafItem'] ? leaf.padding : levels[index].groupPadding) / 2;
|
|
1752
1994
|
headerHeight = this.treemap.isHierarchicalData ? index === 0 && item['isLeafItem'] ? 0 : levels[index] ?
|
|
1753
|
-
levels[index].showHeader ? levels[index].headerHeight : 0 : 0 :
|
|
1754
|
-
levels
|
|
1995
|
+
levels[index].showHeader ? levels[index].headerHeight : 0 : 0 :
|
|
1996
|
+
(levels.length === 0) ? 0 : levels[index] ?
|
|
1997
|
+
levels[index].showHeader ? levels[index].headerHeight : 0 : 0;
|
|
1755
1998
|
rect = new Rect(rect.x + padding, rect.y + (headerHeight + padding), rect.width - padding, rect.height - padding);
|
|
1756
1999
|
if (!item['isLeafItem'] && item['weight'] > 0) {
|
|
1757
2000
|
this.computeSquarifyDimensional(child[i], rect);
|
|
@@ -1947,7 +2190,7 @@ class LayoutPanel {
|
|
|
1947
2190
|
}
|
|
1948
2191
|
return result;
|
|
1949
2192
|
}
|
|
1950
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2193
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
1951
2194
|
onDemandProcess(childItems) {
|
|
1952
2195
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1953
2196
|
let parentItem = {};
|
|
@@ -1977,13 +2220,12 @@ class LayoutPanel {
|
|
|
1977
2220
|
}
|
|
1978
2221
|
}
|
|
1979
2222
|
this.calculateLayoutItems(parentItemGroupname, totalRect);
|
|
1980
|
-
this.renderLayoutItems(
|
|
2223
|
+
this.renderLayoutItems();
|
|
1981
2224
|
}
|
|
1982
|
-
|
|
1983
|
-
renderLayoutItems(
|
|
2225
|
+
/** @private */
|
|
2226
|
+
renderLayoutItems() {
|
|
1984
2227
|
let position;
|
|
1985
2228
|
const treeMap = this.treemap;
|
|
1986
|
-
let colorMapping;
|
|
1987
2229
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1988
2230
|
let txtVisible;
|
|
1989
2231
|
let getItemColor;
|
|
@@ -2015,13 +2257,13 @@ class LayoutPanel {
|
|
|
2015
2257
|
let border;
|
|
2016
2258
|
const templateGroup = createElement('div', {
|
|
2017
2259
|
id: treeMap.element.id + '_Label_Template_Group',
|
|
2018
|
-
className: 'template'
|
|
2019
|
-
styles: 'overflow: hidden; position: absolute;pointer-events: none;' +
|
|
2020
|
-
'top:' + treeMap.areaRect.y + 'px;' +
|
|
2021
|
-
'left:' + treeMap.areaRect.x + 'px;' +
|
|
2022
|
-
'height:' + treeMap.areaRect.height + 'px;' +
|
|
2023
|
-
'width:' + treeMap.areaRect.width + 'px;'
|
|
2260
|
+
className: 'template'
|
|
2024
2261
|
});
|
|
2262
|
+
templateGroup.style.cssText = 'overflow: hidden; position: absolute;pointer-events: none;' +
|
|
2263
|
+
'top:' + treeMap.areaRect.y + 'px;' +
|
|
2264
|
+
'left:' + treeMap.areaRect.x + 'px;' +
|
|
2265
|
+
'height:' + treeMap.areaRect.height + 'px;' +
|
|
2266
|
+
'width:' + treeMap.areaRect.width + 'px;';
|
|
2025
2267
|
let isLeafItem = false;
|
|
2026
2268
|
const leaf = treeMap.leafItemSettings;
|
|
2027
2269
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2055,7 +2297,6 @@ class LayoutPanel {
|
|
|
2055
2297
|
rect.x = (treemapItemRect.x + treemapItemRect.width) - rect.width - Math.abs(treemapItemRect.x - rect.x);
|
|
2056
2298
|
rect.y = (treemapItemRect.y + treemapItemRect.height) - rect.height - Math.abs(treemapItemRect.y - rect.y);
|
|
2057
2299
|
}
|
|
2058
|
-
colorMapping = isLeafItem ? leaf.colorMapping : levels[index].colorMapping;
|
|
2059
2300
|
getItemColor = this.getItemColor(isLeafItem, item);
|
|
2060
2301
|
fill = getItemColor['fill'];
|
|
2061
2302
|
opacity = getItemColor['opacity'];
|
|
@@ -2131,8 +2372,6 @@ class LayoutPanel {
|
|
|
2131
2372
|
this.treemap.svgObject.appendChild(this.layoutGroup);
|
|
2132
2373
|
}
|
|
2133
2374
|
renderItemText(text, parentElement, textStyle, rect, interSectAction, groupId, fill, position, connectorText) {
|
|
2134
|
-
const secondaryEle = document.getElementById(this.treemap.element.id + '_Secondary_Element');
|
|
2135
|
-
const leaf = this.treemap.leafItemSettings;
|
|
2136
2375
|
const padding = 5;
|
|
2137
2376
|
let textSize;
|
|
2138
2377
|
let textCollection = [];
|
|
@@ -2210,7 +2449,7 @@ class LayoutPanel {
|
|
|
2210
2449
|
treemap.levels[item['groupIndex']].colorMapping;
|
|
2211
2450
|
if (colorMapping.length > 0) {
|
|
2212
2451
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2213
|
-
const option = colorMap(colorMapping, item['data'][this.treemap.equalColorValuePath], item['data'][this.treemap.rangeColorValuePath]
|
|
2452
|
+
const option = colorMap(colorMapping, item['data'][this.treemap.equalColorValuePath], item['data'][this.treemap.rangeColorValuePath]);
|
|
2214
2453
|
itemFill = !isNullOrUndefined(option['fill']) ? option['fill'] : treemap.leafItemSettings.fill;
|
|
2215
2454
|
itemOpacity = option['opacity'];
|
|
2216
2455
|
}
|
|
@@ -2247,8 +2486,8 @@ class LayoutPanel {
|
|
|
2247
2486
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2248
2487
|
const keys = Object.keys(item['data']);
|
|
2249
2488
|
for (let i = 0; i < keys.length; i++) {
|
|
2250
|
-
|
|
2251
|
-
template = template.replace(new
|
|
2489
|
+
const regExp = RegExp;
|
|
2490
|
+
template = template.replace(new regExp('{{:' + keys[i] + '}}', 'g'), item['data'][keys[i].toString()]);
|
|
2252
2491
|
}
|
|
2253
2492
|
}
|
|
2254
2493
|
let labelElement;
|
|
@@ -2525,18 +2764,19 @@ class Print {
|
|
|
2525
2764
|
*
|
|
2526
2765
|
* @param {TreeMap} control - Specifies the treemap instance.
|
|
2527
2766
|
*/
|
|
2528
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
2767
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
2529
2768
|
constructor(control) {
|
|
2530
2769
|
}
|
|
2531
2770
|
/**
|
|
2532
2771
|
* This method is used to perform the print functionality in treemap.
|
|
2533
2772
|
*
|
|
2773
|
+
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
2534
2774
|
* @param { string[] | string | Element} elements - Specifies the element.
|
|
2535
2775
|
* @returns {void}
|
|
2536
2776
|
* @private
|
|
2537
2777
|
*/
|
|
2538
2778
|
print(treeMap, elements) {
|
|
2539
|
-
|
|
2779
|
+
const printWindow = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
|
|
2540
2780
|
printWindow.moveTo(0, 0);
|
|
2541
2781
|
printWindow.resizeTo(screen.availWidth, screen.availHeight);
|
|
2542
2782
|
const argsData = {
|
|
@@ -2551,6 +2791,7 @@ class Print {
|
|
|
2551
2791
|
/**
|
|
2552
2792
|
* To get the html string of the Maps
|
|
2553
2793
|
*
|
|
2794
|
+
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
2554
2795
|
* @param {string[] | string | Element} elements - Specifies the element
|
|
2555
2796
|
* @returns {Element} - Returns the element
|
|
2556
2797
|
* @private
|
|
@@ -2590,6 +2831,7 @@ class Print {
|
|
|
2590
2831
|
* @returns {void}
|
|
2591
2832
|
* @private
|
|
2592
2833
|
*/
|
|
2834
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2593
2835
|
destroy() { }
|
|
2594
2836
|
}
|
|
2595
2837
|
|
|
@@ -2604,12 +2846,13 @@ class ImageExport {
|
|
|
2604
2846
|
*
|
|
2605
2847
|
* @param {TreeMap} control - Specifies the treemap instance
|
|
2606
2848
|
*/
|
|
2607
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
2849
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
2608
2850
|
constructor(control) {
|
|
2609
2851
|
}
|
|
2610
2852
|
/**
|
|
2611
2853
|
* This method is used to perform the export functionality for the rendered treemap.
|
|
2612
2854
|
*
|
|
2855
|
+
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
2613
2856
|
* @param {ExportType} type - Specifies the type of the image file.
|
|
2614
2857
|
* @param {string} fileName - Specifies the file name of the image file.
|
|
2615
2858
|
* @param {boolean} allowDownload - Specifies whether to download the file or not.
|
|
@@ -2617,7 +2860,7 @@ class ImageExport {
|
|
|
2617
2860
|
* @private
|
|
2618
2861
|
*/
|
|
2619
2862
|
export(treeMap, type, fileName, allowDownload) {
|
|
2620
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2863
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
2621
2864
|
const promise = new Promise((resolve, reject) => {
|
|
2622
2865
|
const element = createElement('canvas', {
|
|
2623
2866
|
id: 'ej2-canvas',
|
|
@@ -2673,6 +2916,7 @@ class ImageExport {
|
|
|
2673
2916
|
* @returns {void}
|
|
2674
2917
|
* @private
|
|
2675
2918
|
*/
|
|
2919
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2676
2920
|
destroy() { }
|
|
2677
2921
|
}
|
|
2678
2922
|
|
|
@@ -2687,12 +2931,13 @@ class PdfExport {
|
|
|
2687
2931
|
*
|
|
2688
2932
|
* @param {TreeMap} control - Specifies the treemap instance
|
|
2689
2933
|
*/
|
|
2690
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
2934
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
2691
2935
|
constructor(control) {
|
|
2692
2936
|
}
|
|
2693
2937
|
/**
|
|
2694
2938
|
* This method is used to perform the export functionality for the rendered treemap.
|
|
2695
2939
|
*
|
|
2940
|
+
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
2696
2941
|
* @param {ExportType} type - Specifies the type of the document.
|
|
2697
2942
|
* @param {string} fileName - Specifies the name of the document.
|
|
2698
2943
|
* @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document to export the component.
|
|
@@ -2701,7 +2946,7 @@ class PdfExport {
|
|
|
2701
2946
|
* @private
|
|
2702
2947
|
*/
|
|
2703
2948
|
export(treeMap, type, fileName, orientation, allowDownload) {
|
|
2704
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2949
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
2705
2950
|
const promise = new Promise((resolve, reject) => {
|
|
2706
2951
|
const element = createElement('canvas', {
|
|
2707
2952
|
id: 'ej2-canvas',
|
|
@@ -2710,7 +2955,6 @@ class PdfExport {
|
|
|
2710
2955
|
'height': treeMap.availableSize.height.toString()
|
|
2711
2956
|
}
|
|
2712
2957
|
});
|
|
2713
|
-
const isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
|
|
2714
2958
|
orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
|
|
2715
2959
|
const exportElement = treeMap.svgObject.cloneNode(true);
|
|
2716
2960
|
const backgroundElement = exportElement.childNodes[0];
|
|
@@ -2754,13 +2998,10 @@ class PdfExport {
|
|
|
2754
2998
|
* @returns {void}
|
|
2755
2999
|
* @private
|
|
2756
3000
|
*/
|
|
3001
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2757
3002
|
destroy() { }
|
|
2758
3003
|
}
|
|
2759
3004
|
|
|
2760
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
2761
|
-
/* eslint-disable @typescript-eslint/dot-notation */
|
|
2762
|
-
/* eslint-disable brace-style */
|
|
2763
|
-
/* eslint-disable max-len */
|
|
2764
3005
|
/**
|
|
2765
3006
|
* Tree Map Components
|
|
2766
3007
|
*/
|
|
@@ -2781,10 +3022,12 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
2781
3022
|
* ```
|
|
2782
3023
|
*/
|
|
2783
3024
|
let TreeMap = class TreeMap extends Component {
|
|
2784
|
-
/**
|
|
3025
|
+
/**
|
|
2785
3026
|
* Constructor for TreeMap component.
|
|
3027
|
+
*
|
|
3028
|
+
* @param {TreeMapModel} options - Specifies the treemap instance.
|
|
3029
|
+
* @param {string | HTMLElement} element - Specifies the treemap element.
|
|
2786
3030
|
*/
|
|
2787
|
-
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
|
|
2788
3031
|
constructor(options, element) {
|
|
2789
3032
|
super(options, element);
|
|
2790
3033
|
/**
|
|
@@ -2915,9 +3158,9 @@ let TreeMap = class TreeMap extends Component {
|
|
|
2915
3158
|
}
|
|
2916
3159
|
if (isNullOrUndefined(document.getElementById(this.element.id + '_Secondary_Element'))) {
|
|
2917
3160
|
const secondaryElement = createElement('div', {
|
|
2918
|
-
id: this.element.id + '_Secondary_Element'
|
|
2919
|
-
styles: 'position: absolute;z-index:1;'
|
|
3161
|
+
id: this.element.id + '_Secondary_Element'
|
|
2920
3162
|
});
|
|
3163
|
+
secondaryElement.style.cssText = 'position: absolute;z-index:1;';
|
|
2921
3164
|
this.element.appendChild(secondaryElement);
|
|
2922
3165
|
}
|
|
2923
3166
|
}
|
|
@@ -2929,9 +3172,9 @@ let TreeMap = class TreeMap extends Component {
|
|
|
2929
3172
|
}
|
|
2930
3173
|
}
|
|
2931
3174
|
/**
|
|
2932
|
-
* @private
|
|
2933
3175
|
* Render the treemap border
|
|
2934
3176
|
*
|
|
3177
|
+
* @private
|
|
2935
3178
|
* @returns {void}
|
|
2936
3179
|
*/
|
|
2937
3180
|
renderBorder() {
|
|
@@ -3009,11 +3252,12 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3009
3252
|
const child = findChildren(this.dataSource[i])['values'];
|
|
3010
3253
|
if (this.isHierarchicalData && child && child.length > 0) {
|
|
3011
3254
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3012
|
-
child.forEach((currentData
|
|
3255
|
+
child.forEach((currentData) => {
|
|
3013
3256
|
if (currentData[path]) {
|
|
3014
3257
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3015
3258
|
data[path].push({
|
|
3016
|
-
groupIndex: 0, name: currentData[path],
|
|
3259
|
+
groupIndex: 0, name: currentData[path],
|
|
3260
|
+
levelOrderName: currentData[path].toString(),
|
|
3017
3261
|
data: currentData, weight: currentData[this.weightValuePath]
|
|
3018
3262
|
});
|
|
3019
3263
|
}
|
|
@@ -3073,11 +3317,10 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3073
3317
|
processHierarchicalData(data, dataCount) {
|
|
3074
3318
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3075
3319
|
let childData;
|
|
3320
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3076
3321
|
let newData = {};
|
|
3077
3322
|
let levelIndex;
|
|
3078
3323
|
const path = this.leafItemSettings.labelPath ? this.leafItemSettings.labelPath : this.weightValuePath;
|
|
3079
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3080
|
-
let level;
|
|
3081
3324
|
let key;
|
|
3082
3325
|
newData = findChildren(data);
|
|
3083
3326
|
childData = newData ? newData['values'] : null;
|
|
@@ -3085,7 +3328,6 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3085
3328
|
key = newData['key'];
|
|
3086
3329
|
for (let i = 0; i < this.levels.length; i++) {
|
|
3087
3330
|
if (key === this.levels[i].groupPath) {
|
|
3088
|
-
level = this.levels[i];
|
|
3089
3331
|
levelIndex = i;
|
|
3090
3332
|
}
|
|
3091
3333
|
}
|
|
@@ -3136,7 +3378,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3136
3378
|
/**
|
|
3137
3379
|
* This method is used to perform the print functionality in treemap.
|
|
3138
3380
|
*
|
|
3139
|
-
* @param id - Specifies the element to print the treemap.
|
|
3381
|
+
* @param {string[] | string | Element} id - Specifies the element to print the treemap.
|
|
3382
|
+
* @returns {void}
|
|
3140
3383
|
*/
|
|
3141
3384
|
print(id) {
|
|
3142
3385
|
if (this.allowPrint && this.printModule) {
|
|
@@ -3146,22 +3389,24 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3146
3389
|
/**
|
|
3147
3390
|
* This method is used to perform the export functionality for the rendered treemap.
|
|
3148
3391
|
*
|
|
3149
|
-
* @param type - Specifies the
|
|
3150
|
-
* @param fileName - Specifies file name for exporting the rendered
|
|
3151
|
-
* @param orientation - Specifies the orientation of the
|
|
3392
|
+
* @param {ExportType} type - Specifies the extension type of the exported document.
|
|
3393
|
+
* @param {string} fileName - Specifies file name for exporting the rendered TreeMap.
|
|
3394
|
+
* @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document.
|
|
3395
|
+
* @param {boolean} allowDownload - Specifies whether the exported file should be downloaded or not.
|
|
3396
|
+
* @returns {string} - Specifies the base64 string of the exported image which is returned when the allowDownload is set to false.
|
|
3152
3397
|
*/
|
|
3153
3398
|
export(type, fileName, orientation, allowDownload) {
|
|
3154
3399
|
if (isNullOrUndefined(allowDownload)) {
|
|
3155
3400
|
allowDownload = true;
|
|
3156
3401
|
}
|
|
3157
3402
|
if (type === 'PDF' && this.allowPdfExport && this.pdfExportModule) {
|
|
3158
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3403
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
3159
3404
|
return new Promise((resolve, reject) => {
|
|
3160
3405
|
resolve(this.pdfExportModule.export(this, type, fileName, orientation, allowDownload));
|
|
3161
3406
|
});
|
|
3162
3407
|
}
|
|
3163
3408
|
else if (this.allowImageExport && (type !== 'PDF') && this.imageExportModule) {
|
|
3164
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3409
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
3165
3410
|
return new Promise((resolve, reject) => {
|
|
3166
3411
|
resolve(this.imageExportModule.export(this, type, fileName, allowDownload));
|
|
3167
3412
|
});
|
|
@@ -3201,7 +3446,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3201
3446
|
currentData['groupName'] = groupPath;
|
|
3202
3447
|
currentData['data'] = this.dataSource[j];
|
|
3203
3448
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3204
|
-
LevelsData.levelsData[LevelsData.levelsData.length - 1][groupPath].push(currentData);
|
|
3449
|
+
LevelsData.levelsData[(LevelsData.levelsData.length - 1)][groupPath].push(currentData);
|
|
3205
3450
|
orderNames.push((childName) ? childName : name);
|
|
3206
3451
|
}
|
|
3207
3452
|
}
|
|
@@ -3211,7 +3456,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3211
3456
|
/**
|
|
3212
3457
|
* This method orders the treemap level data.
|
|
3213
3458
|
*
|
|
3214
|
-
* @param start - Specifies the start value of the treemap level.
|
|
3459
|
+
* @param {number} start - Specifies the start value of the treemap level.
|
|
3460
|
+
* @returns {void}
|
|
3215
3461
|
*/
|
|
3216
3462
|
reOrderLevelData(start) {
|
|
3217
3463
|
let currentName;
|
|
@@ -3224,7 +3470,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3224
3470
|
for (let i = 0; i < currentData.length; i++) {
|
|
3225
3471
|
currentName = currentData[i]['levelOrderName'];
|
|
3226
3472
|
for (let j = 0; j < previousData.length; j++) {
|
|
3227
|
-
previousData[j][currentPath] = isNullOrUndefined(previousData[j][currentPath]) ?
|
|
3473
|
+
previousData[j][currentPath] = isNullOrUndefined(previousData[j][currentPath]) ?
|
|
3474
|
+
[] : previousData[j][currentPath];
|
|
3228
3475
|
if (this.IsChildHierarchy(currentName.split('#'), previousData[j]['levelOrderName'].split('#'))) {
|
|
3229
3476
|
if (isNullOrUndefined(currentData[i]['parent'])) {
|
|
3230
3477
|
currentData[i]['parent'] = previousData[j];
|
|
@@ -3256,12 +3503,12 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3256
3503
|
/**
|
|
3257
3504
|
* This method finds the weight value of the treemap level.
|
|
3258
3505
|
*
|
|
3259
|
-
* @param processData - Specifies the treemap data.
|
|
3260
|
-
* @param type - Specifies the type of the data.
|
|
3506
|
+
* @param {any[]} processData - Specifies the treemap data.
|
|
3507
|
+
* @param {string} type - Specifies the type of the data.
|
|
3508
|
+
* @returns {void}
|
|
3261
3509
|
*/
|
|
3262
3510
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3263
3511
|
findTotalWeight(processData, type) {
|
|
3264
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3265
3512
|
let totalWeight;
|
|
3266
3513
|
let split;
|
|
3267
3514
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -3335,12 +3582,14 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3335
3582
|
/**
|
|
3336
3583
|
* This method handles the window resize event on treemap.
|
|
3337
3584
|
*
|
|
3338
|
-
* @param e - Specifies the pointer event.
|
|
3585
|
+
* @param {Event} e - Specifies the pointer event.
|
|
3586
|
+
* @returns {void}
|
|
3339
3587
|
*/
|
|
3588
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3340
3589
|
resizeOnTreeMap(e) {
|
|
3341
3590
|
if (!this.isDestroyed) {
|
|
3342
3591
|
this.isResize = true;
|
|
3343
|
-
|
|
3592
|
+
const args = {
|
|
3344
3593
|
name: resize,
|
|
3345
3594
|
cancel: false,
|
|
3346
3595
|
previousSize: this.availableSize,
|
|
@@ -3357,6 +3606,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3357
3606
|
this.refreshing = true;
|
|
3358
3607
|
this.wireEVents();
|
|
3359
3608
|
args.currentSize = this.availableSize;
|
|
3609
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3360
3610
|
this.trigger(resize, args, (observedArgs) => {
|
|
3361
3611
|
this.render();
|
|
3362
3612
|
});
|
|
@@ -3367,7 +3617,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3367
3617
|
/**
|
|
3368
3618
|
* This method handles the click event on the treemap.
|
|
3369
3619
|
*
|
|
3370
|
-
* @param e - Specifies the mouse click event in the treemap.
|
|
3620
|
+
* @param {PointerEvent} e - Specifies the mouse click event in the treemap.
|
|
3621
|
+
* @returns {void}
|
|
3371
3622
|
*/
|
|
3372
3623
|
clickOnTreeMap(e) {
|
|
3373
3624
|
const targetEle = e.target;
|
|
@@ -3409,7 +3660,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3409
3660
|
/**
|
|
3410
3661
|
* This method handles the double click event in the treemap.
|
|
3411
3662
|
*
|
|
3412
|
-
* @param e - Specifies the pointer event of mouse click.
|
|
3663
|
+
* @param {PointerEvent} e - Specifies the pointer event of mouse click.
|
|
3664
|
+
* @returns {void}
|
|
3413
3665
|
*/
|
|
3414
3666
|
doubleClickOnTreeMap(e) {
|
|
3415
3667
|
const doubleClickArgs = { cancel: false, name: doubleClick, treemap: this, mouseEvent: e };
|
|
@@ -3419,7 +3671,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3419
3671
|
/**
|
|
3420
3672
|
* This method handles the right click event in the treemap.
|
|
3421
3673
|
*
|
|
3422
|
-
* @param e - Specifies the pointer event of mouse click.
|
|
3674
|
+
* @param {PointerEvent} e - Specifies the pointer event of mouse click.
|
|
3675
|
+
* @returns {void}
|
|
3423
3676
|
*/
|
|
3424
3677
|
rightClickOnTreeMap(e) {
|
|
3425
3678
|
const rightClickArgs = { cancel: false, name: rightClick, treemap: this, mouseEvent: e };
|
|
@@ -3428,7 +3681,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3428
3681
|
/**
|
|
3429
3682
|
* This method handles the mouse down event in the treemap.
|
|
3430
3683
|
*
|
|
3431
|
-
* @param e - Specifies the pointer event of mouse click.
|
|
3684
|
+
* @param {PointerEvent} e - Specifies the pointer event of mouse click.
|
|
3685
|
+
* @returns {void}
|
|
3432
3686
|
*/
|
|
3433
3687
|
mouseDownOnTreeMap(e) {
|
|
3434
3688
|
if (e.target.id.indexOf('_Item_Index') > -1) {
|
|
@@ -3439,7 +3693,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3439
3693
|
/**
|
|
3440
3694
|
* This method handles the mouse move event in the treemap.
|
|
3441
3695
|
*
|
|
3442
|
-
* @param e - Specifies the pointer event of mouse click.
|
|
3696
|
+
* @param {PointerEvent} e - Specifies the pointer event of mouse click.
|
|
3697
|
+
* @returns {void}
|
|
3443
3698
|
*/
|
|
3444
3699
|
mouseMoveOnTreeMap(e) {
|
|
3445
3700
|
const targetEle = e.target;
|
|
@@ -3465,10 +3720,11 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3465
3720
|
/**
|
|
3466
3721
|
* This method calculates the selected treemap levels.
|
|
3467
3722
|
*
|
|
3468
|
-
* @param labelText - Specifies the label text.
|
|
3469
|
-
* @param item - Specifies the treemap item.
|
|
3723
|
+
* @param {string} labelText - Specifies the label text.
|
|
3724
|
+
* @param {any} item - Specifies the treemap item.
|
|
3725
|
+
* @returns {any} - Returns label of the drilled level.
|
|
3470
3726
|
*/
|
|
3471
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3727
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3472
3728
|
calculateSelectedTextLevels(labelText, item) {
|
|
3473
3729
|
//to find the levels by clicking the particular text both for drillDownView as true / false.
|
|
3474
3730
|
let drillLevel;
|
|
@@ -3487,13 +3743,14 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3487
3743
|
/**
|
|
3488
3744
|
* This method calculates the previous level of child items in treemap.
|
|
3489
3745
|
*
|
|
3490
|
-
* @param
|
|
3491
|
-
* @param
|
|
3492
|
-
* @param
|
|
3493
|
-
* @
|
|
3746
|
+
* @param {any} drillLevelValues - Specifies the values of drill level.
|
|
3747
|
+
* @param {any} item - Specifies the treemap item.
|
|
3748
|
+
* @param {boolean} directLevel - Specifies the current level.
|
|
3749
|
+
* @returns {boolean} - check whether it is previous level or not.
|
|
3750
|
+
* @private
|
|
3494
3751
|
*/
|
|
3495
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3496
|
-
calculatePreviousLevelChildItems(
|
|
3752
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3753
|
+
calculatePreviousLevelChildItems(drillLevelValues, item, directLevel) {
|
|
3497
3754
|
//By clicking any child items drilldown to the particular level.
|
|
3498
3755
|
//At the time store all the previous drilled level items in drilledItems
|
|
3499
3756
|
// This condition satisfies while drilldown View is set as false and the text contains '[+]'
|
|
@@ -3527,11 +3784,12 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3527
3784
|
/**
|
|
3528
3785
|
* This method compares the selected labels with the drill down items.
|
|
3529
3786
|
*
|
|
3530
|
-
* @param drillLevelValues - Specifies the values of drill level.
|
|
3531
|
-
* @param item - Specifies the treemap item.
|
|
3532
|
-
* @param i - Specifies the treemap item.
|
|
3787
|
+
* @param {any} drillLevelValues - Specifies the values of drill level.
|
|
3788
|
+
* @param {any} item - Specifies the treemap item.
|
|
3789
|
+
* @param {number} i - Specifies the treemap item.
|
|
3790
|
+
* @returns {any} - return the new drill down object.
|
|
3533
3791
|
*/
|
|
3534
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3792
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3535
3793
|
compareSelectedLabelWithDrillDownItems(drillLevelValues, item, i) {
|
|
3536
3794
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3537
3795
|
let drillLevelChild;
|
|
@@ -3554,7 +3812,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3554
3812
|
/**
|
|
3555
3813
|
* This method handles mouse end event in treemap.
|
|
3556
3814
|
*
|
|
3557
|
-
* @param e - Specifies the pointer event of mouse.
|
|
3815
|
+
* @param {PointerEvent} e - Specifies the pointer event of mouse.
|
|
3816
|
+
* @returns {void}
|
|
3558
3817
|
*/
|
|
3559
3818
|
mouseEndOnTreeMap(e) {
|
|
3560
3819
|
const targetEle = e.target;
|
|
@@ -3584,7 +3843,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3584
3843
|
drillLevelValues = this.calculateSelectedTextLevels(labelText, item);
|
|
3585
3844
|
drillLevel = drillLevelValues['drillLevel'];
|
|
3586
3845
|
if (!this.drillDownView && labelText.search('[+]') !== -1) {
|
|
3587
|
-
directLevel = this.calculatePreviousLevelChildItems(
|
|
3846
|
+
directLevel = this.calculatePreviousLevelChildItems(drillLevelValues, item, directLevel);
|
|
3588
3847
|
}
|
|
3589
3848
|
}
|
|
3590
3849
|
if (this.levels.length !== 0 && !item['isLeafItem'] && findChildren(item)['values'] &&
|
|
@@ -3676,7 +3935,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3676
3935
|
}
|
|
3677
3936
|
else {
|
|
3678
3937
|
this.layout.calculateLayoutItems(newDrillItem, totalRect);
|
|
3679
|
-
this.layout.renderLayoutItems(
|
|
3938
|
+
this.layout.renderLayoutItems();
|
|
3680
3939
|
}
|
|
3681
3940
|
}
|
|
3682
3941
|
});
|
|
@@ -3695,8 +3954,10 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3695
3954
|
/**
|
|
3696
3955
|
* This method handles mouse leave event in treemap.
|
|
3697
3956
|
*
|
|
3698
|
-
* @param e - Specifies the pointer event of mouse.
|
|
3957
|
+
* @param {PointerEvent} e - Specifies the pointer event of mouse.
|
|
3958
|
+
* @return {void}
|
|
3699
3959
|
*/
|
|
3960
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3700
3961
|
mouseLeaveOnTreeMap(e) {
|
|
3701
3962
|
if (this.treeMapTooltipModule) {
|
|
3702
3963
|
this.treeMapTooltipModule.removeTooltip();
|
|
@@ -3706,12 +3967,16 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3706
3967
|
}
|
|
3707
3968
|
removeClassNames(document.getElementsByClassName('treeMapHighLight'), 'treeMapHighLight', this);
|
|
3708
3969
|
if (this.treeMapHighlightModule) {
|
|
3709
|
-
removeShape(this.treeMapHighlightModule.shapeHighlightCollection
|
|
3970
|
+
removeShape(this.treeMapHighlightModule.shapeHighlightCollection);
|
|
3710
3971
|
this.treeMapHighlightModule.highLightId = '';
|
|
3711
3972
|
}
|
|
3712
3973
|
}
|
|
3713
3974
|
/**
|
|
3714
3975
|
* This method is used to select or remove the selection of treemap item based on the provided selection settings.
|
|
3976
|
+
*
|
|
3977
|
+
* @param {string[]} levelOrder - Specifies the order of the level.
|
|
3978
|
+
* @param {boolean} isSelected - check whether it is selected or not.
|
|
3979
|
+
* @return {void}
|
|
3715
3980
|
*/
|
|
3716
3981
|
selectItem(levelOrder, isSelected) {
|
|
3717
3982
|
if (isNullOrUndefined(isSelected)) {
|
|
@@ -3790,6 +4055,7 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3790
4055
|
* @returns {void}
|
|
3791
4056
|
* @private
|
|
3792
4057
|
*/
|
|
4058
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3793
4059
|
onPropertyChanged(newProp, oldProp) {
|
|
3794
4060
|
if (!this.isDestroyed) {
|
|
3795
4061
|
let render = false;
|
|
@@ -3819,6 +4085,8 @@ let TreeMap = class TreeMap extends Component {
|
|
|
3819
4085
|
}
|
|
3820
4086
|
/**
|
|
3821
4087
|
* Gets component name.
|
|
4088
|
+
*
|
|
4089
|
+
* @returns {string} - return the treemap instance.
|
|
3822
4090
|
*/
|
|
3823
4091
|
getModuleName() {
|
|
3824
4092
|
return 'treemap';
|
|
@@ -4021,14 +4289,10 @@ TreeMap = __decorate([
|
|
|
4021
4289
|
class LevelsData {
|
|
4022
4290
|
}
|
|
4023
4291
|
|
|
4024
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
4025
|
-
/* eslint-disable @typescript-eslint/dot-notation */
|
|
4026
|
-
/* eslint-disable max-len */
|
|
4027
4292
|
/**
|
|
4028
4293
|
* Legend module class
|
|
4029
4294
|
*/
|
|
4030
4295
|
class TreeMapLegend {
|
|
4031
|
-
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
|
|
4032
4296
|
constructor(treemap) {
|
|
4033
4297
|
this.page = 0;
|
|
4034
4298
|
this.legendBorderRect = new Rect(0, 0, 0, 0);
|
|
@@ -4055,15 +4319,12 @@ class TreeMapLegend {
|
|
|
4055
4319
|
this.heightIncrement = 0;
|
|
4056
4320
|
this.defsElement = this.treemap.renderer.createDefs();
|
|
4057
4321
|
this.treemap.svgObject.appendChild(this.defsElement);
|
|
4058
|
-
|
|
4059
|
-
eventArgs = {
|
|
4322
|
+
const eventArgs = {
|
|
4060
4323
|
cancel: false, name: legendRendering, treemap: this.treemap, _changePosition: this.treemap.legendSettings.position,
|
|
4061
4324
|
position: this.treemap.legendSettings.position
|
|
4062
4325
|
};
|
|
4063
4326
|
this.treemap.trigger(legendRendering, eventArgs, (observedArgs) => {
|
|
4064
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
4065
4327
|
if (!observedArgs.cancel && observedArgs._changePosition !== this.treemap.legendSettings.position) {
|
|
4066
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
4067
4328
|
this.treemap.legendSettings.position = observedArgs._changePosition;
|
|
4068
4329
|
}
|
|
4069
4330
|
this.calculateLegendBounds();
|
|
@@ -4078,9 +4339,18 @@ class TreeMapLegend {
|
|
|
4078
4339
|
this.findColorMappingLegendItems(LevelsData.levelsData[0]);
|
|
4079
4340
|
if ((this.treemap.palette.length > 0 || !isNullOrUndefined(this.treemap.colorValuePath))
|
|
4080
4341
|
&& this.legendCollections.length === 0) {
|
|
4081
|
-
this.findPaletteLegendItems(LevelsData.levelsData[0]
|
|
4342
|
+
this.findPaletteLegendItems(LevelsData.levelsData[0]);
|
|
4082
4343
|
}
|
|
4083
4344
|
if (this.legendCollections.length > 0) {
|
|
4345
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
4346
|
+
this.legendCollections.sort((firstItem, nextItem) => (firstItem.levelIndex > nextItem.levelIndex) ? 1 :
|
|
4347
|
+
(firstItem.levelIndex < nextItem.levelIndex) ? -1 : 0);
|
|
4348
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
4349
|
+
this.legendCollections.sort((firstItem, nextItem) => (firstItem.groupIndex > nextItem.groupIndex) ? 1 :
|
|
4350
|
+
(firstItem.groupIndex < nextItem.groupIndex) ? -1 : 0);
|
|
4351
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
4352
|
+
this.legendCollections.sort((firstItem, nextItem) => (firstItem.leafIndex > nextItem.leafIndex) ? 1 :
|
|
4353
|
+
(firstItem.leafIndex < nextItem.leafIndex) ? -1 : 0);
|
|
4084
4354
|
const defaultSize = 25;
|
|
4085
4355
|
const textPadding = 10;
|
|
4086
4356
|
const position = legend.position;
|
|
@@ -4112,7 +4382,6 @@ class TreeMapLegend {
|
|
|
4112
4382
|
let startY = 0;
|
|
4113
4383
|
const shapePadding = legend.shapePadding;
|
|
4114
4384
|
const itemTextStyle = legend.textStyle;
|
|
4115
|
-
const legendLength = this.legendCollections.length;
|
|
4116
4385
|
itemTextStyle.size = itemTextStyle.size || treemap.themeStyle.legendFontSize;
|
|
4117
4386
|
itemTextStyle.fontFamily = itemTextStyle.fontFamily || treemap.themeStyle.fontFamily;
|
|
4118
4387
|
if (legendMode === 'Default') {
|
|
@@ -4309,7 +4578,7 @@ class TreeMapLegend {
|
|
|
4309
4578
|
}
|
|
4310
4579
|
}
|
|
4311
4580
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4312
|
-
findPaletteLegendItems(data
|
|
4581
|
+
findPaletteLegendItems(data) {
|
|
4313
4582
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4314
4583
|
let child;
|
|
4315
4584
|
let legendFillColor;
|
|
@@ -4416,7 +4685,8 @@ class TreeMapLegend {
|
|
|
4416
4685
|
groupIndex = data[i]['groupIndex'];
|
|
4417
4686
|
isLeafItem = (this.treemap.levels.length === 0 || groupIndex === this.treemap.levels.length);
|
|
4418
4687
|
colorMapping = isLeafItem ? leaf.colorMapping : levels[groupIndex].colorMapping;
|
|
4419
|
-
for (
|
|
4688
|
+
for (let j = 0; j < colorMapping.length; j++) {
|
|
4689
|
+
const colorMap$$1 = colorMapping[j];
|
|
4420
4690
|
gradientElement = null;
|
|
4421
4691
|
rangeValue = Number(currentData[this.treemap.rangeColorValuePath]);
|
|
4422
4692
|
equalValue = currentData[this.treemap.equalColorValuePath];
|
|
@@ -4477,8 +4747,8 @@ class TreeMapLegend {
|
|
|
4477
4747
|
fill = ((Object.prototype.toString.call(colorMap$$1.color) === '[object Array]')) && isNullOrUndefined(gradientElement)
|
|
4478
4748
|
&& isNullOrUndefined(colorMap$$1.value) ? this.legendGradientColor(colorMap$$1, legendIndex) : fill;
|
|
4479
4749
|
this.legendCollections.push({
|
|
4480
|
-
actualValue: actualValue,
|
|
4481
|
-
legendName: legendText, legendFill: fill, legendData: [],
|
|
4750
|
+
actualValue: actualValue, levelIndex: !isLeafItem ? j : -1, leafIndex: isLeafItem ? j : -1,
|
|
4751
|
+
legendName: legendText, legendFill: fill, legendData: [], groupIndex: !isLeafItem ? groupIndex : -1,
|
|
4482
4752
|
gradientElement: !isNullOrUndefined(gradientElement) ? gradientElement : isNullOrUndefined(colorMap$$1.value)
|
|
4483
4753
|
? this.legendLinearGradient : null, name: data[i]['name'],
|
|
4484
4754
|
opacity: this.treemap.legendSettings.opacity, borderColor: this.treemap.legendSettings.border.color,
|
|
@@ -4755,9 +5025,11 @@ class TreeMapLegend {
|
|
|
4755
5025
|
renderTextElement(textOptions, textStyle, textStyle.color || this.treemap.themeStyle.legendTitleColor, this.legendGroup);
|
|
4756
5026
|
}
|
|
4757
5027
|
}
|
|
4758
|
-
// eslint-disable-next-line valid-jsdoc
|
|
4759
5028
|
/**
|
|
4760
5029
|
* To rendered the interactive pointer
|
|
5030
|
+
*
|
|
5031
|
+
* @param {PointerEvent | TouchEvent} e - Specifies the pointer argument.
|
|
5032
|
+
* @returns {void}
|
|
4761
5033
|
*/
|
|
4762
5034
|
renderInteractivePointer(e) {
|
|
4763
5035
|
const treemap = this.treemap;
|
|
@@ -4914,18 +5186,22 @@ class TreeMapLegend {
|
|
|
4914
5186
|
legendElementId.parentNode.removeChild(legendElementId);
|
|
4915
5187
|
}
|
|
4916
5188
|
}
|
|
4917
|
-
// eslint-disable-next-line valid-jsdoc
|
|
4918
5189
|
/**
|
|
4919
5190
|
* To change the next page
|
|
5191
|
+
*
|
|
5192
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
5193
|
+
* @returns {void}
|
|
4920
5194
|
*/
|
|
4921
5195
|
changeNextPage(e) {
|
|
4922
5196
|
this.currentPage = (e.target.id.indexOf('_Left_Page_') > -1) ? (this.currentPage - 1) :
|
|
4923
5197
|
(this.currentPage + 1);
|
|
4924
5198
|
this.drawLegend();
|
|
4925
5199
|
}
|
|
4926
|
-
// eslint-disable-next-line valid-jsdoc
|
|
4927
5200
|
/**
|
|
4928
5201
|
* Wire events for event handler
|
|
5202
|
+
*
|
|
5203
|
+
* @param {Element} element - Specifies the element.
|
|
5204
|
+
* @returns {void}
|
|
4929
5205
|
*/
|
|
4930
5206
|
wireEvents(element) {
|
|
4931
5207
|
EventHandler.add(element, Browser.touchStartEvent, this.changeNextPage, this);
|
|
@@ -4952,9 +5228,10 @@ class TreeMapLegend {
|
|
|
4952
5228
|
this.treemap.off(Browser.touchMoveEvent, this.renderInteractivePointer);
|
|
4953
5229
|
this.treemap.off(Browser.touchEndEvent, this.mouseUpHandler);
|
|
4954
5230
|
}
|
|
4955
|
-
// eslint-disable-next-line valid-jsdoc
|
|
4956
5231
|
/**
|
|
4957
5232
|
* Get module name.
|
|
5233
|
+
*
|
|
5234
|
+
* @returns {string} Returns the legend module name.
|
|
4958
5235
|
*/
|
|
4959
5236
|
getModuleName() {
|
|
4960
5237
|
return 'treeMapLegend';
|
|
@@ -4982,9 +5259,12 @@ class TreeMapLegend {
|
|
|
4982
5259
|
//TODO: The removeInteractivePointer method (calling method) is called in a timer in the mouseUpHandler method. Because of this handling, adding the below code results in a spec failure.
|
|
4983
5260
|
//this.treemap = null;
|
|
4984
5261
|
}
|
|
4985
|
-
// eslint-disable-next-line valid-jsdoc
|
|
4986
5262
|
/**
|
|
4987
5263
|
* Get the gradient color for interactive legend.
|
|
5264
|
+
*
|
|
5265
|
+
* @param {ColorMappingModel} colorMap - Specifies the color mapping instance.
|
|
5266
|
+
* @param {number} legendIndex - Specifies the index of legend.
|
|
5267
|
+
* @returns {string} - Returns the legend color.
|
|
4988
5268
|
*/
|
|
4989
5269
|
legendGradientColor(colorMap$$1, legendIndex) {
|
|
4990
5270
|
let legendFillColor;
|
|
@@ -5023,7 +5303,6 @@ class TreeMapLegend {
|
|
|
5023
5303
|
* Performing treemap highlight
|
|
5024
5304
|
*/
|
|
5025
5305
|
class TreeMapHighlight {
|
|
5026
|
-
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
|
|
5027
5306
|
constructor(treeMap) {
|
|
5028
5307
|
this.target = 'highlight';
|
|
5029
5308
|
this.shapeTarget = 'highlight';
|
|
@@ -5036,10 +5315,11 @@ class TreeMapHighlight {
|
|
|
5036
5315
|
this.treemap = treeMap;
|
|
5037
5316
|
this.addEventListener();
|
|
5038
5317
|
}
|
|
5039
|
-
/* eslint-disable max-len */
|
|
5040
|
-
// eslint-disable-next-line valid-jsdoc
|
|
5041
5318
|
/**
|
|
5042
5319
|
* Mouse down event in highlight
|
|
5320
|
+
*
|
|
5321
|
+
* @param {PointerEvent} e - Specifies the pointer argument.
|
|
5322
|
+
* @returns {boolean} - return the highlight process is true or false.
|
|
5043
5323
|
*/
|
|
5044
5324
|
mouseMove(e) {
|
|
5045
5325
|
const treemap = this.treemap;
|
|
@@ -5072,7 +5352,7 @@ class TreeMapHighlight {
|
|
|
5072
5352
|
if (this.shapeElement !== null && (selectionModule ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true)) {
|
|
5073
5353
|
if (selectionModule ? this.shapeElement !== selectionModule.shapeElement : true) {
|
|
5074
5354
|
this.currentElement.push({ currentElement: this.shapeElement });
|
|
5075
|
-
removeShape(this.shapeHighlightCollection
|
|
5355
|
+
removeShape(this.shapeHighlightCollection);
|
|
5076
5356
|
this.shapeHighlightCollection.push({ legendEle: this.shapeElement, oldFill: collection[index]['legendFill'],
|
|
5077
5357
|
oldOpacity: collection[index]['opacity'], oldBorderColor: collection[index]['borderColor'],
|
|
5078
5358
|
oldBorderWidth: collection[index]['borderWidth']
|
|
@@ -5092,7 +5372,8 @@ class TreeMapHighlight {
|
|
|
5092
5372
|
}
|
|
5093
5373
|
orders = findHightLightItems(item, [], highlight.mode, treemap);
|
|
5094
5374
|
if (this.treemap.legendSettings.visible ? selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true : true) {
|
|
5095
|
-
if (this.treemap.legendSettings.visible ? selectionModule ?
|
|
5375
|
+
if (this.treemap.legendSettings.visible ? selectionModule ?
|
|
5376
|
+
this.shapeElement !== selectionModule.shapeElement : true : true) {
|
|
5096
5377
|
for (let i = 0; i < treeMapElement.childElementCount; i++) {
|
|
5097
5378
|
element = treeMapElement.childNodes[i];
|
|
5098
5379
|
process = true;
|
|
@@ -5125,13 +5406,14 @@ class TreeMapHighlight {
|
|
|
5125
5406
|
}
|
|
5126
5407
|
}
|
|
5127
5408
|
else if (targetId.indexOf('_Legend_Shape') > -1 || targetId.indexOf('_Legend_Index') > -1) {
|
|
5128
|
-
if (this.treemap.legendSettings.visible && (selectionModule ? selectionModule.legendSelectId !== targetId : true)
|
|
5409
|
+
if (this.treemap.legendSettings.visible && (selectionModule ? selectionModule.legendSelectId !== targetId : true)
|
|
5410
|
+
&& (selectionModule ? selectionModule.shapeSelectId !== targetId : true)) {
|
|
5129
5411
|
let itemIndex;
|
|
5130
5412
|
let groupIndex;
|
|
5131
5413
|
let length;
|
|
5132
5414
|
const targetEle = document.getElementById(targetId);
|
|
5133
5415
|
if (this.shapeTarget === 'highlight') {
|
|
5134
|
-
removeLegend(this.legendHighlightCollection
|
|
5416
|
+
removeLegend(this.legendHighlightCollection);
|
|
5135
5417
|
}
|
|
5136
5418
|
this.shapeTarget = 'highlight';
|
|
5137
5419
|
const index = this.treemap.legendSettings.mode === 'Default' ? parseFloat(targetId.split('_Legend_Shape_Index_')[1]) : parseFloat(targetId.split('_Legend_Index_')[1]);
|
|
@@ -5168,14 +5450,15 @@ class TreeMapHighlight {
|
|
|
5168
5450
|
}
|
|
5169
5451
|
if ((this.shapeTarget === 'highlight' || this.target === 'highlight') && this.treemap.legendSettings.visible) {
|
|
5170
5452
|
if (selectionModule ? this.shapeElement ? this.shapeElement.getAttribute('id') !== selectionModule.legendSelectId : true : true) {
|
|
5171
|
-
if (selectionModule ? this.shapeElement !== selectionModule.shapeElement : true && selectionModule ?
|
|
5172
|
-
|
|
5453
|
+
if (selectionModule ? this.shapeElement !== selectionModule.shapeElement : true && selectionModule ?
|
|
5454
|
+
selectionModule.legendSelect : true) {
|
|
5455
|
+
removeShape(this.shapeHighlightCollection);
|
|
5173
5456
|
this.shapeHighlightCollection = [];
|
|
5174
5457
|
}
|
|
5175
5458
|
}
|
|
5176
5459
|
}
|
|
5177
5460
|
if (this.shapeTarget === 'highlight' && this.treemap.legendSettings.visible) {
|
|
5178
|
-
removeLegend(this.legendHighlightCollection
|
|
5461
|
+
removeLegend(this.legendHighlightCollection);
|
|
5179
5462
|
}
|
|
5180
5463
|
this.highLightId = '';
|
|
5181
5464
|
processHighlight = false;
|
|
@@ -5231,7 +5514,6 @@ class TreeMapHighlight {
|
|
|
5231
5514
|
* Performing treemap selection
|
|
5232
5515
|
*/
|
|
5233
5516
|
class TreeMapSelection {
|
|
5234
|
-
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
|
|
5235
5517
|
constructor(treeMap) {
|
|
5236
5518
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5237
5519
|
this.shapeSelectionCollection = [];
|
|
@@ -5242,14 +5524,15 @@ class TreeMapSelection {
|
|
|
5242
5524
|
this.treemap = treeMap;
|
|
5243
5525
|
this.addEventListener();
|
|
5244
5526
|
}
|
|
5245
|
-
// eslint-disable-next-line valid-jsdoc
|
|
5246
5527
|
/**
|
|
5247
5528
|
* Mouse down event in selection
|
|
5529
|
+
*
|
|
5530
|
+
* @param {PointerEvent} e - Specifies the pointer argument.
|
|
5531
|
+
* @returns {void}
|
|
5248
5532
|
*/
|
|
5249
5533
|
mouseDown(e) {
|
|
5250
5534
|
const targetEle = e.target;
|
|
5251
5535
|
let eventArgs;
|
|
5252
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5253
5536
|
const treemap = this.treemap;
|
|
5254
5537
|
treemap.levelSelection = [];
|
|
5255
5538
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5277,7 +5560,7 @@ class TreeMapSelection {
|
|
|
5277
5560
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5278
5561
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5279
5562
|
this.shapeElement = undefined;
|
|
5280
|
-
removeShape(this.shapeSelectionCollection
|
|
5563
|
+
removeShape(this.shapeSelectionCollection);
|
|
5281
5564
|
if (highlightModule) {
|
|
5282
5565
|
highlightModule.shapeTarget = 'selection';
|
|
5283
5566
|
highlightModule.shapeHighlightCollection = [];
|
|
@@ -5331,7 +5614,7 @@ class TreeMapSelection {
|
|
|
5331
5614
|
}
|
|
5332
5615
|
}
|
|
5333
5616
|
else {
|
|
5334
|
-
removeShape(this.shapeSelectionCollection
|
|
5617
|
+
removeShape(this.shapeSelectionCollection);
|
|
5335
5618
|
this.shapeSelectionCollection = [];
|
|
5336
5619
|
this.shapeElement = undefined;
|
|
5337
5620
|
this.shapeSelect = true;
|
|
@@ -5352,7 +5635,7 @@ class TreeMapSelection {
|
|
|
5352
5635
|
this.legendSelect = false;
|
|
5353
5636
|
const legendIndex = parseInt(targetId[targetId.length - 1], 10);
|
|
5354
5637
|
const targetEle = document.getElementById(targetId);
|
|
5355
|
-
removeLegend(this.legendSelectionCollection
|
|
5638
|
+
removeLegend(this.legendSelectionCollection);
|
|
5356
5639
|
if (highlightModule) {
|
|
5357
5640
|
highlightModule.shapeTarget = 'selection';
|
|
5358
5641
|
}
|
|
@@ -5378,7 +5661,7 @@ class TreeMapSelection {
|
|
|
5378
5661
|
}
|
|
5379
5662
|
}
|
|
5380
5663
|
else {
|
|
5381
|
-
removeLegend(this.legendSelectionCollection
|
|
5664
|
+
removeLegend(this.legendSelectionCollection);
|
|
5382
5665
|
if (highlightModule) {
|
|
5383
5666
|
highlightModule.shapeTarget = 'highlight';
|
|
5384
5667
|
}
|
|
@@ -5429,7 +5712,7 @@ class TreeMapSelection {
|
|
|
5429
5712
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5430
5713
|
const collection = this.treemap.treeMapLegendModule.legendCollections;
|
|
5431
5714
|
this.shapeElement = undefined;
|
|
5432
|
-
removeShape(this.shapeSelectionCollection
|
|
5715
|
+
removeShape(this.shapeSelectionCollection);
|
|
5433
5716
|
index = getLegendIndex(length, items[m], this.treemap);
|
|
5434
5717
|
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);
|
|
5435
5718
|
if (this.shapeElement !== null) {
|
|
@@ -5469,7 +5752,7 @@ class TreeMapSelection {
|
|
|
5469
5752
|
}
|
|
5470
5753
|
}
|
|
5471
5754
|
else {
|
|
5472
|
-
removeShape(this.shapeSelectionCollection
|
|
5755
|
+
removeShape(this.shapeSelectionCollection);
|
|
5473
5756
|
this.shapeElement = undefined;
|
|
5474
5757
|
this.treemap.levelSelection = [];
|
|
5475
5758
|
this.shapeSelect = true;
|
|
@@ -5512,7 +5795,6 @@ class TreeMapSelection {
|
|
|
5512
5795
|
/**
|
|
5513
5796
|
* To destroy the selection.
|
|
5514
5797
|
*
|
|
5515
|
-
* @param {TreeMap} treeMap - Specifies the treemap instance.
|
|
5516
5798
|
* @returns {void}
|
|
5517
5799
|
* @private
|
|
5518
5800
|
*/
|
|
@@ -5538,7 +5820,6 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
5538
5820
|
* Render Tooltip
|
|
5539
5821
|
*/
|
|
5540
5822
|
class TreeMapTooltip {
|
|
5541
|
-
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
|
|
5542
5823
|
constructor(treeMap) {
|
|
5543
5824
|
this.treemap = treeMap;
|
|
5544
5825
|
this.tooltipSettings = this.treemap.tooltipSettings;
|
|
@@ -5571,14 +5852,12 @@ class TreeMapTooltip {
|
|
|
5571
5852
|
let tooltipEle;
|
|
5572
5853
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5573
5854
|
let location;
|
|
5574
|
-
let toolTipHeader;
|
|
5575
5855
|
let toolTipData = {};
|
|
5576
5856
|
let tooltipContent = [];
|
|
5577
5857
|
let markerFill;
|
|
5578
5858
|
if (targetId.indexOf('_Item_Index') > -1) {
|
|
5579
5859
|
item = this.treemap.layout.renderItems[parseFloat(targetId.split('_Item_Index_')[1])];
|
|
5580
5860
|
if (!isNullOrUndefined(item)) {
|
|
5581
|
-
toolTipHeader = item['name'];
|
|
5582
5861
|
value = item['weight'];
|
|
5583
5862
|
toolTipData = item['data'];
|
|
5584
5863
|
if (!isNullOrUndefined(item['options'])) {
|
|
@@ -5598,9 +5877,9 @@ class TreeMapTooltip {
|
|
|
5598
5877
|
else {
|
|
5599
5878
|
tooltipEle = createElement('div', {
|
|
5600
5879
|
id: this.treemap.element.id + '_TreeMapTooltip',
|
|
5601
|
-
className: 'EJ2-TreeMap-Tooltip'
|
|
5602
|
-
styles: 'position: absolute;pointer-events:none;'
|
|
5880
|
+
className: 'EJ2-TreeMap-Tooltip'
|
|
5603
5881
|
});
|
|
5882
|
+
tooltipEle.style.cssText = 'position: absolute;pointer-events:none;';
|
|
5604
5883
|
document.getElementById(this.treemap.element.id + '_Secondary_Element').appendChild(tooltipEle);
|
|
5605
5884
|
}
|
|
5606
5885
|
location = getMousePosition(pageX, pageY, this.treemap.svgObject);
|
|
@@ -5619,6 +5898,7 @@ class TreeMapTooltip {
|
|
|
5619
5898
|
treemap: this.treemap,
|
|
5620
5899
|
element: target, eventArgs: e
|
|
5621
5900
|
};
|
|
5901
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5622
5902
|
this.treemap.trigger(tooltipRendering, tootipArgs, (args) => {
|
|
5623
5903
|
this.addTooltip(tootipArgs, markerFill, tooltipEle);
|
|
5624
5904
|
});
|