logitude-dashboard-library 3.2.37 → 3.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,6 @@ declare const getGlobalNumberFormatting: () => {
4
4
  thousandsSeparator: string;
5
5
  decimalSeparator: string;
6
6
  };
7
- declare const getNumberInSystemLocalFormat: (value: number, decimalDigitsCount?: number) => string;
7
+ declare const getNumberInSystemLocalFormat: (value: number, decimalDigitsCount?: number, isToolTip?: boolean) => string;
8
8
  declare const ConvertStringToPascalCaseHelper: (stringValue: string) => string;
9
9
  export { isNullOrUndefined, isNullOrUndefinedOrEmpty, getGlobalNumberFormatting, getNumberInSystemLocalFormat, ConvertStringToPascalCaseHelper };
package/dist/index.js CHANGED
@@ -734,11 +734,15 @@ var getGlobalNumberFormatting = function getGlobalNumberFormatting() {
734
734
  return numberSeparatorSettings;
735
735
  };
736
736
 
737
- var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value, decimalDigitsCount) {
737
+ var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value, decimalDigitsCount, isToolTip) {
738
738
  if (decimalDigitsCount === void 0) {
739
739
  decimalDigitsCount = -1;
740
740
  }
741
741
 
742
+ if (isToolTip === void 0) {
743
+ isToolTip = false;
744
+ }
745
+
742
746
  if (isNaN(value) || value == null || value == undefined) return value + "";
743
747
  var decimalParts = value.toString().split(".");
744
748
  var maxFractionDigits = decimalParts[1] ? decimalParts[1].length : 0;
@@ -746,10 +750,13 @@ var getNumberInSystemLocalFormat = function getNumberInSystemLocalFormat(value,
746
750
 
747
751
  var _numberSeparatorSettings = getGlobalNumberFormatting();
748
752
 
749
- var factor = Math.pow(10, decimalDigitsCount);
750
- var truncatedValue = Math.floor(value * factor) / factor;
753
+ if (!isToolTip) {
754
+ var factor = Math.pow(10, decimalDigitsCount);
755
+ var truncatedValue = Math.floor(value * factor) / factor;
756
+ value = truncatedValue;
757
+ }
751
758
 
752
- var _val = truncatedValue.toLocaleString('en-US', {
759
+ var _val = value.toLocaleString('en-US', {
753
760
  minimumFractionDigits: 0,
754
761
  maximumFractionDigits: decimalDigitsCount
755
762
  });
@@ -2109,7 +2116,7 @@ function buildToolTip(widget, value, seriesMeasure, label, index, groupbyId, sec
2109
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> ";
2110
2117
 
2111
2118
  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>";
2119
+ 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
2120
  }
2114
2121
 
2115
2122
  customToolTip += "</div>";
@@ -2127,7 +2134,7 @@ function RenderStackedChartTotalsAndPercentages(widget, seriesMeasures) {
2127
2134
  function getGroupValuePercentage(seriesMeasures, groupbyId, secGroupbyId) {
2128
2135
  var _seriesMeasures$Value;
2129
2136
 
2130
- if (!groupbyId || !secGroupbyId || !seriesMeasures) {
2137
+ if (!seriesMeasures) {
2131
2138
  return;
2132
2139
  }
2133
2140
 
@@ -2138,23 +2145,23 @@ function getGroupValuePercentage(seriesMeasures, groupbyId, secGroupbyId) {
2138
2145
  var percentageValueInLocalFormat = "0";
2139
2146
 
2140
2147
  if (total !== 0 && value) {
2141
- percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2);
2148
+ percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2, true);
2142
2149
  }
2143
2150
 
2144
2151
  return "<span style=\"margin-right:6px;\">Percentage:</span>" + percentageValueInLocalFormat + "%";
2145
2152
  }
2146
2153
 
2147
2154
  function getSumOfGroupValues(seriesMeasure, groupbyId) {
2148
- if (!groupbyId || !seriesMeasure) {
2155
+ if (!seriesMeasure) {
2149
2156
  return "";
2150
2157
  }
2151
2158
 
2152
2159
  var total = getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId);
2153
- return "<span style=\"margin-right:6px;\">Total:</span>" + getNumberInSystemLocalFormat(total, 2);
2160
+ return "<span style=\"margin-right:6px;\">Total:</span>" + getNumberInSystemLocalFormat(total, 2, true);
2154
2161
  }
2155
2162
 
2156
2163
  function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
2157
- if (!groupbyId || !seriesMeasure) {
2164
+ if (!seriesMeasure) {
2158
2165
  return 0;
2159
2166
  }
2160
2167