st-comp 0.0.33 → 0.0.34

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.33",
4
+ "version": "0.0.34",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -491,7 +491,7 @@ const keyDownEvent = (e: KeyboardEvent) => {
491
491
  // 只有选中或者按ctrl才激活按键
492
492
  if (!(e.ctrlKey || props.isSelect)) return;
493
493
  const option = echartsInstance.getOption() as EChartsOption;
494
- let { startValue, endValue } = (option.dataZoom as DataZoomComponentOption[])[0] as {
494
+ let { startValue, endValue, start, end } = (option.dataZoom as DataZoomComponentOption[])[0] as {
495
495
  startValue: number;
496
496
  endValue: number;
497
497
  };
@@ -537,11 +537,11 @@ const keyDownEvent = (e: KeyboardEvent) => {
537
537
  if (endValue - startValue < 5) {
538
538
  return;
539
539
  }
540
- const diff = Math.floor((endValue - startValue) / 2) + 1;
541
- startValue = startValue + diff;
542
- if (endValue - startValue < 5) {
543
- startValue = endValue - 4;
544
- }
540
+ // 以鼠标指定的K线为中心点进行放大
541
+ const startDiff = Math.floor((activeIndex.value - startValue) / 2) + 1;
542
+ const endDiff = Math.floor((endValue - activeIndex.value) / 2) + 1;
543
+ startValue = startValue + startDiff;
544
+ endValue = endValue - endDiff;
545
545
  echartsInstance.dispatchAction({
546
546
  type: "dataZoom",
547
547
  startValue,
@@ -551,12 +551,13 @@ const keyDownEvent = (e: KeyboardEvent) => {
551
551
  };
552
552
  const handleDown = () => {
553
553
  // 下按键-缩小
554
- const diff = Math.min(500, endValue - startValue);
555
- startValue = startValue - diff - 1;
554
+ // const diff = Math.min(50, activeIndex.value - startValue);
555
+ // startValue = startValue - diff - 1;
556
+ start = start - (end - start) / 4;
556
557
  echartsInstance.dispatchAction({
557
558
  type: "dataZoom",
558
- startValue,
559
- endValue,
559
+ start,
560
+ end,
560
561
  actionIsWheel: true, // 标记为缩放
561
562
  });
562
563
  };
@@ -551,7 +551,8 @@ const handleSellBuyConfig = (data: any[], originData: KlineDataType) => {
551
551
  const startX = next.time;
552
552
  const startY = yAxisValue + "";
553
553
  const endX = target.time;
554
- const endY = originData.find((item: any) => item[0] === target.time)[3];
554
+ const endItem = originData.find((item: any) => item[0] === target.time)
555
+ const endY = endItem ? endItem[3] : null;
555
556
  return [
556
557
  {
557
558
  coord: [startX, startY],