kd-lane-chart-v3 0.1.21 → 0.1.23

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 CHANGED
@@ -3776,6 +3776,15 @@ const _sfc_main$8 = /* @__PURE__ */ Object.assign({
3776
3776
  emits: ["updateLine"],
3777
3777
  setup(__props, { emit: __emit }) {
3778
3778
  const { formatParamLabel: formatParamLabel2, currentLocale } = useKdI18n();
3779
+ function headerScale(setValue, fallback) {
3780
+ if (setValue !== void 0 && setValue !== null && setValue !== "" && Number.isFinite(Number(setValue))) {
3781
+ return Number(setValue);
3782
+ }
3783
+ if (fallback !== void 0 && fallback !== null && fallback !== "" && Number.isFinite(Number(fallback))) {
3784
+ return Number(fallback);
3785
+ }
3786
+ return 0;
3787
+ }
3779
3788
  const props = __props;
3780
3789
  const emit = __emit;
3781
3790
  function getFontSize(type) {
@@ -3921,7 +3930,7 @@ const _sfc_main$8 = /* @__PURE__ */ Object.assign({
3921
3930
  onClick: toggleIsUsed
3922
3931
  }, [
3923
3932
  createElementVNode("div", _hoisted_1$8, [
3924
- createElementVNode("span", _hoisted_2$7, toDisplayString(__props.line.min || __props.lineRange[__props.line.lineId] && __props.lineRange[__props.line.lineId].min || 0), 1),
3933
+ createElementVNode("span", _hoisted_2$7, toDisplayString(headerScale(__props.line.min, __props.lineRange[__props.line.lineId] && __props.lineRange[__props.line.lineId].min)), 1),
3925
3934
  createElementVNode("div", _hoisted_3$6, [
3926
3935
  createElementVNode("div", {
3927
3936
  class: "paramsTitle",
@@ -3933,7 +3942,7 @@ const _sfc_main$8 = /* @__PURE__ */ Object.assign({
3933
3942
  style: normalizeStyle(getFontSize("data"))
3934
3943
  }, toDisplayString(getCurrentData()), 5)) : createCommentVNode("", true)
3935
3944
  ]),
3936
- createElementVNode("span", _hoisted_4$6, toDisplayString(__props.line.max || __props.lineRange[__props.line.lineId] && __props.lineRange[__props.line.lineId].max || 0), 1),
3945
+ createElementVNode("span", _hoisted_4$6, toDisplayString(headerScale(__props.line.max, __props.lineRange[__props.line.lineId] && __props.lineRange[__props.line.lineId].max)), 1),
3937
3946
  createElementVNode("div", {
3938
3947
  class: "gradient-display",
3939
3948
  style: normalizeStyle(gradientDisplay.value)
@@ -3943,7 +3952,7 @@ const _sfc_main$8 = /* @__PURE__ */ Object.assign({
3943
3952
  };
3944
3953
  }
3945
3954
  });
3946
- const HeaderItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-bea65042"]]);
3955
+ const HeaderItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-9b99d168"]]);
3947
3956
  const _hoisted_1$7 = { class: "legend-label" };
3948
3957
  const _hoisted_2$6 = { class: "legend-content" };
3949
3958
  const _hoisted_3$5 = { class: "scale-left" };
@@ -4014,6 +4023,15 @@ const _sfc_main$7 = /* @__PURE__ */ Object.assign({
4014
4023
  emits: ["updateLine"],
4015
4024
  setup(__props, { emit: __emit }) {
4016
4025
  const { formatParamLabel: formatParamLabel2, $kdInnerTrans, currentLocale } = useKdI18n();
4026
+ function headerScale(setValue, fallback) {
4027
+ if (setValue !== void 0 && setValue !== null && setValue !== "" && Number.isFinite(Number(setValue))) {
4028
+ return Number(setValue);
4029
+ }
4030
+ if (fallback !== void 0 && fallback !== null && fallback !== "" && Number.isFinite(Number(fallback))) {
4031
+ return Number(fallback);
4032
+ }
4033
+ return 0;
4034
+ }
4017
4035
  const props = __props;
4018
4036
  const emit = __emit;
4019
4037
  function getParamName() {
@@ -4092,7 +4110,7 @@ const _sfc_main$7 = /* @__PURE__ */ Object.assign({
4092
4110
  }, [
4093
4111
  createElementVNode("div", _hoisted_1$7, toDisplayString(getParamName()), 1),
4094
4112
  createElementVNode("div", _hoisted_2$6, [
4095
- createElementVNode("div", _hoisted_3$5, toDisplayString(__props.line.min || 0), 1),
4113
+ createElementVNode("div", _hoisted_3$5, toDisplayString(headerScale(__props.line.min, __props.lineRange[__props.line.lineId] && __props.lineRange[__props.line.lineId].min)), 1),
4096
4114
  createElementVNode("div", {
4097
4115
  class: "legend-lines",
4098
4116
  style: normalizeStyle({ flexDirection: __props.formCache.displayType == "header" ? "column" : "row" })
@@ -4115,13 +4133,13 @@ const _sfc_main$7 = /* @__PURE__ */ Object.assign({
4115
4133
  ], 12, _hoisted_4$5);
4116
4134
  }), 128))
4117
4135
  ], 4),
4118
- createElementVNode("div", _hoisted_8$2, toDisplayString(__props.line.max || 20), 1)
4136
+ createElementVNode("div", _hoisted_8$2, toDisplayString(headerScale(__props.line.max, __props.lineRange[__props.line.lineId] && __props.lineRange[__props.line.lineId].max)), 1)
4119
4137
  ])
4120
4138
  ], 4);
4121
4139
  };
4122
4140
  }
4123
4141
  });
4124
- const LegendItem = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-bd30757b"]]);
4142
+ const LegendItem = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-a7582d60"]]);
4125
4143
  const TREND_LINE_STYLE = {
4126
4144
  stroke: "#FF9800",
4127
4145
  lineWidth: 2,
@@ -12456,7 +12474,7 @@ const _hoisted_2$2 = {
12456
12474
  key: 1,
12457
12475
  class: "kd-depth-axis-labels"
12458
12476
  };
12459
- const _hoisted_3$1 = ["onMouseenter", "onClick"];
12477
+ const _hoisted_3$1 = ["onMouseenter", "onMouseleave", "onClick"];
12460
12478
  const _hoisted_4$1 = ["onClick"];
12461
12479
  const _hoisted_5 = ["onClick"];
12462
12480
  const _sfc_main$2 = /* @__PURE__ */ Object.assign({
@@ -12687,6 +12705,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
12687
12705
  const currentContextMenuType = ref(null);
12688
12706
  const activeSubMenu = ref(null);
12689
12707
  const subMenuDirection = ref("right");
12708
+ const subMenuOffsetTop = ref(0);
12709
+ const subMenuOffsetLeft = ref(0);
12690
12710
  const params = ref([]);
12691
12711
  const contextItem = ref(void 0);
12692
12712
  const realTimeData = ref([]);
@@ -12776,6 +12796,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
12776
12796
  currentContextMenuType,
12777
12797
  activeSubMenu,
12778
12798
  subMenuDirection,
12799
+ subMenuOffsetTop,
12800
+ subMenuOffsetLeft,
12779
12801
  params,
12780
12802
  contextItem,
12781
12803
  realTimeData,
@@ -12903,6 +12925,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
12903
12925
  if (proxy._isUnmounted || !proxy._chartRedrawQueued) return;
12904
12926
  proxy._chartRedrawQueued = false;
12905
12927
  if (proxy.isUpdatingChart) {
12928
+ proxy._pendingOnlyLaneIds = void 0;
12929
+ proxy._pendingFullChart = true;
12906
12930
  proxy.pendingChartUpdate = true;
12907
12931
  return;
12908
12932
  }
@@ -13865,7 +13889,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13865
13889
  const tipH = content[1] || 80;
13866
13890
  const viewW = view[0] || 200;
13867
13891
  const viewH = view[1] || 400;
13868
- const cy = Array.isArray(point) && Number.isFinite(point[1]) ? point[1] : 0;
13892
+ const anchored = Number(proxy._tooltipAnchorY);
13893
+ const cy = Number.isFinite(anchored) ? anchored : Array.isArray(point) && Number.isFinite(point[1]) ? point[1] : 0;
13869
13894
  let x = 4;
13870
13895
  let y = cy + 12;
13871
13896
  if (y + tipH > viewH - 4) y = Math.max(4, cy - tipH - 12);
@@ -13875,7 +13900,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13875
13900
  function getLaneTooltipExtraCss() {
13876
13901
  return "pointer-events: none !important; max-width: 92%; box-sizing: border-box; white-space: normal; word-break: break-all;";
13877
13902
  }
13878
- function buildHelperTipRailData(helperX, groupMin, groupMax, steps = 48) {
13903
+ function buildHelperTipRailData(helperX, groupMin, groupMax, steps = 400) {
13879
13904
  const lo = Number(groupMin);
13880
13905
  const hi = Number(groupMax);
13881
13906
  const x = Number(helperX);
@@ -13914,14 +13939,67 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13914
13939
  }
13915
13940
  }
13916
13941
  }
13942
+ function restoreCoveredAxisTicks() {
13943
+ const covered = proxy._hoverCoveredTicks || [];
13944
+ for (let i = 0; i < covered.length; i++) {
13945
+ if (covered[i]) covered[i].style.visibility = "";
13946
+ }
13947
+ proxy._hoverCoveredTicks = [];
13948
+ }
13949
+ function hideLaneCrosshairSegments() {
13950
+ restoreCoveredAxisTicks();
13951
+ const pool = proxy._laneCrosshairEls || [];
13952
+ for (let i = 0; i < pool.length; i++) {
13953
+ if (pool[i]) pool[i].style.display = "none";
13954
+ }
13955
+ }
13917
13956
  function updateCrosshairLine(sourceChart, offsetY) {
13918
- const wrap = proxy.$refs.chartAreaWrap;
13919
- const el = proxy.$refs.crosshairLine;
13920
- const chartDom = sourceChart.getDom();
13921
- if (!wrap || !el || !chartDom) return;
13922
- const top = chartDom.getBoundingClientRect().top - wrap.getBoundingClientRect().top + offsetY;
13923
- el.style.transform = `translate3d(0, ${top}px, 0)`;
13924
- if (!proxy.crosshairVisible) proxy.crosshairVisible = true;
13957
+ const chartDom = sourceChart && sourceChart.getDom && sourceChart.getDom();
13958
+ if (!chartDom) return;
13959
+ proxy.crosshairVisible = false;
13960
+ restoreCoveredAxisTicks();
13961
+ const sourceTop = chartDom.getBoundingClientRect().top;
13962
+ if (!proxy._laneCrosshairEls) proxy._laneCrosshairEls = [];
13963
+ const pool = proxy._laneCrosshairEls;
13964
+ const charts = proxy.getConnectedCharts();
13965
+ let i = 0;
13966
+ for (let c = 0; c < charts.length; c++) {
13967
+ const chart = charts[c];
13968
+ if (!chart || chart.isDisposed()) continue;
13969
+ const dom = chart.getDom();
13970
+ if (!dom) continue;
13971
+ const localY = offsetY + sourceTop - dom.getBoundingClientRect().top;
13972
+ let seg = pool[i];
13973
+ if (!seg) {
13974
+ seg = document.createElement("div");
13975
+ seg.className = "kd-lane-crosshair-seg";
13976
+ const depth = document.createElement("span");
13977
+ depth.className = "kd-lane-crosshair-seg__depth";
13978
+ seg.appendChild(depth);
13979
+ pool[i] = seg;
13980
+ }
13981
+ if (seg.parentElement !== dom) dom.appendChild(seg);
13982
+ let depthEl = seg.querySelector(".kd-lane-crosshair-seg__depth");
13983
+ if (!depthEl) {
13984
+ depthEl = document.createElement("span");
13985
+ depthEl.className = "kd-lane-crosshair-seg__depth";
13986
+ seg.appendChild(depthEl);
13987
+ }
13988
+ const depthText = proxy._lastTooltipAxisLabel || "";
13989
+ const lane = proxy.findLaneById(proxy.findLaneIdByChart(chart));
13990
+ const isAxisLane = proxy.isDepthOrTimeLane(lane);
13991
+ if (depthEl) {
13992
+ depthEl.textContent = isAxisLane ? "" : depthText;
13993
+ depthEl.classList.remove("is-axis");
13994
+ depthEl.style.display = !isAxisLane && depthText ? "" : "none";
13995
+ }
13996
+ seg.style.display = "block";
13997
+ seg.style.transform = `translate3d(0, ${localY}px, 0)`;
13998
+ i++;
13999
+ }
14000
+ for (let j = i; j < pool.length; j++) {
14001
+ pool[j].style.display = "none";
14002
+ }
13925
14003
  }
13926
14004
  function schedulePointerSync(chart, x, y, clientY) {
13927
14005
  proxy.pointerInChartArea = true;
@@ -13933,11 +14011,14 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13933
14011
  const hit = proxy.getYValueFromChart(sourceChart, offsetX, offsetY);
13934
14012
  if (!hit) {
13935
14013
  proxy.crosshairVisible = false;
14014
+ hideLaneCrosshairSegments();
13936
14015
  return;
13937
14016
  }
13938
14017
  proxy._lastTooltipY = hit.yValue;
13939
14018
  proxy._lastTooltipOffsetY = offsetY;
13940
14019
  proxy._lastTooltipGridIndex = hit.gridIndex;
14020
+ const row = proxy.findRowByAxisValue(hit.yValue);
14021
+ proxy._lastTooltipAxisLabel = proxy.formatAxisPointerYLabel(hit.yValue, row);
13941
14022
  proxy.updateCrosshairLine(sourceChart, offsetY);
13942
14023
  proxy.showSyncedLaneTooltips(hit.yValue, offsetY, hit.gridIndex);
13943
14024
  }
@@ -13982,6 +14063,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
13982
14063
  proxy._lastAxisPx.set(chart, axisKey);
13983
14064
  const canShowTip = needTip && proxy.shouldShowTooltipContent(laneId) && lane && lane.lines && lane.lines.length > 0 && proxy.laneHasAnyValidPlotPoint(chart, laneId);
13984
14065
  if (canShowTip) {
14066
+ if (Number.isFinite(y)) proxy._tooltipAnchorY = y;
13985
14067
  const tipKey = `${axisKey}:${Number(yValue).toFixed(2)}`;
13986
14068
  proxy._lastTipKey.set(chart, tipKey);
13987
14069
  const helperHit = proxy.findHelperTooltipAnchor(
@@ -14099,6 +14181,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14099
14181
  }
14100
14182
  function applyWindowChartPan(native) {
14101
14183
  if (!proxy._isPanning || proxy._windowPanStartY == null || !native) return;
14184
+ proxy._pendingDepthWindow = null;
14102
14185
  const clientY = native.clientY;
14103
14186
  if (!Number.isFinite(clientY)) return;
14104
14187
  const h = proxy.getChartPlotHeightPx();
@@ -14148,15 +14231,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14148
14231
  });
14149
14232
  if (!proxy._isPanning) proxy.trendLineManager.endFollowView();
14150
14233
  }
14151
- if (!proxy._isPanning && !proxy.isUpdatingChart) {
14152
- if (proxy._needFullChartAfterInteract) {
14153
- proxy._needFullChartAfterInteract = false;
14154
- proxy.updateLanesChartOption();
14155
- } else {
14156
- proxy.patchVisibleSeries();
14157
- proxy.scheduleAllDepthAxisLabelSync();
14158
- }
14159
- }
14234
+ if (!proxy._isPanning) flushInteractionPaint();
14160
14235
  proxy.flushVisibleDataChange();
14161
14236
  proxy.restorePointerAfterInteract();
14162
14237
  }
@@ -14170,24 +14245,44 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14170
14245
  });
14171
14246
  proxy.trendLineManager.endFollowView();
14172
14247
  }
14173
- if (!proxy.isUpdatingChart) {
14174
- if (proxy._needFullChartAfterInteract) {
14175
- proxy._needFullChartAfterInteract = false;
14176
- proxy.updateLanesChartOption();
14177
- } else {
14178
- proxy.patchVisibleSeries();
14179
- proxy.scheduleAllDepthAxisLabelSync();
14180
- }
14181
- }
14248
+ flushInteractionPaint();
14182
14249
  proxy.flushVisibleDataChange();
14183
14250
  proxy.restorePointerAfterInteract();
14184
14251
  }
14252
+ function flushInteractionPaint() {
14253
+ if (proxy._isUnmounted) return;
14254
+ if (proxy.isUpdatingChart) {
14255
+ proxy._pendingInteractionPatch = true;
14256
+ return;
14257
+ }
14258
+ proxy._pendingInteractionPatch = false;
14259
+ if (proxy._needFullChartAfterInteract) {
14260
+ proxy._needFullChartAfterInteract = false;
14261
+ proxy.updateLanesChartOption();
14262
+ return;
14263
+ }
14264
+ proxy.patchVisibleSeries();
14265
+ proxy.scheduleAllDepthAxisLabelSync();
14266
+ }
14267
+ function scheduleDeferredFullPaint() {
14268
+ proxy._needFullChartAfterInteract = true;
14269
+ if (proxy._interactFullTimer) return;
14270
+ proxy._interactFullTimer = setTimeout(() => {
14271
+ proxy._interactFullTimer = 0;
14272
+ if (proxy._isUnmounted) return;
14273
+ flushInteractionPaint();
14274
+ }, 80);
14275
+ }
14185
14276
  function scheduleInteractionPatch() {
14186
14277
  if (proxy._interactPatchRaf) return;
14187
14278
  proxy._interactPatchRaf = requestAnimationFrame(() => {
14188
14279
  proxy._interactPatchRaf = 0;
14189
14280
  if (proxy._isUnmounted) return;
14190
- if (!proxy.isUpdatingChart) proxy.patchVisibleSeries();
14281
+ if (proxy.isUpdatingChart) {
14282
+ proxy._pendingInteractionPatch = true;
14283
+ return;
14284
+ }
14285
+ proxy.patchVisibleSeries();
14191
14286
  });
14192
14287
  }
14193
14288
  function dispatchVisibleDataChange(val) {
@@ -14248,6 +14343,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14248
14343
  proxy._lastTipKey = /* @__PURE__ */ new WeakMap();
14249
14344
  proxy._lastAxisPx = /* @__PURE__ */ new WeakMap();
14250
14345
  proxy.crosshairVisible = false;
14346
+ hideLaneCrosshairSegments();
14251
14347
  if (proxy.formCache.displayType === "header") {
14252
14348
  proxy.headerData = {};
14253
14349
  }
@@ -14361,11 +14457,31 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14361
14457
  });
14362
14458
  });
14363
14459
  }
14460
+ function templateLayoutKey(template) {
14461
+ const lanes = template && template.lanes || [];
14462
+ let key = "";
14463
+ for (let i = 0; i < lanes.length; i++) {
14464
+ const lane = lanes[i];
14465
+ if (i) key += "|";
14466
+ key += lane && lane.laneId != null ? lane.laneId : "";
14467
+ key += ":";
14468
+ const lines = lane && lane.lines || [];
14469
+ for (let j = 0; j < lines.length; j++) {
14470
+ if (j) key += ",";
14471
+ const line = lines[j];
14472
+ key += line && line.lineId != null ? line.lineId : "";
14473
+ }
14474
+ }
14475
+ return key;
14476
+ }
14364
14477
  async function templateChange(template) {
14365
- if (template && template === proxy.currentTemplate) {
14478
+ const sameRef = !!(template && template === proxy.currentTemplate);
14479
+ const layoutKey = templateLayoutKey(template || proxy.currentTemplate);
14480
+ if (sameRef && layoutKey === proxy._templateLayoutKey) {
14366
14481
  return;
14367
14482
  }
14368
- proxy.currentTemplate = template;
14483
+ if (!sameRef) proxy.currentTemplate = template;
14484
+ proxy._templateLayoutKey = layoutKey;
14369
14485
  proxy.getLatestLineDataByParamCode();
14370
14486
  let migratedLanes = null;
14371
14487
  if (proxy.trendLineManager) {
@@ -14808,7 +14924,66 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
14808
14924
  const next = proxy.resolveAllowedScale(metersPerCm, metersPerCm);
14809
14925
  proxy.syncScaleSelection(next);
14810
14926
  }
14927
+ function axisBoundIsSet(v) {
14928
+ return v !== void 0 && v !== null && v !== "" && Number.isFinite(Number(v));
14929
+ }
14930
+ function collectRelatedAxisValues(lineInfo, rows, axisKey) {
14931
+ const values = [];
14932
+ if (!lineInfo || !rows || !rows.length) return values;
14933
+ const ids = [];
14934
+ if (lineInfo.paramId) ids.push(lineInfo.paramId);
14935
+ if (lineInfo.recommendParamId && (lineInfo.recommendIsUsed === "1" || lineInfo.recommendIsUsed == 1)) {
14936
+ ids.push(lineInfo.recommendParamId);
14937
+ }
14938
+ if (lineInfo.upperParamId) ids.push(lineInfo.upperParamId);
14939
+ if (lineInfo.lowerParamId) ids.push(lineInfo.lowerParamId);
14940
+ const seen = /* @__PURE__ */ new Set();
14941
+ for (let i = 0; i < ids.length; i++) {
14942
+ const id = ids[i];
14943
+ const key = String(id);
14944
+ if (seen.has(key)) continue;
14945
+ seen.add(key);
14946
+ const series = proxy.generateSeriesData(rows, { paramId: id }, axisKey);
14947
+ for (let j = 0; j < series.length; j++) {
14948
+ const raw = series[j] && series[j][0];
14949
+ if (isMissingCurveValue(raw)) continue;
14950
+ const n = Number(raw);
14951
+ if (Number.isFinite(n)) values.push(n);
14952
+ }
14953
+ }
14954
+ return values;
14955
+ }
14956
+ function axisSamplesForLine(lineInfo, rows, axisKey, mainSeries) {
14957
+ if (!lineInfo) return mainSeries || [];
14958
+ if (axisBoundIsSet(lineInfo.min) && axisBoundIsSet(lineInfo.max)) {
14959
+ return mainSeries || [];
14960
+ }
14961
+ const full = proxy.realTimeData;
14962
+ const sampleRows = Array.isArray(full) && full.length ? full : rows;
14963
+ const related = collectRelatedAxisValues(lineInfo, sampleRows, axisKey);
14964
+ return related.length ? related : mainSeries || [];
14965
+ }
14966
+ function laneOptionHasCurve(option) {
14967
+ const series = option && option.series;
14968
+ if (!series || !series.length) return false;
14969
+ for (let i = 0; i < series.length; i++) {
14970
+ const item = series[i];
14971
+ if (!item || !item.data || !item.data.length) continue;
14972
+ const name = item.name;
14973
+ if (name === "helper" || name === "log-grid" || name === "trend") continue;
14974
+ return true;
14975
+ }
14976
+ return false;
14977
+ }
14811
14978
  function getXAxisRangeByHeader(lineInfo, validData = []) {
14979
+ const lineIdEarly = lineInfo && lineInfo.lineId;
14980
+ if (proxy._freezeAxisRange && lineIdEarly != null) {
14981
+ const store = proxy._lineRangeDraft || proxy.lineRange || {};
14982
+ const prev = store[lineIdEarly];
14983
+ if (prev && Number.isFinite(Number(prev.min)) && Number.isFinite(Number(prev.max))) {
14984
+ return { min: Number(prev.min), max: Number(prev.max) };
14985
+ }
14986
+ }
14812
14987
  let headerMin = 0;
14813
14988
  let headerMax = 1;
14814
14989
  const numericValues = (validData || []).reduce((acc, item) => {
@@ -15747,7 +15922,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15747
15922
  const gridCount = proxy.readGridCount(chart);
15748
15923
  if (!gridCount || gridCount !== groups.length) {
15749
15924
  if (proxy._isZooming || proxy._isPanning || proxy._isWheelAnimating) {
15750
- proxy._needFullChartAfterInteract = true;
15925
+ scheduleDeferredFullPaint();
15751
15926
  return;
15752
15927
  }
15753
15928
  if (!proxy.isUpdatingChart) proxy.updateLanesChartOption();
@@ -15895,7 +16070,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
15895
16070
  }))
15896
16071
  };
15897
16072
  try {
15898
- chart.setOption(patch, { lazyUpdate: true, silent: true });
16073
+ const liveInteract = !!(proxy._isPanning || proxy._isZooming || proxy._isWheelAnimating);
16074
+ chart.setOption(patch, { lazyUpdate: liveInteract, silent: true });
15899
16075
  } catch (e) {
15900
16076
  }
15901
16077
  });
@@ -16236,6 +16412,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16236
16412
  await nextTick();
16237
16413
  if (proxy._isUnmounted) return;
16238
16414
  if (proxy.isUpdatingChart) {
16415
+ proxy._pendingOnlyLaneIds = void 0;
16416
+ proxy._pendingFullChart = true;
16239
16417
  proxy.pendingChartUpdate = true;
16240
16418
  return;
16241
16419
  }
@@ -16443,6 +16621,28 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16443
16621
  }
16444
16622
  return null;
16445
16623
  }
16624
+ function buildSyncedAxisPointer(show) {
16625
+ return {
16626
+ show: true,
16627
+ snap: false,
16628
+ type: "line",
16629
+ triggerTooltip: false,
16630
+ // 趋势线 graphic 的 z 是 9999,横线再低会被盖住,有的道看起来没有位置线
16631
+ z: 10001,
16632
+ animation: false,
16633
+ label: {
16634
+ // 画布边缘的轴标签会被泳道裁掉,深度改由每道十字线上的文字显示
16635
+ show: false,
16636
+ backgroundColor: `${getCssVariable("--kd-lane-container-border-color")}99`,
16637
+ color: `${getCssVariable("--default-text-color")}`,
16638
+ formatter: () => proxy._lastTooltipAxisLabel || ""
16639
+ },
16640
+ lineStyle: {
16641
+ type: "dashed",
16642
+ width: 1
16643
+ }
16644
+ };
16645
+ }
16446
16646
  function getDefaultLaneChartOption() {
16447
16647
  const option = {
16448
16648
  backgroundColor: getCssVariable("--kd-lane-container-item-bg"),
@@ -16506,9 +16706,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16506
16706
  axisTick: {
16507
16707
  show: false
16508
16708
  },
16509
- axisPointer: {
16510
- show: true
16511
- }
16709
+ axisPointer: buildSyncedAxisPointer()
16512
16710
  }
16513
16711
  ],
16514
16712
  dataZoom: [proxy.buildInsideDataZoom()],
@@ -16516,7 +16714,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16516
16714
  tooltip: {
16517
16715
  show: true,
16518
16716
  showContent: proxy.showTooltip,
16519
- trigger: "axis",
16717
+ trigger: "item",
16520
16718
  triggerOn: "none",
16521
16719
  triggerEmphasis: false,
16522
16720
  enterable: false,
@@ -16544,7 +16742,9 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16544
16742
  backgroundColor: getCssVariable("--tooltip-bg-color"),
16545
16743
  borderWidth: 0,
16546
16744
  textStyle: {
16547
- color: getCssVariable("--default-text-color")
16745
+ color: getCssVariable("--default-text-color"),
16746
+ fontSize: 12,
16747
+ fontFamily: "Arial, sans-serif"
16548
16748
  },
16549
16749
  formatter: () => proxy.renderLaneTooltipHtml(proxy._tooltipLaneId)
16550
16750
  }
@@ -16605,6 +16805,12 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16605
16805
  async function updateLanesChartOption(transferData, onlyLaneIds) {
16606
16806
  if (proxy._isUnmounted) return;
16607
16807
  if (proxy.isUpdatingChart) {
16808
+ if (onlyLaneIds == null || onlyLaneIds === "" || onlyLaneIds === "series") {
16809
+ proxy._pendingOnlyLaneIds = void 0;
16810
+ proxy._pendingFullChart = true;
16811
+ } else if (!proxy._pendingFullChart) {
16812
+ proxy._pendingOnlyLaneIds = onlyLaneIds;
16813
+ }
16608
16814
  proxy.pendingChartUpdate = true;
16609
16815
  return;
16610
16816
  }
@@ -16625,6 +16831,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16625
16831
  proxy.isUpdatingChart = false;
16626
16832
  return;
16627
16833
  }
16834
+ proxy._freezeAxisRange = !!(laneFilter && laneFilter.size);
16628
16835
  const axisKey = proxy.currentToolBarConfig.axisTypeList && proxy.currentToolBarConfig.axisTypeList[proxy.formCache.axisType] || (proxy.formCache.axisType === "time" ? "time" : "depth");
16629
16836
  const paramNameMap = {};
16630
16837
  const paramCodeMap = /* @__PURE__ */ new Map();
@@ -16748,7 +16955,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16748
16955
  fontSize: 12,
16749
16956
  color: getCssVariable("--default-text-color")
16750
16957
  },
16751
- axisPointer: { show: hasValidLineData }
16958
+ axisPointer: buildSyncedAxisPointer(true)
16752
16959
  });
16753
16960
  if (proxy.formCache.axisType === "depth") {
16754
16961
  applyDepthYAxisInterval(
@@ -16849,7 +17056,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
16849
17056
  const allValidData = seriesDataCache2[lineInfo.lineId].full;
16850
17057
  const { min, max } = proxy.getXAxisRangeByHeader(
16851
17058
  lineInfo,
16852
- allValidData
17059
+ axisSamplesForLine(lineInfo, realTimeData2, axisKey, allValidData)
16853
17060
  );
16854
17061
  const xAxisIndex = option.xAxis.length;
16855
17062
  if (tipAnchorXAxisIndex < 0) {
@@ -17068,8 +17275,12 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17068
17275
  groupMax
17069
17276
  ),
17070
17277
  lineStyle: { opacity: 0, width: 0 },
17071
- symbol: "none",
17072
- // silent/large 都会让 showTip(seriesIndex) 失效
17278
+ // 要有图形元素,trigger=item 的 showTip 才能出框;点本身不画出来
17279
+ showSymbol: true,
17280
+ symbol: "circle",
17281
+ symbolSize: 1,
17282
+ itemStyle: { opacity: 0 },
17283
+ emphasis: { disabled: true, scale: false },
17073
17284
  silent: false,
17074
17285
  large: false,
17075
17286
  tooltip: { show: true },
@@ -17100,11 +17311,15 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17100
17311
  option.tooltip.formatter = () => proxy.renderLaneTooltipHtml(laneId);
17101
17312
  }
17102
17313
  if (proxy.trendLineManager) proxy.trendLineManager.appendSeriesToOption(option, lane);
17314
+ if (proxy._freezeAxisRange && lane.lines && lane.lines.length && !laneOptionHasCurve(option) && laneOptionHasCurve(proxy.getOptionsByLineId(lane.laneId))) {
17315
+ continue;
17316
+ }
17103
17317
  proxy.updateOptionsByLineId(lane.laneId, option);
17104
17318
  }
17105
17319
  } catch (error) {
17106
17320
  console.error("updateLanesChartOption error:", error);
17107
17321
  } finally {
17322
+ proxy._freezeAxisRange = false;
17108
17323
  proxy.commitLineRangeBatch();
17109
17324
  proxy.isUpdatingChart = false;
17110
17325
  if (proxy._isUnmounted) {
@@ -17145,10 +17360,23 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17145
17360
  });
17146
17361
  }
17147
17362
  if (proxy.pendingChartUpdate) {
17363
+ const pendingOnly = proxy._pendingFullChart ? void 0 : proxy._pendingOnlyLaneIds;
17148
17364
  proxy.pendingChartUpdate = false;
17365
+ proxy._pendingFullChart = false;
17366
+ proxy._pendingOnlyLaneIds = void 0;
17367
+ proxy._pendingInteractionPatch = false;
17368
+ proxy._needFullChartAfterInteract = false;
17369
+ nextTick(() => {
17370
+ if (proxy._isUnmounted) return;
17371
+ proxy.updateLanesChartOption(
17372
+ pendingOnly == null ? transferData : void 0,
17373
+ pendingOnly
17374
+ );
17375
+ });
17376
+ } else if (proxy._pendingInteractionPatch) {
17149
17377
  nextTick(() => {
17150
17378
  if (proxy._isUnmounted) return;
17151
- proxy.updateLanesChartOption(transferData);
17379
+ flushInteractionPaint();
17152
17380
  });
17153
17381
  }
17154
17382
  }
@@ -17287,18 +17515,25 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
17287
17515
  const lane = proxy.findLaneById(laneId);
17288
17516
  const row = yValue != null ? proxy.findRowByAxisValue(yValue) || {} : {};
17289
17517
  const displaySeries = proxy.buildLaneTooltipSeries(lane, row, yValue);
17518
+ const mouse = proxy.buildTooltipMousePositionData(row);
17519
+ const textColor = getCssVariable("--default-text-color") || "";
17290
17520
  if (proxy.tooltipFormatter && typeof proxy.tooltipFormatter === "function") {
17291
17521
  return proxy.tooltipFormatter({
17292
17522
  series: displaySeries,
17293
- mousePositionData: proxy.buildTooltipMousePositionData(row)
17523
+ mousePositionData: mouse
17294
17524
  });
17295
17525
  }
17296
- let html = "<div>";
17526
+ let html = `<div style="padding:4px;font-family:Arial,sans-serif;color:${textColor}">`;
17297
17527
  for (let i = 0; i < displaySeries.length; i++) {
17298
17528
  const params2 = displaySeries[i];
17299
17529
  const { seriesName, value, color } = params2;
17300
17530
  const xValue = Array.isArray(value) ? value[0] : value;
17301
- html += `<div style="display:flex;align-items:center"><div style="height:10px;width:10px;font-size:10px;border-radius:8px;background-color:${color}"></div><span style="margin-left:8px;font-size:12px">${seriesName}:${xValue}</span></div>`;
17531
+ const marker = color || "transparent";
17532
+ html += `<div style="display:flex;align-items:center;margin-bottom:4px"><div style="width:12px;height:12px;min-width:12px;min-height:12px;flex:0 0 12px;border-radius:50%;background-color:${marker};margin-right:8px"></div><span style="flex:1;min-width:0;font-size:12px;color:${textColor}">${seriesName}: ${xValue}</span></div>`;
17533
+ }
17534
+ const time = mouse && mouse.time ? mouse.time : "";
17535
+ if (time) {
17536
+ html += `<div style="margin-top:8px;font-size:11px;color:${textColor}">${$kdInnerTrans("kdLaneChart.tooltip.timestamp")}: ${time}</div>`;
17302
17537
  }
17303
17538
  html += "</div>";
17304
17539
  return html;
@@ -18081,11 +18316,30 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18081
18316
  proxy.currentContextMenuItems = [];
18082
18317
  proxy.activeSubMenu = null;
18083
18318
  proxy.subMenuDirection = "right";
18319
+ proxy.subMenuOffsetTop = 0;
18320
+ proxy.subMenuOffsetLeft = 0;
18084
18321
  proxy.menuWidth = null;
18085
18322
  proxy.menuHeight = null;
18086
18323
  }
18324
+ function hideSubMenu(item) {
18325
+ if (item && proxy.activeSubMenu !== item) return;
18326
+ proxy.activeSubMenu = null;
18327
+ }
18328
+ function subMenuLayoutStyle(left, top) {
18329
+ return {
18330
+ left: `${left || 0}px`,
18331
+ right: "auto",
18332
+ top: `${top || 0}px`,
18333
+ marginLeft: "0",
18334
+ marginRight: "0"
18335
+ };
18336
+ }
18087
18337
  function showSubMenu(item, event) {
18088
18338
  event.stopPropagation();
18339
+ if (!item || !item.children || !item.children.length) {
18340
+ proxy.activeSubMenu = null;
18341
+ return;
18342
+ }
18089
18343
  proxy.activeSubMenu = item;
18090
18344
  const parentMenuItem = event.currentTarget;
18091
18345
  nextTick(() => {
@@ -18093,22 +18347,44 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18093
18347
  const subMenu = parentMenuItem == null ? void 0 : parentMenuItem.querySelector(".sub-menu");
18094
18348
  if (!container || !parentMenuItem || !subMenu) return;
18095
18349
  subMenu.style.visibility = "hidden";
18096
- const containerRect = container.getBoundingClientRect();
18350
+ subMenu.style.maxHeight = "";
18351
+ subMenu.style.overflowY = "";
18352
+ const bounds = container.getBoundingClientRect();
18353
+ const view = {
18354
+ left: Math.max(bounds.left, 0),
18355
+ top: Math.max(bounds.top, 0),
18356
+ right: Math.min(bounds.right, window.innerWidth),
18357
+ bottom: Math.min(bounds.bottom, window.innerHeight)
18358
+ };
18359
+ const gap = 8;
18097
18360
  const parentRect = parentMenuItem.getBoundingClientRect();
18098
- const subMenuWidth = subMenu.offsetWidth;
18099
- const rightAvailable = containerRect.right - parentRect.right;
18100
- proxy.subMenuDirection = rightAvailable >= subMenuWidth ? "right" : "left";
18101
- subMenu.style.visibility = "";
18361
+ const maxH = Math.max(40, view.bottom - view.top - 8);
18362
+ if (subMenu.offsetHeight > maxH) {
18363
+ subMenu.style.maxHeight = `${maxH}px`;
18364
+ subMenu.style.overflowY = "auto";
18365
+ }
18366
+ const subW = subMenu.offsetWidth;
18367
+ const subH = subMenu.offsetHeight;
18368
+ const spaceRight = view.right - parentRect.right - gap;
18369
+ const spaceLeft = parentRect.left - view.left - gap;
18370
+ const openRight = spaceRight >= subW || spaceRight >= spaceLeft;
18371
+ let leftEdge = openRight ? parentRect.right + gap : parentRect.left - gap - subW;
18372
+ if (leftEdge + subW > view.right) leftEdge = view.right - subW;
18373
+ if (leftEdge < view.left) leftEdge = view.left;
18374
+ let top = 0;
18375
+ const bottomOverflow = parentRect.top + subH - view.bottom;
18376
+ if (bottomOverflow > 0) top -= bottomOverflow;
18377
+ const topEdge = parentRect.top + top;
18378
+ if (topEdge < view.top) top += view.top - topEdge;
18379
+ const direction = leftEdge + subW / 2 >= parentRect.left + parentRect.width / 2 ? "right" : "left";
18380
+ proxy.subMenuDirection = direction;
18381
+ proxy.subMenuOffsetTop = top;
18382
+ proxy.subMenuOffsetLeft = leftEdge - parentRect.left;
18383
+ Object.assign(subMenu.style, subMenuLayoutStyle(proxy.subMenuOffsetLeft, top), { visibility: "visible" });
18102
18384
  });
18103
18385
  }
18104
18386
  function getSubMenuStyle() {
18105
- return {
18106
- left: proxy.subMenuDirection === "right" ? "100%" : "auto",
18107
- right: proxy.subMenuDirection === "right" ? "auto" : "100%",
18108
- top: 0,
18109
- marginLeft: proxy.subMenuDirection === "right" ? "4px" : "auto",
18110
- marginRight: proxy.subMenuDirection === "right" ? "auto" : "4px"
18111
- };
18387
+ return subMenuLayoutStyle(proxy.subMenuOffsetLeft, proxy.subMenuOffsetTop);
18112
18388
  }
18113
18389
  function handleContextMenuItemClick(item) {
18114
18390
  if (item.action === "deleteTrendKnot") {
@@ -18844,7 +19120,8 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18844
19120
  ...proxy.getPaperGridAxisStyle(
18845
19121
  !isDepthLane,
18846
19122
  ySplitCount
18847
- )
19123
+ ),
19124
+ axisPointer: isDepthLane ? { show: false } : buildSyncedAxisPointer(true)
18848
19125
  };
18849
19126
  if (proxy.formCache.axisType === "depth") {
18850
19127
  applyDepthYAxisInterval(yAxisItem, groupMin, groupMax);
@@ -18902,7 +19179,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
18902
19179
  );
18903
19180
  const { min, max } = proxy.getXAxisRangeByHeader(
18904
19181
  lineInfo,
18905
- allSeriesData
19182
+ axisSamplesForLine(lineInfo, realTimeData2, axisKey, allSeriesData)
18906
19183
  );
18907
19184
  const isLogScale = isLaneLogScale(lane);
18908
19185
  const plotRange = isLogScale ? resolveLaneLogPlotRange(lane, proxy.getLineRangeStore()) : null;
@@ -20258,7 +20535,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
20258
20535
  class: "kd-lane-chart-lane-container-echart",
20259
20536
  ref_key: "chartAreaWrap",
20260
20537
  ref: chartAreaWrap,
20261
- onMouseenter: _cache[0] || (_cache[0] = ($event) => pointerInChartArea.value = true),
20538
+ onMouseenter: _cache[1] || (_cache[1] = ($event) => pointerInChartArea.value = true),
20262
20539
  onMouseleave: hideAllLaneTooltips
20263
20540
  }, [
20264
20541
  createElementVNode("div", {
@@ -20432,13 +20709,14 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
20432
20709
  key: 0,
20433
20710
  class: "context-menu-item has-children",
20434
20711
  onMouseenter: ($event) => showSubMenu(item, $event),
20712
+ onMouseleave: ($event) => hideSubMenu(item),
20435
20713
  onClick: ($event) => handleContextMenuItemClick(item)
20436
20714
  }, [
20437
20715
  createElementVNode("span", null, toDisplayString(item.label), 1),
20438
- _cache[1] || (_cache[1] = createElementVNode("span", { class: "arrow" }, "›", -1)),
20716
+ _cache[2] || (_cache[2] = createElementVNode("span", { class: "arrow" }, "›", -1)),
20439
20717
  activeSubMenu.value === item ? (openBlock(), createElementBlock("div", {
20440
20718
  key: 0,
20441
- class: "context-menu sub-menu",
20719
+ class: normalizeClass(["context-menu sub-menu", subMenuDirection.value === "left" ? "is-left" : "is-right"]),
20442
20720
  style: normalizeStyle(getSubMenuStyle())
20443
20721
  }, [
20444
20722
  (openBlock(true), createElementBlock(Fragment, null, renderList(item.children, (child, childIndex) => {
@@ -20450,14 +20728,15 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
20450
20728
  createElementVNode("span", null, toDisplayString(child.label), 1)
20451
20729
  ], 8, _hoisted_4$1);
20452
20730
  }), 128))
20453
- ], 4)) : createCommentVNode("", true)
20731
+ ], 6)) : createCommentVNode("", true)
20454
20732
  ], 40, _hoisted_3$1)) : (openBlock(), createElementBlock("div", {
20455
20733
  key: 1,
20456
20734
  class: "context-menu-item",
20735
+ onMouseenter: _cache[0] || (_cache[0] = ($event) => hideSubMenu()),
20457
20736
  onClick: withModifiers(($event) => handleContextMenuItemClick(item), ["stop"])
20458
20737
  }, [
20459
20738
  createElementVNode("span", null, toDisplayString(item.label), 1)
20460
- ], 8, _hoisted_5))
20739
+ ], 40, _hoisted_5))
20461
20740
  ], 64);
20462
20741
  }), 128))
20463
20742
  ], 4)
@@ -20468,7 +20747,7 @@ const _sfc_main$2 = /* @__PURE__ */ Object.assign({
20468
20747
  };
20469
20748
  }
20470
20749
  });
20471
- const LineChartContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-fcf148a1"]]);
20750
+ const LineChartContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-af25fe67"]]);
20472
20751
  const _hoisted_1$1 = ["title"];
20473
20752
  const _hoisted_2$1 = ["title"];
20474
20753
  const _sfc_main$1 = /* @__PURE__ */ Object.assign({
@@ -21286,7 +21565,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "frameLayout", component
21286
21565
  children: [
21287
21566
  { label: "方式一", canTransfer: true },
21288
21567
  { label: "方式二", canTransfer: true },
21289
- { label: "方式三", canTransfer: true }
21568
+ { label: "方式三", canTransfer: true },
21569
+ { label: "方式四", canTransfer: true },
21570
+ { label: "方式五", canTransfer: true }
21290
21571
  ]
21291
21572
  }
21292
21573
  ]
@@ -22203,7 +22484,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "frameLayout", component
22203
22484
  };
22204
22485
  }
22205
22486
  });
22206
- const FrameLayoutComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a17d7f29"]]);
22487
+ const FrameLayoutComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1326393c"]]);
22207
22488
  function installComponents(app) {
22208
22489
  installKdI18n(app);
22209
22490
  app.component(KdLaneContainerComponent.name, KdLaneContainerComponent);