logitude-dashboard-library 3.2.38 → 3.2.40
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/dist/Constant/FieldDataType.d.ts +27 -0
- package/dist/Constant/MeasureCode.d.ts +10 -0
- package/dist/Utils/General.d.ts +4 -2
- package/dist/index.js +257 -39
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +257 -39
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare class FieldDataType {
|
|
2
|
+
static readonly Decimal: string;
|
|
3
|
+
static readonly Double: string;
|
|
4
|
+
static readonly UnsDecimal: string;
|
|
5
|
+
static readonly Integer: string;
|
|
6
|
+
static readonly UnsInteger: string;
|
|
7
|
+
static readonly SigDouble: string;
|
|
8
|
+
static readonly LookUp: string;
|
|
9
|
+
static readonly PickList: string;
|
|
10
|
+
static readonly PickList2: string;
|
|
11
|
+
static readonly Text: string;
|
|
12
|
+
static readonly nText: string;
|
|
13
|
+
static readonly Boolean: string;
|
|
14
|
+
static readonly Date: string;
|
|
15
|
+
static readonly DateTime: string;
|
|
16
|
+
static readonly Percentage: string;
|
|
17
|
+
static isNumericType(fieldDataType: string | null | undefined | any): boolean;
|
|
18
|
+
static isInteger(fieldDataType: string | null | undefined | any): boolean;
|
|
19
|
+
static isPercentage(fieldDataType: string | null | undefined | any): boolean;
|
|
20
|
+
static isLookUpType(fieldDataType: string | null | undefined | any): boolean;
|
|
21
|
+
static isPickListType(fieldDataType: string | null | undefined | any): boolean;
|
|
22
|
+
static isTextOrNTextType(fieldDataType: string | null | undefined | any): boolean;
|
|
23
|
+
static isTextType(fieldDataType: string | null | undefined | any): boolean;
|
|
24
|
+
static isNTextType(fieldDataType: string | null | undefined | any): boolean;
|
|
25
|
+
static isBooleanType(fieldDataType: string | null | undefined | any): boolean;
|
|
26
|
+
static isDateOrDateTimeType(fieldDataType: string | null | undefined | any): boolean;
|
|
27
|
+
}
|
package/dist/Utils/General.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ declare const getGlobalNumberFormatting: () => {
|
|
|
4
4
|
thousandsSeparator: string;
|
|
5
5
|
decimalSeparator: string;
|
|
6
6
|
};
|
|
7
|
-
declare const
|
|
7
|
+
declare const isValueInteger: (measureCode: string | null | undefined, measureFieldType: string | null | undefined) => boolean;
|
|
8
|
+
declare const getTruncatedValue: (value: number | null | undefined | any, decimalDigitsCount?: number) => number | null | undefined;
|
|
9
|
+
declare const getNumberInSystemLocalFormat: (value: number | null | undefined, decimalDigitsCount?: number, minimumFractionDigits?: number, isValueTruncated?: boolean) => string;
|
|
8
10
|
declare const ConvertStringToPascalCaseHelper: (stringValue: string) => string;
|
|
9
|
-
export { isNullOrUndefined, isNullOrUndefinedOrEmpty, getGlobalNumberFormatting, getNumberInSystemLocalFormat, ConvertStringToPascalCaseHelper };
|
|
11
|
+
export { isNullOrUndefined, isNullOrUndefinedOrEmpty, getGlobalNumberFormatting, getNumberInSystemLocalFormat, ConvertStringToPascalCaseHelper, isValueInteger, getTruncatedValue };
|
package/dist/index.js
CHANGED
|
@@ -693,6 +693,120 @@ var getDateRangesByCode = function getDateRangesByCode(code, _fromDate, _toDate)
|
|
|
693
693
|
return result;
|
|
694
694
|
};
|
|
695
695
|
|
|
696
|
+
var FieldDataType = /*#__PURE__*/function () {
|
|
697
|
+
function FieldDataType() {}
|
|
698
|
+
|
|
699
|
+
FieldDataType.isNumericType = function isNumericType(fieldDataType) {
|
|
700
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return [FieldDataType.Decimal, FieldDataType.Double, FieldDataType.UnsDecimal, FieldDataType.SigDouble, FieldDataType.Integer, FieldDataType.UnsInteger, FieldDataType.Percentage].includes(fieldDataType);
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
FieldDataType.isInteger = function isInteger(fieldDataType) {
|
|
708
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return [FieldDataType.Integer, FieldDataType.UnsInteger].includes(fieldDataType);
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
FieldDataType.isPercentage = function isPercentage(fieldDataType) {
|
|
716
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
return fieldDataType === FieldDataType.Percentage;
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
FieldDataType.isLookUpType = function isLookUpType(fieldDataType) {
|
|
724
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
return fieldDataType === FieldDataType.LookUp;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
FieldDataType.isPickListType = function isPickListType(fieldDataType) {
|
|
732
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
return [FieldDataType.PickList, FieldDataType.PickList2].includes(fieldDataType);
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
FieldDataType.isTextOrNTextType = function isTextOrNTextType(fieldDataType) {
|
|
740
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
return [FieldDataType.Text, FieldDataType.nText].includes(fieldDataType);
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
FieldDataType.isTextType = function isTextType(fieldDataType) {
|
|
748
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return fieldDataType === FieldDataType.Text;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
FieldDataType.isNTextType = function isNTextType(fieldDataType) {
|
|
756
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
return fieldDataType === FieldDataType.nText;
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
FieldDataType.isBooleanType = function isBooleanType(fieldDataType) {
|
|
764
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
return fieldDataType === FieldDataType.Boolean;
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
FieldDataType.isDateOrDateTimeType = function isDateOrDateTimeType(fieldDataType) {
|
|
772
|
+
if (!fieldDataType || typeof fieldDataType !== "string") {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return [FieldDataType.Date, FieldDataType.DateTime].includes(fieldDataType);
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
return FieldDataType;
|
|
780
|
+
}();
|
|
781
|
+
FieldDataType.Decimal = "Decimal";
|
|
782
|
+
FieldDataType.Double = "Double";
|
|
783
|
+
FieldDataType.UnsDecimal = "UnsDecimal";
|
|
784
|
+
FieldDataType.Integer = "Integer";
|
|
785
|
+
FieldDataType.UnsInteger = "UnsInteger";
|
|
786
|
+
FieldDataType.SigDouble = "SigDouble";
|
|
787
|
+
FieldDataType.LookUp = "LookUp";
|
|
788
|
+
FieldDataType.PickList = "PickList";
|
|
789
|
+
FieldDataType.PickList2 = "PickList2";
|
|
790
|
+
FieldDataType.Text = "Text";
|
|
791
|
+
FieldDataType.nText = "nText";
|
|
792
|
+
FieldDataType.Boolean = "Boolean";
|
|
793
|
+
FieldDataType.Date = "Date";
|
|
794
|
+
FieldDataType.DateTime = "DateTime";
|
|
795
|
+
FieldDataType.Percentage = "Percentage";
|
|
796
|
+
|
|
797
|
+
var MeasureCode;
|
|
798
|
+
|
|
799
|
+
(function (MeasureCode) {
|
|
800
|
+
MeasureCode["Average"] = "Avg";
|
|
801
|
+
MeasureCode["CalculatedColumn"] = "CalculatedColumn";
|
|
802
|
+
MeasureCode["Formula"] = "Formula";
|
|
803
|
+
MeasureCode["Max"] = "Max";
|
|
804
|
+
MeasureCode["Min"] = "Min";
|
|
805
|
+
MeasureCode["Sum"] = "Sum";
|
|
806
|
+
MeasureCode["Target"] = "Target";
|
|
807
|
+
MeasureCode["Count"] = "Count";
|
|
808
|
+
})(MeasureCode || (MeasureCode = {}));
|
|
809
|
+
|
|
696
810
|
var isNullOrUndefined = function isNullOrUndefined(val) {
|
|
697
811
|
return val == null || val == undefined;
|
|
698
812
|
};
|
|
@@ -734,23 +848,49 @@ var getGlobalNumberFormatting = function getGlobalNumberFormatting() {
|
|
|
734
848
|
return numberSeparatorSettings;
|
|
735
849
|
};
|
|
736
850
|
|
|
737
|
-
var
|
|
851
|
+
var isValueInteger = function isValueInteger(measureCode, measureFieldType) {
|
|
852
|
+
if (measureCode === MeasureCode.Count || measureFieldType === FieldDataType.Integer) {
|
|
853
|
+
return true;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
return false;
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
var getTruncatedValue = function getTruncatedValue(value, decimalDigitsCount) {
|
|
860
|
+
if (decimalDigitsCount === void 0) {
|
|
861
|
+
decimalDigitsCount = 2;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (value == null || value == undefined || isNaN(value)) return value;
|
|
865
|
+
return truncateDecimals(value, decimalDigitsCount);
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value, decimalDigitsCount, minimumFractionDigits, isValueTruncated) {
|
|
738
869
|
if (decimalDigitsCount === void 0) {
|
|
739
870
|
decimalDigitsCount = -1;
|
|
740
871
|
}
|
|
741
872
|
|
|
742
|
-
if (
|
|
873
|
+
if (minimumFractionDigits === void 0) {
|
|
874
|
+
minimumFractionDigits = 0;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if (isValueTruncated === void 0) {
|
|
878
|
+
isValueTruncated = true;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
if (value == null || value == undefined || isNaN(value)) return value + "";
|
|
743
882
|
var decimalParts = value.toString().split(".");
|
|
744
883
|
var maxFractionDigits = decimalParts[1] ? decimalParts[1].length : 0;
|
|
745
884
|
decimalDigitsCount = decimalDigitsCount == -1 ? maxFractionDigits : decimalDigitsCount;
|
|
746
885
|
|
|
747
886
|
var _numberSeparatorSettings = getGlobalNumberFormatting();
|
|
748
887
|
|
|
749
|
-
|
|
750
|
-
|
|
888
|
+
if (isValueTruncated) {
|
|
889
|
+
value = truncateDecimals(value, decimalDigitsCount);
|
|
890
|
+
}
|
|
751
891
|
|
|
752
|
-
var _val =
|
|
753
|
-
minimumFractionDigits:
|
|
892
|
+
var _val = value.toLocaleString('en-US', {
|
|
893
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
754
894
|
maximumFractionDigits: decimalDigitsCount
|
|
755
895
|
});
|
|
756
896
|
|
|
@@ -766,6 +906,24 @@ var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value,
|
|
|
766
906
|
return value + "";
|
|
767
907
|
};
|
|
768
908
|
|
|
909
|
+
var truncateDecimals = function truncateDecimals(value, numberOfDecimalParts) {
|
|
910
|
+
if (!Number.isFinite(value)) return value;
|
|
911
|
+
var numStr = value.toString();
|
|
912
|
+
|
|
913
|
+
if (numStr.toLocaleLowerCase().includes("e")) {
|
|
914
|
+
return value;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
var _numStr$split = numStr.split('.'),
|
|
918
|
+
integerPart = _numStr$split[0],
|
|
919
|
+
_numStr$split$ = _numStr$split[1],
|
|
920
|
+
decimalPart = _numStr$split$ === void 0 ? '' : _numStr$split$;
|
|
921
|
+
|
|
922
|
+
var truncated = decimalPart.slice(0, numberOfDecimalParts);
|
|
923
|
+
var resultStr = truncated.length > 0 ? integerPart + "." + truncated : integerPart;
|
|
924
|
+
return parseFloat(resultStr);
|
|
925
|
+
};
|
|
926
|
+
|
|
769
927
|
var ConvertStringToPascalCaseHelper = function ConvertStringToPascalCaseHelper(stringValue) {
|
|
770
928
|
if (isNullOrUndefinedOrEmpty(stringValue) || typeof stringValue !== 'string') return stringValue || '';
|
|
771
929
|
var splittedWords = stringValue.split(' ').filter(function (f) {
|
|
@@ -1599,12 +1757,16 @@ var TableChart = function TableChart(props) {
|
|
|
1599
1757
|
|
|
1600
1758
|
var columnValue = data[column.FieldCode];
|
|
1601
1759
|
|
|
1602
|
-
if (column.DataTypeCode
|
|
1603
|
-
return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2) + "%" : 0 + '%';
|
|
1760
|
+
if (FieldDataType.isPercentage(column.DataTypeCode)) {
|
|
1761
|
+
return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2, 2) + "%" : 0 + '%';
|
|
1604
1762
|
}
|
|
1605
1763
|
|
|
1606
|
-
if (
|
|
1607
|
-
return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue),
|
|
1764
|
+
if (FieldDataType.isInteger(column.DataTypeCode)) {
|
|
1765
|
+
return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 0, 0, false) : "";
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
if (FieldDataType.isNumericType(column.DataTypeCode)) {
|
|
1769
|
+
return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2, 2) : "";
|
|
1608
1770
|
}
|
|
1609
1771
|
|
|
1610
1772
|
return ConvertStringToPascalCaseHelper(columnValue);
|
|
@@ -1970,9 +2132,12 @@ var PivotTable = React.forwardRef(function (props, comRef) {
|
|
|
1970
2132
|
}
|
|
1971
2133
|
},
|
|
1972
2134
|
format: function format(value) {
|
|
2135
|
+
var isInteger = isValueInteger(measure.MeasureCode, measure.MeasureFieldDataType);
|
|
2136
|
+
var minimumFraction = isInteger ? 0 : 2;
|
|
2137
|
+
|
|
1973
2138
|
var _value = isNullOrUndefinedOrEmpty(value) ? 0 : value;
|
|
1974
2139
|
|
|
1975
|
-
return getNumberInSystemLocalFormat(_value, 2);
|
|
2140
|
+
return getNumberInSystemLocalFormat(_value, 2, minimumFraction);
|
|
1976
2141
|
}
|
|
1977
2142
|
};
|
|
1978
2143
|
});
|
|
@@ -2106,10 +2271,10 @@ function buildToolTip(widget, value, seriesMeasure, label, index, groupbyId, sec
|
|
|
2106
2271
|
}
|
|
2107
2272
|
|
|
2108
2273
|
var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
|
|
2109
|
-
var customToolTip = "\n <div style=\"min-width: 108px;" + padding + "\">\n\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; min-height: 10px; min-width: 10px; height: 10px; width: 10px; background-color: transparent; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px; white-space: pre-line; font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232;\"> " + getTooltiplabel(label, seriesMeasure) + "</p>\n </div>\n\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getMeasureType(seriesMeasure) + "</p>\n <p style=\"margin: 0;margin-left: 6px; white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;\">" + getTooltipValue(value, seriesMeasure) + "</p>\n " +
|
|
2274
|
+
var customToolTip = "\n <div style=\"min-width: 108px;" + padding + "\">\n\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; min-height: 10px; min-width: 10px; height: 10px; width: 10px; background-color: transparent; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px; white-space: pre-line; font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232;\"> " + getTooltiplabel(label, seriesMeasure) + "</p>\n </div>\n\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getMeasureType(seriesMeasure) + "</p>\n <p style=\"margin: 0;margin-left: 6px; white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;\">" + getTooltipValue(value, seriesMeasure) + "</p>\n " + getPieDonutToolTipPercentage(widget, seriesMeasure, groupbyId, secGroupbyId) + " </div> ";
|
|
2110
2275
|
|
|
2111
2276
|
if (RenderStackedChartTotalsAndPercentages(widget, seriesMeasure)) {
|
|
2112
|
-
customToolTip += "<div>\n\n <hr style=\"margin-top: 6px;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex; flex-direction: column; gap: 6px; flex-d align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getGroupValuePercentage(seriesMeasure, groupbyId, secGroupbyId) + "</p>\n <p style=\"margin: 0;white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;\">" + getSumOfGroupValues(seriesMeasure, groupbyId) + "</p>\n </div>\n\n </div>";
|
|
2277
|
+
customToolTip += "<div>\n\n <hr style=\"margin-top: 6px;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex; flex-direction: column; gap: 6px; flex-d align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope'; white-space: pre-line; font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;\"> " + getGroupValuePercentage(seriesMeasure, groupbyId, secGroupbyId) + "</p>\n </div>\n\n <hr style=\"margin-top: 6px;border-top: 1px solid #F0F0F0;\">\n\n <div style=\"display: flex; flex-direction: column; gap: 6px; flex-d align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;white-space: pre-line; font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;\">" + getSumOfGroupValues(seriesMeasure, groupbyId) + "</p>\n </div>\n\n </div>";
|
|
2113
2278
|
}
|
|
2114
2279
|
|
|
2115
2280
|
customToolTip += "</div>";
|
|
@@ -2121,36 +2286,57 @@ function RenderStackedChartTotalsAndPercentages(widget, seriesMeasures) {
|
|
|
2121
2286
|
return false;
|
|
2122
2287
|
}
|
|
2123
2288
|
|
|
2124
|
-
return widget.IsStacked && (seriesMeasures.MeasureCode ===
|
|
2289
|
+
return widget.IsStacked && (seriesMeasures.MeasureCode === MeasureCode.Count || seriesMeasures.MeasureCode === MeasureCode.Sum);
|
|
2125
2290
|
}
|
|
2126
2291
|
|
|
2127
2292
|
function getGroupValuePercentage(seriesMeasures, groupbyId, secGroupbyId) {
|
|
2128
|
-
var _seriesMeasures$Value;
|
|
2129
|
-
|
|
2130
2293
|
if (!seriesMeasures) {
|
|
2131
2294
|
return;
|
|
2132
2295
|
}
|
|
2133
2296
|
|
|
2134
|
-
var
|
|
2135
|
-
|
|
2297
|
+
var percentageValueInLocalFormat = getPercentageGroupValueAsNumber(seriesMeasures, groupbyId, secGroupbyId);
|
|
2298
|
+
return "<span style=\"margin-right:6px;\">Percentage:</span>" + percentageValueInLocalFormat + "%";
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
function getSumOfGroupValues(seriesMeasure, groupbyId) {
|
|
2302
|
+
if (!seriesMeasure) {
|
|
2303
|
+
return "";
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
var total = getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId);
|
|
2307
|
+
return "<span style=\"margin-right:6px;\">Total:</span>" + getNumberInSystemLocalFormat(total, 2, 0);
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
function getPercentageGroupValueAsNumber(seriesMeasure, groupbyId, secGroupbyId) {
|
|
2311
|
+
var _seriesMeasure$Values;
|
|
2312
|
+
|
|
2313
|
+
if (!seriesMeasure) {
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
var total = getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId);
|
|
2318
|
+
var value = (_seriesMeasure$Values = seriesMeasure.Values.filter(function (v) {
|
|
2136
2319
|
return v.GroupById === groupbyId && v.GroupByIdSec === secGroupbyId;
|
|
2137
|
-
})[0]) === null ||
|
|
2138
|
-
var percentageValueInLocalFormat = "0";
|
|
2320
|
+
})[0]) === null || _seriesMeasure$Values === void 0 ? void 0 : _seriesMeasure$Values.Value;
|
|
2321
|
+
var percentageValueInLocalFormat = "0.00";
|
|
2139
2322
|
|
|
2140
2323
|
if (total !== 0 && value) {
|
|
2141
|
-
percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2);
|
|
2324
|
+
percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2, 0, false);
|
|
2142
2325
|
}
|
|
2143
2326
|
|
|
2144
|
-
return
|
|
2327
|
+
return percentageValueInLocalFormat;
|
|
2145
2328
|
}
|
|
2146
2329
|
|
|
2147
|
-
function
|
|
2330
|
+
function getSumOfValuesAsNumber(seriesMeasure) {
|
|
2148
2331
|
if (!seriesMeasure) {
|
|
2149
|
-
return
|
|
2332
|
+
return 0;
|
|
2150
2333
|
}
|
|
2151
2334
|
|
|
2152
|
-
var total =
|
|
2153
|
-
|
|
2335
|
+
var total = 0;
|
|
2336
|
+
seriesMeasure.Values.forEach(function (v) {
|
|
2337
|
+
total += v.Value;
|
|
2338
|
+
});
|
|
2339
|
+
return total;
|
|
2154
2340
|
}
|
|
2155
2341
|
|
|
2156
2342
|
function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
|
|
@@ -2167,9 +2353,35 @@ function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
|
|
|
2167
2353
|
return total;
|
|
2168
2354
|
}
|
|
2169
2355
|
|
|
2170
|
-
function
|
|
2356
|
+
function getPieDonutToolTipPercentage(widget, seriesMeasures, groupbyId, secGroupbyId) {
|
|
2171
2357
|
if (widget.TypeCode != "donut" && widget.TypeCode != "pie") return "";
|
|
2172
|
-
|
|
2358
|
+
|
|
2359
|
+
if (!seriesMeasures) {
|
|
2360
|
+
return "";
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
var percentageValueInLocalFormat = getDonutPiePercentageGroupValueAsNumber(seriesMeasures, groupbyId, secGroupbyId);
|
|
2364
|
+
return "<p style=\"margin: 0;margin-left: 2px;font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #A4A4A4;flex: none; order: 1;flex-grow: 0;\">(" + percentageValueInLocalFormat + ")%</p>";
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
function getDonutPiePercentageGroupValueAsNumber(seriesMeasure, groupbyId, secGroupbyId) {
|
|
2368
|
+
var _seriesMeasure$Values2;
|
|
2369
|
+
|
|
2370
|
+
if (!seriesMeasure) {
|
|
2371
|
+
return;
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
var total = getSumOfValuesAsNumber(seriesMeasure);
|
|
2375
|
+
var value = (_seriesMeasure$Values2 = seriesMeasure.Values.filter(function (v) {
|
|
2376
|
+
return v.GroupById === groupbyId && v.GroupByIdSec === secGroupbyId;
|
|
2377
|
+
})[0]) === null || _seriesMeasure$Values2 === void 0 ? void 0 : _seriesMeasure$Values2.Value;
|
|
2378
|
+
var percentageValueInLocalFormat = "0.00";
|
|
2379
|
+
|
|
2380
|
+
if (total !== 0 && value) {
|
|
2381
|
+
percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2, 0, false);
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
return percentageValueInLocalFormat;
|
|
2173
2385
|
}
|
|
2174
2386
|
|
|
2175
2387
|
function getTooltiplabel(value, seriesMeasure) {
|
|
@@ -2179,11 +2391,15 @@ function getTooltiplabel(value, seriesMeasure) {
|
|
|
2179
2391
|
}
|
|
2180
2392
|
|
|
2181
2393
|
function getTooltipValue(value, seriesMeasure) {
|
|
2182
|
-
if (
|
|
2183
|
-
return
|
|
2394
|
+
if (isNullOrUndefined(value)) {
|
|
2395
|
+
return '$dataValue';
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
if (FieldDataType.isPercentage(seriesMeasure === null || seriesMeasure === void 0 ? void 0 : seriesMeasure.MeasureFieldDataType)) {
|
|
2399
|
+
return getNumberInSystemLocalFormat(value, 2, 0) + "%";
|
|
2184
2400
|
}
|
|
2185
2401
|
|
|
2186
|
-
return
|
|
2402
|
+
return getNumberInSystemLocalFormat(value, 2, 0);
|
|
2187
2403
|
}
|
|
2188
2404
|
|
|
2189
2405
|
function getMeasureType(seriesMeasure) {
|
|
@@ -2247,9 +2463,9 @@ function buildDataSource(values, widget) {
|
|
|
2247
2463
|
var data = [];
|
|
2248
2464
|
if (!values || !values[0]) return data;
|
|
2249
2465
|
var series = values[0];
|
|
2250
|
-
data = series.Values.map(function (e
|
|
2466
|
+
data = series.Values.map(function (e) {
|
|
2251
2467
|
var item = {
|
|
2252
|
-
value: e.Value,
|
|
2468
|
+
value: getTruncatedValue(e.Value),
|
|
2253
2469
|
label: getLabelFormatByDateGroupType(e.Label, widget, false),
|
|
2254
2470
|
id: {
|
|
2255
2471
|
GroupById: e.GroupById,
|
|
@@ -2257,7 +2473,7 @@ function buildDataSource(values, widget) {
|
|
|
2257
2473
|
MeasureCode: series.MeasureCode,
|
|
2258
2474
|
Formula: series.Formula
|
|
2259
2475
|
},
|
|
2260
|
-
tooltext: buildToolTip(widget,
|
|
2476
|
+
tooltext: buildToolTip(widget, e.Value, series, e.Label, 0, e.GroupById, e.GroupByIdSec)
|
|
2261
2477
|
};
|
|
2262
2478
|
return item;
|
|
2263
2479
|
});
|
|
@@ -2269,7 +2485,7 @@ function buildDataSet(seriesMeasures, widget) {
|
|
|
2269
2485
|
seriesMeasures.forEach(function (seriesMeasure) {
|
|
2270
2486
|
var datas = seriesMeasure.Values.map(function (e, index) {
|
|
2271
2487
|
return {
|
|
2272
|
-
value: e.Value,
|
|
2488
|
+
value: getTruncatedValue(e.Value),
|
|
2273
2489
|
id: {
|
|
2274
2490
|
GroupById: e.GroupById,
|
|
2275
2491
|
MeasureFieldId: seriesMeasure.MeasureFieldId,
|
|
@@ -2363,10 +2579,11 @@ function buildStackedGroupData(secGroup, series, widget) {
|
|
|
2363
2579
|
uniqueGroups.forEach(function (group) {
|
|
2364
2580
|
var _series$Values$find;
|
|
2365
2581
|
|
|
2582
|
+
var value = (_series$Values$find = series.Values.find(function (x) {
|
|
2583
|
+
return x.GroupById == group.code && x.GroupByIdSec == secGroup.code;
|
|
2584
|
+
})) === null || _series$Values$find === void 0 ? void 0 : _series$Values$find.Value;
|
|
2366
2585
|
data.push({
|
|
2367
|
-
value: (
|
|
2368
|
-
return x.GroupById == group.code && x.GroupByIdSec == secGroup.code;
|
|
2369
|
-
})) === null || _series$Values$find === void 0 ? void 0 : _series$Values$find.Value,
|
|
2586
|
+
value: getTruncatedValue(value),
|
|
2370
2587
|
id: {
|
|
2371
2588
|
GroupById: group.code,
|
|
2372
2589
|
MeasureFieldId: series.MeasureFieldId,
|
|
@@ -2470,6 +2687,7 @@ var getGaugeObject = function getGaugeObject(data, widget) {
|
|
|
2470
2687
|
chartInfo.manageResize = "1";
|
|
2471
2688
|
chartInfo.valueBelowPivot = "1";
|
|
2472
2689
|
chartInfo.showValue = "1";
|
|
2690
|
+
var value = !isNullOrUndefined(data) && !isNullOrUndefined(data === null || data === void 0 ? void 0 : data.Value) ? data === null || data === void 0 ? void 0 : data.Value : 0;
|
|
2473
2691
|
fusionObject.dataSource = {
|
|
2474
2692
|
"chart": chartInfo,
|
|
2475
2693
|
"colorRange": {
|
|
@@ -2477,7 +2695,7 @@ var getGaugeObject = function getGaugeObject(data, widget) {
|
|
|
2477
2695
|
},
|
|
2478
2696
|
"dials": {
|
|
2479
2697
|
"dial": [{
|
|
2480
|
-
"value":
|
|
2698
|
+
"value": getTruncatedValue(value)
|
|
2481
2699
|
}]
|
|
2482
2700
|
}
|
|
2483
2701
|
};
|