logitude-dashboard-library 3.2.35 → 3.2.37
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SeriesMeasure } from "../../../../types/SeriesMeasure";
|
|
2
2
|
import { ReactWidgetPM } from "../../../../types/widget";
|
|
3
|
-
export declare function buildToolTip(widget: ReactWidgetPM, value: any,
|
|
3
|
+
export declare function buildToolTip(widget: ReactWidgetPM, value: any, seriesMeasure: SeriesMeasure, label: any, index: number, groupbyId?: string | null, secGroupbyId?: string | null): string;
|
package/dist/index.js
CHANGED
|
@@ -2096,9 +2096,75 @@ var CustomChart = function CustomChart(props) {
|
|
|
2096
2096
|
}, project()));
|
|
2097
2097
|
};
|
|
2098
2098
|
|
|
2099
|
-
function buildToolTip(widget, value,
|
|
2099
|
+
function buildToolTip(widget, value, seriesMeasure, label, index, groupbyId, secGroupbyId) {
|
|
2100
|
+
if (groupbyId === void 0) {
|
|
2101
|
+
groupbyId = null;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
if (secGroupbyId === void 0) {
|
|
2105
|
+
secGroupbyId = null;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2100
2108
|
var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
|
|
2101
|
-
|
|
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 " + getTooltipPercentage(widget) + " </div> ";
|
|
2110
|
+
|
|
2111
|
+
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>";
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
customToolTip += "</div>";
|
|
2116
|
+
return customToolTip;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
function RenderStackedChartTotalsAndPercentages(widget, seriesMeasures) {
|
|
2120
|
+
if (!widget || !seriesMeasures || !seriesMeasures.MeasureCode) {
|
|
2121
|
+
return false;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
return widget.IsStacked && (seriesMeasures.MeasureCode === "Count" || seriesMeasures.MeasureCode === "Sum");
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
function getGroupValuePercentage(seriesMeasures, groupbyId, secGroupbyId) {
|
|
2128
|
+
var _seriesMeasures$Value;
|
|
2129
|
+
|
|
2130
|
+
if (!groupbyId || !secGroupbyId || !seriesMeasures) {
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
var total = getSumOfGroupValuesAsNumber(seriesMeasures, groupbyId);
|
|
2135
|
+
var value = (_seriesMeasures$Value = seriesMeasures.Values.filter(function (v) {
|
|
2136
|
+
return v.GroupById === groupbyId && v.GroupByIdSec === secGroupbyId;
|
|
2137
|
+
})[0]) === null || _seriesMeasures$Value === void 0 ? void 0 : _seriesMeasures$Value.Value;
|
|
2138
|
+
var percentageValueInLocalFormat = "0";
|
|
2139
|
+
|
|
2140
|
+
if (total !== 0 && value) {
|
|
2141
|
+
percentageValueInLocalFormat = getNumberInSystemLocalFormat(value / total * 100, 2);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
return "<span style=\"margin-right:6px;\">Percentage:</span>" + percentageValueInLocalFormat + "%";
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
function getSumOfGroupValues(seriesMeasure, groupbyId) {
|
|
2148
|
+
if (!groupbyId || !seriesMeasure) {
|
|
2149
|
+
return "";
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
var total = getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId);
|
|
2153
|
+
return "<span style=\"margin-right:6px;\">Total:</span>" + getNumberInSystemLocalFormat(total, 2);
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
function getSumOfGroupValuesAsNumber(seriesMeasure, groupbyId) {
|
|
2157
|
+
if (!groupbyId || !seriesMeasure) {
|
|
2158
|
+
return 0;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
var total = 0;
|
|
2162
|
+
seriesMeasure.Values.filter(function (v) {
|
|
2163
|
+
return v.GroupById === groupbyId;
|
|
2164
|
+
}).forEach(function (v) {
|
|
2165
|
+
total += v.Value;
|
|
2166
|
+
});
|
|
2167
|
+
return total;
|
|
2102
2168
|
}
|
|
2103
2169
|
|
|
2104
2170
|
function getTooltipPercentage(widget) {
|
|
@@ -2308,7 +2374,7 @@ function buildStackedGroupData(secGroup, series, widget) {
|
|
|
2308
2374
|
MeasureCode: series.MeasureCode,
|
|
2309
2375
|
Formula: series.Formula
|
|
2310
2376
|
},
|
|
2311
|
-
tooltext: buildToolTip(widget, null, series, group.label + " - " + secGroup.label, 0)
|
|
2377
|
+
tooltext: buildToolTip(widget, null, series, group.label + " - " + secGroup.label, 0, group.code, secGroup.code)
|
|
2312
2378
|
});
|
|
2313
2379
|
});
|
|
2314
2380
|
return data;
|