logitude-dashboard-library 1.4.22 → 1.4.24
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/assets/styles/dl-dashboard.scss +15 -1
- package/dist/features/Dashboard/ChartsComponents/FusionCharts/FusionChartHelper.d.ts +12 -0
- package/dist/index.js +82 -14
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +82 -14
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -123,6 +123,7 @@ $dark-grey: #717585;
|
|
|
123
123
|
grid-row-gap: 10px;
|
|
124
124
|
height: fit-content;
|
|
125
125
|
padding: 10px;
|
|
126
|
+
padding-top: 0;
|
|
126
127
|
|
|
127
128
|
>div {
|
|
128
129
|
box-sizing: border-box;
|
|
@@ -136,7 +137,7 @@ $dark-grey: #717585;
|
|
|
136
137
|
|
|
137
138
|
.react-grid-layout {
|
|
138
139
|
position: absolute;
|
|
139
|
-
top:
|
|
140
|
+
top: -10px;
|
|
140
141
|
width: 100%;
|
|
141
142
|
}
|
|
142
143
|
}
|
|
@@ -439,6 +440,19 @@ $dark-grey: #717585;
|
|
|
439
440
|
font-family: 'Manrope' !important;
|
|
440
441
|
font-size: 10px !important;
|
|
441
442
|
}
|
|
443
|
+
.db-fc-container text {
|
|
444
|
+
font-family: 'Manrope' !important;
|
|
445
|
+
font-size: 10px !important;
|
|
446
|
+
}
|
|
447
|
+
.db-fc-container tspan {
|
|
448
|
+
font-family: 'Manrope' !important;
|
|
449
|
+
font-size: 10px !important;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.db-fc-container * {
|
|
453
|
+
font-family: 'Manrope' !important;
|
|
454
|
+
font-size: 10px !important;
|
|
455
|
+
}
|
|
442
456
|
|
|
443
457
|
.db-fc-container>*:first-child {
|
|
444
458
|
width: 100%;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChartObject } from "fusioncharts";
|
|
2
|
+
import { ReactWidgetPM } from "../../../../types/widget";
|
|
3
|
+
export declare class FusionChartHelper {
|
|
4
|
+
private chart;
|
|
5
|
+
private dataSource;
|
|
6
|
+
private widget;
|
|
7
|
+
constructor(widget: ReactWidgetPM, chart: ChartObject);
|
|
8
|
+
trimChartLabels(chartWidth: number, chartHeight: number): void;
|
|
9
|
+
private getTrimedLabelText;
|
|
10
|
+
private trimString;
|
|
11
|
+
private numberBetween;
|
|
12
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -483,7 +483,7 @@ function buildDataSource(values, widget) {
|
|
|
483
483
|
data = series.Values.map(function (e, index) {
|
|
484
484
|
var item = {
|
|
485
485
|
value: e.Value,
|
|
486
|
-
label:
|
|
486
|
+
label: e.Label,
|
|
487
487
|
id: {
|
|
488
488
|
GroupById: e.GroupById,
|
|
489
489
|
MeasureFieldId: series.MeasureFieldId
|
|
@@ -496,11 +496,6 @@ function buildDataSource(values, widget) {
|
|
|
496
496
|
return data;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
function getTrimedLabelText(label) {
|
|
500
|
-
if (!label || label.length <= 20) return label;
|
|
501
|
-
return label.substring(0, 17) + "...";
|
|
502
|
-
}
|
|
503
|
-
|
|
504
499
|
function buildDataSet(seriesMeasures, widget) {
|
|
505
500
|
var dataSet = [];
|
|
506
501
|
var seriesPosition = 1;
|
|
@@ -794,6 +789,62 @@ function getDefaultChartInfo(widget) {
|
|
|
794
789
|
return chart;
|
|
795
790
|
}
|
|
796
791
|
|
|
792
|
+
function deepClone(obj) {
|
|
793
|
+
return JSON.parse(JSON.stringify(obj));
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
var FusionChartHelper = /*#__PURE__*/function () {
|
|
797
|
+
function FusionChartHelper(widget, chart) {
|
|
798
|
+
this.chart = chart;
|
|
799
|
+
this.widget = widget;
|
|
800
|
+
this.dataSource = deepClone(chart.dataSource);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
var _proto = FusionChartHelper.prototype;
|
|
804
|
+
|
|
805
|
+
_proto.trimChartLabels = function trimChartLabels(chartWidth, chartHeight) {
|
|
806
|
+
var _this = this;
|
|
807
|
+
|
|
808
|
+
if (!this.widget || this.widget.TypeCode != "pie" && this.widget.TypeCode != "donut") return;
|
|
809
|
+
if (!this.chart || !this.dataSource) return;
|
|
810
|
+
var copyDataSource = deepClone(this.dataSource);
|
|
811
|
+
var data = copyDataSource === null || copyDataSource === void 0 ? void 0 : copyDataSource.data;
|
|
812
|
+
if (!data || data.length == 0) return;
|
|
813
|
+
data.forEach(function (dataItem) {
|
|
814
|
+
dataItem.label = _this.getTrimedLabelText(dataItem.label, chartWidth, chartHeight);
|
|
815
|
+
});
|
|
816
|
+
this.chart.dataSource = copyDataSource;
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
_proto.getTrimedLabelText = function getTrimedLabelText(label, chartWidth, chartHeight) {
|
|
820
|
+
if (!label) return label;
|
|
821
|
+
var charCount = chartWidth / 35;
|
|
822
|
+
var widthHeight = chartWidth / chartHeight;
|
|
823
|
+
|
|
824
|
+
if (WidthGreaterThanHeigh(widthHeight)) {
|
|
825
|
+
charCount = charCount + widthHeight * 3.5;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return this.trimString(label, charCount);
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
_proto.trimString = function trimString(label, charCount) {
|
|
832
|
+
if (label.length <= charCount) return label;
|
|
833
|
+
if (charCount > label.length) return label;
|
|
834
|
+
return label.substring(0, charCount - 2) + "..";
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
_proto.numberBetween = function numberBetween(input, small, large) {
|
|
838
|
+
return input <= large && input >= small;
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
return FusionChartHelper;
|
|
842
|
+
}();
|
|
843
|
+
|
|
844
|
+
function WidthGreaterThanHeigh(widthHeight) {
|
|
845
|
+
return widthHeight > 2.5;
|
|
846
|
+
}
|
|
847
|
+
|
|
797
848
|
ReactFC.fcRoot(FusionCharts, Charts, FusionTheme);
|
|
798
849
|
FusionCharts.options['license']({
|
|
799
850
|
key: 'prD4C-8eiA7A3A3C7E6G4B4A3J4C7B2D3D2nyqE1C3fd1npaE4D4tlA-21D7E4F4F1F1E1F4F1A10A8C2C5F5E2F2D1hwqD1B5D1aG4A19A32twbC6D3G4lhJ-7A9C11A5B-13ddA2I3A1B9B3D7A2B4G2H3H1F-7smC8B2XB4cetB8A7A5mxD3SG4F2tvgB2A3B2E4C3I3C7B3A4A3A2D3D2G4J-7==',
|
|
@@ -820,6 +871,9 @@ var FusionChart = function FusionChart(props) {
|
|
|
820
871
|
setFchart = _useState4[1];
|
|
821
872
|
|
|
822
873
|
var id = (Math.random() + 1).toString(36).substring(7);
|
|
874
|
+
var entered = React.useRef(false);
|
|
875
|
+
var progressRef = React.useRef(null);
|
|
876
|
+
var fusionChartHelper = React.useRef();
|
|
823
877
|
React.useEffect(function () {
|
|
824
878
|
widget.current = props.widget;
|
|
825
879
|
setTimeout(function () {
|
|
@@ -834,10 +888,7 @@ var FusionChart = function FusionChart(props) {
|
|
|
834
888
|
|
|
835
889
|
postWidget.onChange = undefined;
|
|
836
890
|
dashboardAnalyticsService.getData(postWidget).then(function (result) {
|
|
837
|
-
|
|
838
|
-
setArgs(chart);
|
|
839
|
-
console.log(chart);
|
|
840
|
-
setDataLoaded(true);
|
|
891
|
+
handleData(result);
|
|
841
892
|
}, function (error) {
|
|
842
893
|
var _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
843
894
|
|
|
@@ -847,6 +898,16 @@ var FusionChart = function FusionChart(props) {
|
|
|
847
898
|
});
|
|
848
899
|
};
|
|
849
900
|
|
|
901
|
+
var handleData = function handleData(result) {
|
|
902
|
+
var _progressRef$current, _progressRef$current2;
|
|
903
|
+
|
|
904
|
+
var chart = BuildFusionChartObject(result.data, widget.current);
|
|
905
|
+
fusionChartHelper.current = new FusionChartHelper(widget.current, chart);
|
|
906
|
+
fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : fusionChartHelper.current.trimChartLabels(progressRef === null || progressRef === void 0 ? void 0 : (_progressRef$current = progressRef.current) === null || _progressRef$current === void 0 ? void 0 : _progressRef$current.offsetWidth, progressRef === null || progressRef === void 0 ? void 0 : (_progressRef$current2 = progressRef.current) === null || _progressRef$current2 === void 0 ? void 0 : _progressRef$current2.offsetHeight);
|
|
907
|
+
setArgs(chart);
|
|
908
|
+
setDataLoaded(true);
|
|
909
|
+
};
|
|
910
|
+
|
|
850
911
|
var dataplotClick = function dataplotClick(eventObj, dataObj) {
|
|
851
912
|
props.onSelectDataPoint({
|
|
852
913
|
GroupById: dataObj.id.groupbyid,
|
|
@@ -862,14 +923,25 @@ var FusionChart = function FusionChart(props) {
|
|
|
862
923
|
|
|
863
924
|
var _useResizeObserver = useResizeObserver({
|
|
864
925
|
onResize: function onResize(_ref) {
|
|
926
|
+
var _fusionChartHelper$cu;
|
|
927
|
+
|
|
865
928
|
var width = _ref.width,
|
|
866
929
|
height = _ref.height;
|
|
867
930
|
fChart.resizeTo(width, height);
|
|
931
|
+
|
|
932
|
+
if (entered.current == false) {
|
|
933
|
+
entered.current = true;
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
fusionChartHelper === null || fusionChartHelper === void 0 ? void 0 : (_fusionChartHelper$cu = fusionChartHelper.current) === null || _fusionChartHelper$cu === void 0 ? void 0 : _fusionChartHelper$cu.trimChartLabels(width, height);
|
|
938
|
+
setArgs(args);
|
|
868
939
|
}
|
|
869
940
|
}),
|
|
870
941
|
ref = _useResizeObserver.ref;
|
|
871
942
|
|
|
872
943
|
return !dataLoaded ? React__default.createElement("div", {
|
|
944
|
+
ref: progressRef,
|
|
873
945
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
874
946
|
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
875
947
|
style: {
|
|
@@ -1012,10 +1084,6 @@ var WidgetCard = function WidgetCard(props, state) {
|
|
|
1012
1084
|
}
|
|
1013
1085
|
};
|
|
1014
1086
|
|
|
1015
|
-
function deepClone(obj) {
|
|
1016
|
-
return JSON.parse(JSON.stringify(obj));
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
1087
|
var ResponsiveReactGridLayout = reactGridLayout.WidthProvider(reactGridLayout.Responsive);
|
|
1020
1088
|
|
|
1021
1089
|
var DashboardDesigner = function DashboardDesigner(props) {
|