logitude-dashboard-library 3.2.39 → 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.
@@ -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
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum MeasureCode {
2
+ Average = "Avg",
3
+ CalculatedColumn = "CalculatedColumn",
4
+ Formula = "Formula",
5
+ Max = "Max",
6
+ Min = "Min",
7
+ Sum = "Sum",
8
+ Target = "Target",
9
+ Count = "Count"
10
+ }
@@ -4,6 +4,8 @@ declare const getGlobalNumberFormatting: () => {
4
4
  thousandsSeparator: string;
5
5
  decimalSeparator: string;
6
6
  };
7
- declare const getNumberInSystemLocalFormat: (value: number, decimalDigitsCount?: number, isToolTip?: boolean) => string;
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,30 +848,49 @@ var getGlobalNumberFormatting = function getGlobalNumberFormatting() {
734
848
  return numberSeparatorSettings;
735
849
  };
736
850
 
737
- var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value, decimalDigitsCount, isToolTip) {
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 (isToolTip === void 0) {
743
- isToolTip = false;
873
+ if (minimumFractionDigits === void 0) {
874
+ minimumFractionDigits = 0;
744
875
  }
745
876
 
746
- if (isNaN(value) || value == null || value == undefined) return value + "";
877
+ if (isValueTruncated === void 0) {
878
+ isValueTruncated = true;
879
+ }
880
+
881
+ if (value == null || value == undefined || isNaN(value)) return value + "";
747
882
  var decimalParts = value.toString().split(".");
748
883
  var maxFractionDigits = decimalParts[1] ? decimalParts[1].length : 0;
749
884
  decimalDigitsCount = decimalDigitsCount == -1 ? maxFractionDigits : decimalDigitsCount;
750
885
 
751
886
  var _numberSeparatorSettings = getGlobalNumberFormatting();
752
887
 
753
- if (!isToolTip) {
754
- var factor = Math.pow(10, decimalDigitsCount);
755
- var truncatedValue = Math.floor(value * factor) / factor;
756
- value = truncatedValue;
888
+ if (isValueTruncated) {
889
+ value = truncateDecimals(value, decimalDigitsCount);
757
890
  }
758
891
 
759
892
  var _val = value.toLocaleString('en-US', {
760
- minimumFractionDigits: 0,
893
+ minimumFractionDigits: minimumFractionDigits,
761
894
  maximumFractionDigits: decimalDigitsCount
762
895
  });
763
896
 
@@ -773,6 +906,24 @@ var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value,
773
906
  return value + "";
774
907
  };
775
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
+
776
927
  var ConvertStringToPascalCaseHelper = function ConvertStringToPascalCaseHelper(stringValue) {
777
928
  if (isNullOrUndefinedOrEmpty(stringValue) || typeof stringValue !== 'string') return stringValue || '';
778
929
  var splittedWords = stringValue.split(' ').filter(function (f) {
@@ -1606,12 +1757,16 @@ var TableChart = function TableChart(props) {
1606
1757
 
1607
1758
  var columnValue = data[column.FieldCode];
1608
1759
 
1609
- if (column.DataTypeCode == "Percentage") {
1610
- return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2) + "%" : 0 + '%';
1760
+ if (FieldDataType.isPercentage(column.DataTypeCode)) {
1761
+ return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2, 2) + "%" : 0 + '%';
1762
+ }
1763
+
1764
+ if (FieldDataType.isInteger(column.DataTypeCode)) {
1765
+ return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 0, 0, false) : "";
1611
1766
  }
1612
1767
 
1613
- if (column.DataTypeCode == "Decimal" || column.DataTypeCode == "Integer" || column.DataTypeCode == "Double" || column.DataTypeCode == "SigDouble") {
1614
- return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2) : "";
1768
+ if (FieldDataType.isNumericType(column.DataTypeCode)) {
1769
+ return !isNullOrUndefined(columnValue) ? getNumberInSystemLocalFormat(Number(columnValue), 2, 2) : "";
1615
1770
  }
1616
1771
 
1617
1772
  return ConvertStringToPascalCaseHelper(columnValue);
@@ -1977,9 +2132,12 @@ var PivotTable = React.forwardRef(function (props, comRef) {
1977
2132
  }
1978
2133
  },
1979
2134
  format: function format(value) {
2135
+ var isInteger = isValueInteger(measure.MeasureCode, measure.MeasureFieldDataType);
2136
+ var minimumFraction = isInteger ? 0 : 2;
2137
+
1980
2138
  var _value = isNullOrUndefinedOrEmpty(value) ? 0 : value;
1981
2139
 
1982
- return getNumberInSystemLocalFormat(_value, 2);
2140
+ return getNumberInSystemLocalFormat(_value, 2, minimumFraction);
1983
2141
  }
1984
2142
  };
1985
2143
  });
@@ -2113,7 +2271,7 @@ function buildToolTip(widget, value, seriesMeasure, label, index, groupbyId, sec
2113
2271
  }
2114
2272
 
2115
2273
  var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
2116
- 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 " + getTooltipPercentage(widget) + " </div> ";
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> ";
2117
2275
 
2118
2276
  if (RenderStackedChartTotalsAndPercentages(widget, seriesMeasure)) {
2119
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>";
@@ -2128,36 +2286,57 @@ function RenderStackedChartTotalsAndPercentages(widget, seriesMeasures) {
2128
2286
  return false;
2129
2287
  }
2130
2288
 
2131
- return widget.IsStacked && (seriesMeasures.MeasureCode === "Count" || seriesMeasures.MeasureCode === "Sum");
2289
+ return widget.IsStacked && (seriesMeasures.MeasureCode === MeasureCode.Count || seriesMeasures.MeasureCode === MeasureCode.Sum);
2132
2290
  }
2133
2291
 
2134
2292
  function getGroupValuePercentage(seriesMeasures, groupbyId, secGroupbyId) {
2135
- var _seriesMeasures$Value;
2136
-
2137
2293
  if (!seriesMeasures) {
2138
2294
  return;
2139
2295
  }
2140
2296
 
2141
- var total = getSumOfGroupValuesAsNumber(seriesMeasures, groupbyId);
2142
- var value = (_seriesMeasures$Value = seriesMeasures.Values.filter(function (v) {
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) {
2143
2319
  return v.GroupById === groupbyId && v.GroupByIdSec === secGroupbyId;
2144
- })[0]) === null || _seriesMeasures$Value === void 0 ? void 0 : _seriesMeasures$Value.Value;
2145
- var percentageValueInLocalFormat = "0";
2320
+ })[0]) === null || _seriesMeasure$Values === void 0 ? void 0 : _seriesMeasure$Values.Value;
2321
+ var percentageValueInLocalFormat = "0.00";
2146
2322
 
2147
2323
  if (total !== 0 && value) {
2148
- percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2, true);
2324
+ percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2, 0, false);
2149
2325
  }
2150
2326
 
2151
- return "<span style=\"margin-right:6px;\">Percentage:</span>" + percentageValueInLocalFormat + "%";
2327
+ return percentageValueInLocalFormat;
2152
2328
  }
2153
2329
 
2154
- function getSumOfGroupValues(seriesMeasure, groupbyId) {
2330
+ function getSumOfValuesAsNumber(seriesMeasure) {
2155
2331
  if (!seriesMeasure) {
2156
- return "";
2332
+ return 0;
2157
2333
  }
2158
2334
 
2159
- var total = getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId);
2160
- return "<span style=\"margin-right:6px;\">Total:</span>" + getNumberInSystemLocalFormat(total, 2, true);
2335
+ var total = 0;
2336
+ seriesMeasure.Values.forEach(function (v) {
2337
+ total += v.Value;
2338
+ });
2339
+ return total;
2161
2340
  }
2162
2341
 
2163
2342
  function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
@@ -2174,9 +2353,35 @@ function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
2174
2353
  return total;
2175
2354
  }
2176
2355
 
2177
- function getTooltipPercentage(widget) {
2356
+ function getPieDonutToolTipPercentage(widget, seriesMeasures, groupbyId, secGroupbyId) {
2178
2357
  if (widget.TypeCode != "donut" && widget.TypeCode != "pie") return "";
2179
- return "\n <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;\">($percentValue)</p>\n ";
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;
2180
2385
  }
2181
2386
 
2182
2387
  function getTooltiplabel(value, seriesMeasure) {
@@ -2186,11 +2391,15 @@ function getTooltiplabel(value, seriesMeasure) {
2186
2391
  }
2187
2392
 
2188
2393
  function getTooltipValue(value, seriesMeasure) {
2189
- if (!isNullOrUndefined(value)) {
2190
- return seriesMeasure && seriesMeasure.MeasureFieldDataType == 'Percentage' ? getNumberInSystemLocalFormat(value) + "%" : getNumberInSystemLocalFormat(value);
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) + "%";
2191
2400
  }
2192
2401
 
2193
- return '$dataValue';
2402
+ return getNumberInSystemLocalFormat(value, 2, 0);
2194
2403
  }
2195
2404
 
2196
2405
  function getMeasureType(seriesMeasure) {
@@ -2254,9 +2463,9 @@ function buildDataSource(values, widget) {
2254
2463
  var data = [];
2255
2464
  if (!values || !values[0]) return data;
2256
2465
  var series = values[0];
2257
- data = series.Values.map(function (e, index) {
2466
+ data = series.Values.map(function (e) {
2258
2467
  var item = {
2259
- value: e.Value,
2468
+ value: getTruncatedValue(e.Value),
2260
2469
  label: getLabelFormatByDateGroupType(e.Label, widget, false),
2261
2470
  id: {
2262
2471
  GroupById: e.GroupById,
@@ -2264,7 +2473,7 @@ function buildDataSource(values, widget) {
2264
2473
  MeasureCode: series.MeasureCode,
2265
2474
  Formula: series.Formula
2266
2475
  },
2267
- tooltext: buildToolTip(widget, null, series, e.Label, 0)
2476
+ tooltext: buildToolTip(widget, e.Value, series, e.Label, 0, e.GroupById, e.GroupByIdSec)
2268
2477
  };
2269
2478
  return item;
2270
2479
  });
@@ -2276,7 +2485,7 @@ function buildDataSet(seriesMeasures, widget) {
2276
2485
  seriesMeasures.forEach(function (seriesMeasure) {
2277
2486
  var datas = seriesMeasure.Values.map(function (e, index) {
2278
2487
  return {
2279
- value: e.Value,
2488
+ value: getTruncatedValue(e.Value),
2280
2489
  id: {
2281
2490
  GroupById: e.GroupById,
2282
2491
  MeasureFieldId: seriesMeasure.MeasureFieldId,
@@ -2370,10 +2579,11 @@ function buildStackedGroupData(secGroup, series, widget) {
2370
2579
  uniqueGroups.forEach(function (group) {
2371
2580
  var _series$Values$find;
2372
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;
2373
2585
  data.push({
2374
- value: (_series$Values$find = series.Values.find(function (x) {
2375
- return x.GroupById == group.code && x.GroupByIdSec == secGroup.code;
2376
- })) === null || _series$Values$find === void 0 ? void 0 : _series$Values$find.Value,
2586
+ value: getTruncatedValue(value),
2377
2587
  id: {
2378
2588
  GroupById: group.code,
2379
2589
  MeasureFieldId: series.MeasureFieldId,
@@ -2477,6 +2687,7 @@ var getGaugeObject = function getGaugeObject(data, widget) {
2477
2687
  chartInfo.manageResize = "1";
2478
2688
  chartInfo.valueBelowPivot = "1";
2479
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;
2480
2691
  fusionObject.dataSource = {
2481
2692
  "chart": chartInfo,
2482
2693
  "colorRange": {
@@ -2484,7 +2695,7 @@ var getGaugeObject = function getGaugeObject(data, widget) {
2484
2695
  },
2485
2696
  "dials": {
2486
2697
  "dial": [{
2487
- "value": !isNullOrUndefined(data) && !isNullOrUndefined(data === null || data === void 0 ? void 0 : data.Value) ? data === null || data === void 0 ? void 0 : data.Value : 0
2698
+ "value": getTruncatedValue(value)
2488
2699
  }]
2489
2700
  }
2490
2701
  };