kd-lane-chart-v3 0.1.0 → 0.1.1
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/esm/index.js +46 -62
- package/dist/esm/index.js.map +1 -1
- package/dist/kd-lane-chart-v3.css +4 -4
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -9122,7 +9122,7 @@ const _sfc_main$2 = {
|
|
|
9122
9122
|
}
|
|
9123
9123
|
}
|
|
9124
9124
|
}
|
|
9125
|
-
return [value, +item[axisKey]];
|
|
9125
|
+
return [value, +item[axisKey], item.timestamp];
|
|
9126
9126
|
});
|
|
9127
9127
|
},
|
|
9128
9128
|
generateSeriesDataCached(data, lineInfo, axisKey, paramCodeMap) {
|
|
@@ -9140,7 +9140,7 @@ const _sfc_main$2 = {
|
|
|
9140
9140
|
}
|
|
9141
9141
|
}
|
|
9142
9142
|
}
|
|
9143
|
-
return [value, +item[axisKey]];
|
|
9143
|
+
return [value, +item[axisKey], item.timestamp];
|
|
9144
9144
|
});
|
|
9145
9145
|
},
|
|
9146
9146
|
generateAllSeriesDataCached(data, lineInfo, axisKey, paramCodeMap) {
|
|
@@ -9833,72 +9833,51 @@ const _sfc_main$2 = {
|
|
|
9833
9833
|
}
|
|
9834
9834
|
},
|
|
9835
9835
|
findBoundaryPointPair(currentPoint) {
|
|
9836
|
-
const chartRef = this.getChartRefByLaneId(currentPoint.laneId);
|
|
9837
|
-
if (!chartRef || !chartRef.chart) {
|
|
9838
|
-
return { topPoint: null, bottomPoint: null };
|
|
9839
|
-
}
|
|
9840
|
-
const option = chartRef.chart.getOption();
|
|
9841
9836
|
let topPoint = null;
|
|
9842
9837
|
let bottomPoint = null;
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
const point = data[j];
|
|
9849
|
-
if (!point || !point.value) continue;
|
|
9850
|
-
if (point.lineId === currentPoint.lineId && point.paramId === currentPoint.paramId) {
|
|
9851
|
-
if (point.type === "top") {
|
|
9852
|
-
topPoint = point;
|
|
9853
|
-
} else if (point.type === "bottom") {
|
|
9854
|
-
bottomPoint = point;
|
|
9855
|
-
}
|
|
9856
|
-
}
|
|
9857
|
-
}
|
|
9858
|
-
}
|
|
9859
|
-
if (currentPoint.type === "top" && topPoint) {
|
|
9860
|
-
const nextPoint = option.series.filter((s) => s.type === "scatter").flatMap((s) => s.data || []).find(
|
|
9861
|
-
(p) => p && p.value && p.lineId === currentPoint.lineId && p.paramId === currentPoint.paramId && p.type === "bottom" && p.originalIndex > currentPoint.originalIndex
|
|
9838
|
+
if (currentPoint.type === "top") {
|
|
9839
|
+
topPoint = currentPoint;
|
|
9840
|
+
bottomPoint = this.findBoundaryPointFromRealTimeData(
|
|
9841
|
+
currentPoint,
|
|
9842
|
+
"bottom"
|
|
9862
9843
|
);
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
bottomPoint = this.findBoundaryPointFromRealTimeData(
|
|
9867
|
-
currentPoint,
|
|
9868
|
-
"bottom"
|
|
9869
|
-
);
|
|
9870
|
-
}
|
|
9871
|
-
} else if (currentPoint.type === "bottom" && bottomPoint) {
|
|
9872
|
-
const prevPoint = option.series.filter((s) => s.type === "scatter").flatMap((s) => s.data || []).find(
|
|
9873
|
-
(p) => p && p.value && p.lineId === currentPoint.lineId && p.paramId === currentPoint.paramId && p.type === "top" && p.originalIndex < currentPoint.originalIndex
|
|
9874
|
-
);
|
|
9875
|
-
if (prevPoint) {
|
|
9876
|
-
topPoint = prevPoint;
|
|
9877
|
-
} else {
|
|
9878
|
-
topPoint = this.findBoundaryPointFromRealTimeData(currentPoint, "top");
|
|
9879
|
-
}
|
|
9844
|
+
} else if (currentPoint.type === "bottom") {
|
|
9845
|
+
bottomPoint = currentPoint;
|
|
9846
|
+
topPoint = this.findBoundaryPointFromRealTimeData(currentPoint, "top");
|
|
9880
9847
|
}
|
|
9881
9848
|
return { topPoint, bottomPoint };
|
|
9882
9849
|
},
|
|
9883
9850
|
findBoundaryPointFromRealTimeData(currentPoint, targetType) {
|
|
9884
|
-
const
|
|
9851
|
+
const axisType = this.formCache.axisType;
|
|
9852
|
+
const axisKey = this.currentToolBarConfig.axisTypeList && this.currentToolBarConfig.axisTypeList[axisType] || (axisType === "time" ? "time" : "depth");
|
|
9885
9853
|
const currentYValue = currentPoint.value[1];
|
|
9886
9854
|
const paramId = currentPoint.paramId;
|
|
9855
|
+
const hasTimestamp = axisType === "depth" && this.realTimeData.length > 0 && this.realTimeData[0] && Object.prototype.hasOwnProperty.call(this.realTimeData[0], "timestamp");
|
|
9887
9856
|
let searchStartIndex = -1;
|
|
9888
|
-
const tolerance =
|
|
9857
|
+
const tolerance = axisType === "depth" ? 0.01 : 1e3;
|
|
9889
9858
|
for (let i = 0; i < this.realTimeData.length; i++) {
|
|
9890
9859
|
const item = this.realTimeData[i];
|
|
9891
9860
|
let itemYValue = item[axisKey];
|
|
9892
|
-
if (
|
|
9861
|
+
if (axisType !== "depth") {
|
|
9893
9862
|
itemYValue = this.toMillisecondTimestamp(itemYValue);
|
|
9894
9863
|
} else {
|
|
9895
9864
|
itemYValue = Number(itemYValue);
|
|
9896
9865
|
}
|
|
9897
|
-
if (
|
|
9898
|
-
|
|
9899
|
-
|
|
9866
|
+
if (hasTimestamp) {
|
|
9867
|
+
const itemTimestamp = this.toMillisecondTimestamp(item.timestamp);
|
|
9868
|
+
const pointTimestamp = currentPoint.timestamp ? this.toMillisecondTimestamp(currentPoint.timestamp) : null;
|
|
9869
|
+
if (Math.abs(itemYValue - currentYValue) < tolerance && (!pointTimestamp || itemTimestamp === pointTimestamp)) {
|
|
9870
|
+
searchStartIndex = i;
|
|
9871
|
+
break;
|
|
9872
|
+
}
|
|
9873
|
+
} else {
|
|
9874
|
+
if (Math.abs(itemYValue - currentYValue) < tolerance) {
|
|
9875
|
+
searchStartIndex = i;
|
|
9876
|
+
break;
|
|
9877
|
+
}
|
|
9900
9878
|
}
|
|
9901
9879
|
}
|
|
9880
|
+
console.log("searchStartIndex", searchStartIndex);
|
|
9902
9881
|
if (searchStartIndex === -1) return null;
|
|
9903
9882
|
let boundaryPoint = null;
|
|
9904
9883
|
if (targetType === "bottom") {
|
|
@@ -9907,17 +9886,18 @@ const _sfc_main$2 = {
|
|
|
9907
9886
|
const value = item[paramId];
|
|
9908
9887
|
if (value !== null && value !== void 0 && value !== "" && Number.isFinite(+value)) {
|
|
9909
9888
|
let itemYValue = item[axisKey];
|
|
9910
|
-
if (
|
|
9889
|
+
if (axisType !== "depth") {
|
|
9911
9890
|
itemYValue = this.toMillisecondTimestamp(itemYValue);
|
|
9912
9891
|
} else {
|
|
9913
9892
|
itemYValue = Number(itemYValue);
|
|
9914
9893
|
}
|
|
9915
9894
|
boundaryPoint = {
|
|
9916
|
-
value: [value, itemYValue],
|
|
9895
|
+
value: [value, itemYValue, item.timestamp],
|
|
9917
9896
|
lineId: currentPoint.lineId,
|
|
9918
9897
|
paramId,
|
|
9919
9898
|
type: "bottom",
|
|
9920
|
-
originalIndex: i
|
|
9899
|
+
originalIndex: i,
|
|
9900
|
+
timestamp: hasTimestamp ? item.timestamp : void 0
|
|
9921
9901
|
};
|
|
9922
9902
|
break;
|
|
9923
9903
|
}
|
|
@@ -9925,17 +9905,18 @@ const _sfc_main$2 = {
|
|
|
9925
9905
|
if (!boundaryPoint) {
|
|
9926
9906
|
const lastItem = this.realTimeData[this.realTimeData.length - 1];
|
|
9927
9907
|
let lastYValue = lastItem[axisKey];
|
|
9928
|
-
if (
|
|
9908
|
+
if (axisType !== "depth") {
|
|
9929
9909
|
lastYValue = this.toMillisecondTimestamp(lastYValue);
|
|
9930
9910
|
} else {
|
|
9931
9911
|
lastYValue = Number(lastYValue);
|
|
9932
9912
|
}
|
|
9933
9913
|
boundaryPoint = {
|
|
9934
|
-
value: [lastItem[paramId], lastYValue],
|
|
9914
|
+
value: [lastItem[paramId], lastYValue, lastItem.timestamp],
|
|
9935
9915
|
lineId: currentPoint.lineId,
|
|
9936
9916
|
paramId,
|
|
9937
9917
|
type: "bottom",
|
|
9938
|
-
originalIndex: this.realTimeData.length - 1
|
|
9918
|
+
originalIndex: this.realTimeData.length - 1,
|
|
9919
|
+
timestamp: hasTimestamp ? lastItem.timestamp : void 0
|
|
9939
9920
|
};
|
|
9940
9921
|
}
|
|
9941
9922
|
} else {
|
|
@@ -9944,17 +9925,18 @@ const _sfc_main$2 = {
|
|
|
9944
9925
|
const value = item[paramId];
|
|
9945
9926
|
if (value !== null && value !== void 0 && value !== "" && Number.isFinite(+value)) {
|
|
9946
9927
|
let itemYValue = item[axisKey];
|
|
9947
|
-
if (
|
|
9928
|
+
if (axisType !== "depth") {
|
|
9948
9929
|
itemYValue = this.toMillisecondTimestamp(itemYValue);
|
|
9949
9930
|
} else {
|
|
9950
9931
|
itemYValue = Number(itemYValue);
|
|
9951
9932
|
}
|
|
9952
9933
|
boundaryPoint = {
|
|
9953
|
-
value: [value, itemYValue],
|
|
9934
|
+
value: [value, itemYValue, item.timestamp],
|
|
9954
9935
|
lineId: currentPoint.lineId,
|
|
9955
9936
|
paramId,
|
|
9956
9937
|
type: "top",
|
|
9957
|
-
originalIndex: i
|
|
9938
|
+
originalIndex: i,
|
|
9939
|
+
timestamp: hasTimestamp ? item.timestamp : void 0
|
|
9958
9940
|
};
|
|
9959
9941
|
break;
|
|
9960
9942
|
}
|
|
@@ -9962,17 +9944,18 @@ const _sfc_main$2 = {
|
|
|
9962
9944
|
if (!boundaryPoint) {
|
|
9963
9945
|
const firstItem = this.realTimeData[0];
|
|
9964
9946
|
let firstYValue = firstItem[axisKey];
|
|
9965
|
-
if (
|
|
9947
|
+
if (axisType !== "depth") {
|
|
9966
9948
|
firstYValue = this.toMillisecondTimestamp(firstYValue);
|
|
9967
9949
|
} else {
|
|
9968
9950
|
firstYValue = Number(firstYValue);
|
|
9969
9951
|
}
|
|
9970
9952
|
boundaryPoint = {
|
|
9971
|
-
value: [firstItem[paramId], firstYValue],
|
|
9953
|
+
value: [firstItem[paramId], firstYValue, firstItem.timestamp],
|
|
9972
9954
|
lineId: currentPoint.lineId,
|
|
9973
9955
|
paramId,
|
|
9974
9956
|
type: "top",
|
|
9975
|
-
originalIndex: 0
|
|
9957
|
+
originalIndex: 0,
|
|
9958
|
+
timestamp: hasTimestamp ? firstItem.timestamp : void 0
|
|
9976
9959
|
};
|
|
9977
9960
|
}
|
|
9978
9961
|
}
|
|
@@ -10603,6 +10586,7 @@ const _sfc_main$2 = {
|
|
|
10603
10586
|
const formattedBoundaryPoints = boundaryPoints.map(
|
|
10604
10587
|
(bp) => ({
|
|
10605
10588
|
value: bp.data,
|
|
10589
|
+
timestamp: bp.data[2],
|
|
10606
10590
|
type: bp.type,
|
|
10607
10591
|
originalIndex: bp.originalIndex,
|
|
10608
10592
|
lineId: lineInfo.lineId,
|
|
@@ -11317,7 +11301,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
11317
11301
|
])
|
|
11318
11302
|
], 512);
|
|
11319
11303
|
}
|
|
11320
|
-
const chartContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-
|
|
11304
|
+
const chartContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-2b46ef31"]]);
|
|
11321
11305
|
const _sfc_main$1 = {
|
|
11322
11306
|
name: "ParameterPanel",
|
|
11323
11307
|
props: {
|