logitude-dashboard-library 3.1.3 → 3.1.5
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/features/Dashboard/ChartsComponents/FusionCharts/FusionChartObjectHelper.d.ts +3 -0
- package/dist/features/Dashboard/ChartsComponents/FusionCharts/FusionColors.d.ts +16 -0
- package/dist/index.js +116 -35
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +116 -35
- package/dist/index.modern.js.map +1 -1
- package/dist/services/ApiServices.d.ts +1 -1
- package/dist/services/DashboardAnalyticsService.d.ts +1 -1
- package/package.json +1 -1
|
@@ -83,6 +83,9 @@ export interface ChartInfo {
|
|
|
83
83
|
minPlotHeightForValue: string;
|
|
84
84
|
minAngleForValue: string;
|
|
85
85
|
drawCrossLine: string;
|
|
86
|
+
palettecolors: string;
|
|
87
|
+
plotHoverEffect: string;
|
|
86
88
|
}
|
|
87
89
|
export declare function getSeriesPositionColor(position: number): string | null;
|
|
88
90
|
export declare function getSeriesHoverPositionColor(position: number): string | null;
|
|
91
|
+
export declare const getPlotColorByIndexOrder: (index: number) => string;
|
|
@@ -16,3 +16,19 @@ export declare const grey1Color = "#F6F6F6";
|
|
|
16
16
|
export declare const grey2Color = "#F0F0F0";
|
|
17
17
|
export declare const grey3Color = "#D9D9D9";
|
|
18
18
|
export declare const grey4Color = "#A4A4A4";
|
|
19
|
+
export declare const plotColorsDictionary: {
|
|
20
|
+
plotColor0: string;
|
|
21
|
+
plotColor1: string;
|
|
22
|
+
plotColor2: string;
|
|
23
|
+
plotColor3: string;
|
|
24
|
+
plotColor4: string;
|
|
25
|
+
plotColor5: string;
|
|
26
|
+
plotColor6: string;
|
|
27
|
+
plotColor7: string;
|
|
28
|
+
plotColor8: string;
|
|
29
|
+
plotColor9: string;
|
|
30
|
+
plotColor10: string;
|
|
31
|
+
plotColor11: string;
|
|
32
|
+
plotColor12: string;
|
|
33
|
+
plotColor13: string;
|
|
34
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -140,14 +140,19 @@ var ApiServices = /*#__PURE__*/function () {
|
|
|
140
140
|
});
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
_proto.post = function post(api, date) {
|
|
143
|
+
_proto.post = function post(api, date, requestSignal) {
|
|
144
|
+
if (requestSignal === void 0) {
|
|
145
|
+
requestSignal = undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
144
148
|
var token = this.getTokenFromStorage();
|
|
145
149
|
var apiURL = "" + this._apiUrl + api;
|
|
146
150
|
return axios.post(apiURL, date, {
|
|
147
151
|
headers: {
|
|
148
152
|
'Content-Type': 'application/json',
|
|
149
153
|
'Token': token
|
|
150
|
-
}
|
|
154
|
+
},
|
|
155
|
+
signal: requestSignal
|
|
151
156
|
});
|
|
152
157
|
};
|
|
153
158
|
|
|
@@ -196,8 +201,12 @@ var DashboardAnalyticsService = /*#__PURE__*/function () {
|
|
|
196
201
|
|
|
197
202
|
var _proto = DashboardAnalyticsService.prototype;
|
|
198
203
|
|
|
199
|
-
_proto.getData = function getData(widget) {
|
|
200
|
-
|
|
204
|
+
_proto.getData = function getData(widget, signal) {
|
|
205
|
+
if (signal === void 0) {
|
|
206
|
+
signal = undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return this._ApiServices.post("/api/" + this.controller + "/PostGetDataAnalytic", widget, signal);
|
|
201
210
|
};
|
|
202
211
|
|
|
203
212
|
_proto.getKpiData = function getKpiData(widget) {
|
|
@@ -703,45 +712,81 @@ var CustomChart = function CustomChart(props) {
|
|
|
703
712
|
}, project());
|
|
704
713
|
};
|
|
705
714
|
|
|
706
|
-
var
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
715
|
+
var plotColorsDictionary = {
|
|
716
|
+
plotColor0: "#F6CF33",
|
|
717
|
+
plotColor1: "#EE5F77",
|
|
718
|
+
plotColor2: "#4AC76F",
|
|
719
|
+
plotColor3: "#32C7C7",
|
|
720
|
+
plotColor4: "#369CFB",
|
|
721
|
+
plotColor5: "#935BE0",
|
|
722
|
+
plotColor6: "#FAAD14",
|
|
723
|
+
plotColor7: "#5D62B5",
|
|
724
|
+
plotColor8: "#29C3BE",
|
|
725
|
+
plotColor9: "#F2726F",
|
|
726
|
+
plotColor10: "#FFC533",
|
|
727
|
+
plotColor11: "#62B58F",
|
|
728
|
+
plotColor12: "#BC95DF",
|
|
729
|
+
plotColor13: "#67CDF2"
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
var getPlotColorByIndexOrder = function getPlotColorByIndexOrder(index) {
|
|
733
|
+
var _index = index;
|
|
734
|
+
|
|
735
|
+
if (_index >= 14) {
|
|
736
|
+
_index = _index % 14;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
switch (_index) {
|
|
740
|
+
case 0:
|
|
741
|
+
return plotColorsDictionary.plotColor0;
|
|
713
742
|
|
|
714
|
-
function getSeriesPositionColor(position) {
|
|
715
|
-
switch (position) {
|
|
716
743
|
case 1:
|
|
717
|
-
return
|
|
744
|
+
return plotColorsDictionary.plotColor1;
|
|
718
745
|
|
|
719
746
|
case 2:
|
|
720
|
-
return
|
|
747
|
+
return plotColorsDictionary.plotColor2;
|
|
721
748
|
|
|
722
749
|
case 3:
|
|
723
|
-
return
|
|
750
|
+
return plotColorsDictionary.plotColor3;
|
|
724
751
|
|
|
725
752
|
case 4:
|
|
726
|
-
return
|
|
753
|
+
return plotColorsDictionary.plotColor4;
|
|
727
754
|
|
|
728
755
|
case 5:
|
|
729
|
-
return
|
|
756
|
+
return plotColorsDictionary.plotColor5;
|
|
730
757
|
|
|
731
758
|
case 6:
|
|
732
|
-
return
|
|
759
|
+
return plotColorsDictionary.plotColor6;
|
|
733
760
|
|
|
734
761
|
case 7:
|
|
735
|
-
return
|
|
762
|
+
return plotColorsDictionary.plotColor7;
|
|
763
|
+
|
|
764
|
+
case 8:
|
|
765
|
+
return plotColorsDictionary.plotColor8;
|
|
766
|
+
|
|
767
|
+
case 9:
|
|
768
|
+
return plotColorsDictionary.plotColor9;
|
|
769
|
+
|
|
770
|
+
case 10:
|
|
771
|
+
return plotColorsDictionary.plotColor10;
|
|
772
|
+
|
|
773
|
+
case 11:
|
|
774
|
+
return plotColorsDictionary.plotColor11;
|
|
775
|
+
|
|
776
|
+
case 12:
|
|
777
|
+
return plotColorsDictionary.plotColor12;
|
|
778
|
+
|
|
779
|
+
case 13:
|
|
780
|
+
return plotColorsDictionary.plotColor13;
|
|
736
781
|
|
|
737
782
|
default:
|
|
738
|
-
return
|
|
783
|
+
return "#0566c2";
|
|
739
784
|
}
|
|
740
|
-
}
|
|
785
|
+
};
|
|
741
786
|
|
|
742
787
|
function buildToolTip(widget, value, seriesName, label, index) {
|
|
743
788
|
var padding = widget.TypeCode == 'line' && index > 0 ? 'padding-top: 3px' : '';
|
|
744
|
-
return "\n <div style=\"min-width: 108px;" + padding + "\">\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; height: 10px; width: 10px; background-color:
|
|
789
|
+
return "\n <div style=\"min-width: 108px;" + padding + "\">\n <div style=\"display: flex;align-items: center;margin-bottom: 6px;\">\n <span style=\"margin: 0; height: 10px; width: 10px; background-color: transparent; border-radius: 50%; display: inline-block;\"></span>\n <p style=\" margin: 0; margin-left: 4px;font-family: 'Manrope'; font-style: normal;font-weight: 400; font-size: 11px; line-height: 100%; color: #323232; flex: none; order: 1;flex-grow: 0;\"> " + getTooltiplabel(label) + "</p>\n </div>\n <hr style=\"margin: 0;border-top: 1px solid #F0F0F0;\">\n <div style=\"display: flex;align-items: center;margin:0;margin-top: 6px;\">\n <p style=\"margin: 0;font-family: 'Manrope';font-style: normal;font-weight: 400; font-size: 11px;line-height: 100%;color: #A4A4A4;flex: none;order: 0;flex-grow: 0;\"> " + getMeasureType(seriesName) + "</p>\n <p style=\"margin: 0;margin-left: 6px;font-family: 'Manrope';font-style: normal;font-weight: 500;font-size: 11px;line-height: 100%; color: #323232;flex: none; order: 1;flex-grow: 0;\">" + getTooltipValue(value) + "</p>\n " + getTooltipPercentage(widget) + " </div>\n </div>\n ";
|
|
745
790
|
}
|
|
746
791
|
|
|
747
792
|
function getTooltipPercentage(widget) {
|
|
@@ -830,8 +875,7 @@ function buildDataSource(values, widget) {
|
|
|
830
875
|
MeasureCode: series.MeasureCode,
|
|
831
876
|
Formula: series.Formula
|
|
832
877
|
},
|
|
833
|
-
tooltext: buildToolTip(widget, null, series, e.Label, 0)
|
|
834
|
-
color: getSeriesPositionColor(index + 1)
|
|
878
|
+
tooltext: buildToolTip(widget, null, series, e.Label, 0)
|
|
835
879
|
};
|
|
836
880
|
return item;
|
|
837
881
|
});
|
|
@@ -854,11 +898,10 @@ function buildDataSet(seriesMeasures, widget) {
|
|
|
854
898
|
tooltext: buildToolTip(widget, e.Value, seriesMeasure, null, index)
|
|
855
899
|
};
|
|
856
900
|
});
|
|
857
|
-
var color =
|
|
901
|
+
var color = getPlotColorByIndexOrder(seriesPosition);
|
|
858
902
|
dataSet.push({
|
|
859
903
|
data: datas,
|
|
860
904
|
seriesname: seriesMeasure.Name,
|
|
861
|
-
color: color,
|
|
862
905
|
anchorBgColor: color,
|
|
863
906
|
anchorBorderColor: "#FFFFFF",
|
|
864
907
|
anchorBorderThickness: "2",
|
|
@@ -873,7 +916,6 @@ function buildDataSet(seriesMeasures, widget) {
|
|
|
873
916
|
|
|
874
917
|
function buildStackedDataSet(seriesMeasures, widget) {
|
|
875
918
|
var dataSet = [];
|
|
876
|
-
var seriesPosition = 1;
|
|
877
919
|
var series = seriesMeasures[0];
|
|
878
920
|
var uniqueGroups = [];
|
|
879
921
|
series.Values.forEach(function (element) {
|
|
@@ -885,13 +927,10 @@ function buildStackedDataSet(seriesMeasures, widget) {
|
|
|
885
927
|
});
|
|
886
928
|
});
|
|
887
929
|
uniqueGroups.forEach(function (group) {
|
|
888
|
-
var color = getSeriesPositionColor(seriesPosition);
|
|
889
930
|
dataSet.push({
|
|
890
931
|
seriesName: group.label,
|
|
891
|
-
color: color,
|
|
892
932
|
data: buildStackedGroupData(group, series, widget)
|
|
893
933
|
});
|
|
894
|
-
seriesPosition++;
|
|
895
934
|
});
|
|
896
935
|
var emptylabels = dataSet.filter(function (e) {
|
|
897
936
|
return e.seriesName == null;
|
|
@@ -1251,6 +1290,7 @@ function getDefaultChartInfo(widget) {
|
|
|
1251
1290
|
chart.minAngleForValue = "27";
|
|
1252
1291
|
}
|
|
1253
1292
|
|
|
1293
|
+
chart.palettecolors = "#F6CF33,#EE5F77,#4AC76F,#32C7C7,#369CFB,#935BE0,#FAAD14,#5D62B5, #29C3BE, #F2726F, #FFC533, #62B58F, #BC95DF, #67CDF2";
|
|
1254
1294
|
chart.enableSlicing = "0";
|
|
1255
1295
|
chart.enableRotation = "0";
|
|
1256
1296
|
chart.chartTopMargin = "10";
|
|
@@ -1259,6 +1299,7 @@ function getDefaultChartInfo(widget) {
|
|
|
1259
1299
|
chart.chartRightMargin = "40";
|
|
1260
1300
|
chart.toolTipBgColor = "#FFFFFF";
|
|
1261
1301
|
chart.showToolTipShadow = "1";
|
|
1302
|
+
chart.plotHoverEffect = "0";
|
|
1262
1303
|
chart.scrollHeight = "6";
|
|
1263
1304
|
chart.scrollWidth = "6";
|
|
1264
1305
|
chart.plotColorinTooltip = "0";
|
|
@@ -1415,6 +1456,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1415
1456
|
resizeTimer = _useState4[0],
|
|
1416
1457
|
setResizeTimer = _useState4[1];
|
|
1417
1458
|
|
|
1459
|
+
var axiosController = React.useRef(new AbortController());
|
|
1418
1460
|
var widget = React.useRef();
|
|
1419
1461
|
|
|
1420
1462
|
var _useState5 = React.useState({}),
|
|
@@ -1434,6 +1476,7 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1434
1476
|
React.useEffect(function () {
|
|
1435
1477
|
var _props$dataBinding;
|
|
1436
1478
|
|
|
1479
|
+
axiosController.current = new AbortController();
|
|
1437
1480
|
widget.current = props.widget;
|
|
1438
1481
|
RefreshData();
|
|
1439
1482
|
(_props$dataBinding = props.dataBinding) === null || _props$dataBinding === void 0 ? void 0 : _props$dataBinding.widgetUpdated.subscribe(function (updatedWidget) {
|
|
@@ -1450,7 +1493,16 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1450
1493
|
});
|
|
1451
1494
|
window.addEventListener("resize", handleResize);
|
|
1452
1495
|
return function () {
|
|
1453
|
-
|
|
1496
|
+
var _axiosController$curr;
|
|
1497
|
+
|
|
1498
|
+
window.removeEventListener("resize", handleResize);
|
|
1499
|
+
setDataLoaded(false);
|
|
1500
|
+
|
|
1501
|
+
if (axiosController && axiosController !== null && axiosController !== void 0 && (_axiosController$curr = axiosController.current) !== null && _axiosController$curr !== void 0 && _axiosController$curr.abort) {
|
|
1502
|
+
var _axiosController$curr2;
|
|
1503
|
+
|
|
1504
|
+
axiosController === null || axiosController === void 0 ? void 0 : (_axiosController$curr2 = axiosController.current) === null || _axiosController$curr2 === void 0 ? void 0 : _axiosController$curr2.abort();
|
|
1505
|
+
}
|
|
1454
1506
|
};
|
|
1455
1507
|
}, []);
|
|
1456
1508
|
|
|
@@ -1499,9 +1551,21 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1499
1551
|
var postWidget = _extends({}, widget.current);
|
|
1500
1552
|
|
|
1501
1553
|
postWidget.onChange = undefined;
|
|
1502
|
-
|
|
1554
|
+
var signal = undefined;
|
|
1555
|
+
|
|
1556
|
+
if (axiosController) {
|
|
1557
|
+
var _axiosController$curr3;
|
|
1558
|
+
|
|
1559
|
+
axiosController === null || axiosController === void 0 ? void 0 : (_axiosController$curr3 = axiosController.current) === null || _axiosController$curr3 === void 0 ? void 0 : _axiosController$curr3.abort();
|
|
1560
|
+
var updatedAxiosController = new AbortController();
|
|
1561
|
+
axiosController.current = updatedAxiosController;
|
|
1562
|
+
signal = updatedAxiosController === null || updatedAxiosController === void 0 ? void 0 : updatedAxiosController.signal;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
dashboardAnalyticsService.getData(postWidget, signal).then(function (result) {
|
|
1503
1566
|
handleData(result === null || result === void 0 ? void 0 : result.data);
|
|
1504
1567
|
chartData.current = result === null || result === void 0 ? void 0 : result.data;
|
|
1568
|
+
setDataLoaded(true);
|
|
1505
1569
|
}, function (error) {
|
|
1506
1570
|
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
1507
1571
|
|
|
@@ -1552,6 +1616,21 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1552
1616
|
setFchart(chart);
|
|
1553
1617
|
};
|
|
1554
1618
|
|
|
1619
|
+
var loaded = function loaded(event) {
|
|
1620
|
+
var chartData = event.sender.getChartData();
|
|
1621
|
+
|
|
1622
|
+
if (chartData && chartData.dataset && chartData.dataset.length) {
|
|
1623
|
+
chartData.dataset.forEach(function (el, index) {
|
|
1624
|
+
el.data.forEach(function (item) {
|
|
1625
|
+
var color = getPlotColorByIndexOrder(index);
|
|
1626
|
+
item.tooltext = item.tooltext.replaceAll("transparent", color);
|
|
1627
|
+
});
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
setArgs(_extends({}, chartData));
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1555
1634
|
return !dataLoaded ? React__default.createElement("div", {
|
|
1556
1635
|
ref: progressRef,
|
|
1557
1636
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
@@ -1566,12 +1645,14 @@ var FusionChart = React.forwardRef(function (props, comRef) {
|
|
|
1566
1645
|
className: 'db-fc-parent-container',
|
|
1567
1646
|
ref: fusionRef
|
|
1568
1647
|
}, React__default.createElement("div", {
|
|
1569
|
-
key: fusionKey,
|
|
1570
1648
|
className: 'db-fc-container',
|
|
1571
1649
|
ref: ref,
|
|
1572
1650
|
id: chartContainerId
|
|
1573
|
-
}, React__default.createElement(ReactFC, Object.assign({
|
|
1651
|
+
}, React__default.createElement(ReactFC, Object.assign({
|
|
1652
|
+
key: fusionKey
|
|
1653
|
+
}, args, {
|
|
1574
1654
|
"fcEvent-dataplotClick": dataplotClick,
|
|
1655
|
+
"fcEvent-loaded": loaded,
|
|
1575
1656
|
onRender: renderComplete
|
|
1576
1657
|
})))) : React__default.createElement("div", {
|
|
1577
1658
|
className: "dl-flex-content-center dl-full-hight",
|