st-comp 0.0.133 → 0.0.135

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.
@@ -1,18 +1,18 @@
1
1
  import { stMath } from "st-func";
2
- import { updateWarningLine } from './api'
2
+ import { updateWarningLine } from "./api";
3
3
 
4
4
  const { round } = stMath;
5
5
 
6
6
  // 获取主图配置
7
7
  export const getMainOptions = (chartData, config, startValue, endValue) => {
8
- const { data, time } = chartData
9
- const { gridTop, gridRight, gridLeft, maxShowCounts, showSubChart } = config
8
+ const { data, time } = chartData;
9
+ const { gridTop, gridRight, gridLeft, maxShowCounts, showSubChart } = config;
10
10
  return {
11
11
  animation: false,
12
12
  grid: {
13
13
  top: `${gridTop}px`,
14
14
  right: `${gridRight}px`,
15
- bottom: showSubChart ? '6px' : '24px',
15
+ bottom: showSubChart ? "6px" : "24px",
16
16
  left: `${gridLeft}px`,
17
17
  },
18
18
  dataZoom: [
@@ -81,29 +81,44 @@ export const getMainOptions = (chartData, config, startValue, endValue) => {
81
81
  ...chartData.mainIndicator.map((item) => {
82
82
  return {
83
83
  name: item.key,
84
- type: 'line',
84
+ type: "line",
85
85
  silent: true,
86
- symbol: 'none',
86
+ symbol: "none",
87
87
  data: item.data,
88
88
  lineStyle: {
89
89
  width: item.width || 1,
90
90
  },
91
91
  itemStyle: {
92
92
  color: item.color,
93
- }
94
- }
95
- })
93
+ },
94
+ };
95
+ }),
96
96
  ],
97
- }
98
- }
97
+ toolbox: {
98
+ show: false,
99
+ },
100
+ brush: {
101
+ xAxisIndex: "all",
102
+ brushLink: "all",
103
+ transformable: false,
104
+ outOfBrush: {
105
+ colorAlpha: 2,
106
+ },
107
+ brushStyle: {
108
+ color: "rgba(255,255,255,0.1)",
109
+ borderColor: "rgba(255,255,255,0.4)",
110
+ },
111
+ },
112
+ };
113
+ };
99
114
 
100
115
  // 获取画线预警配置
101
116
  export const getWarningLineOptions = (mainChartIns, warningLineData, props, config, callback) => {
102
- const { variety, featureId, featureType } = props
117
+ const { variety, featureId, featureType } = props;
103
118
  const { gridTop, gridLeft, gridRight } = config;
104
119
  return warningLineData.reduce((res, item) => {
105
120
  const { warnPrice } = item;
106
- const y = mainChartIns?.convertToPixel({ yAxisIndex: 0 }, warnPrice)
121
+ const y = mainChartIns?.convertToPixel({ yAxisIndex: 0 }, warnPrice);
107
122
  // 位于顶部的预警线不绘制
108
123
  if (y <= gridTop) return res;
109
124
  // 超出图表的预警线不绘制
@@ -152,10 +167,14 @@ export const getWarningLineOptions = (mainChartIns, warningLineData, props, conf
152
167
  ondragstart: (params) => {
153
168
  dragStart = params.offsetY; // 记录拖拽开始坐标
154
169
  },
155
- ondrag: params => {
170
+ ondrag: (params) => {
156
171
  if (params.target && params.target.childAt(1)) {
157
- const newValue = mainChartIns.convertFromPixel({ yAxisIndex: 0 }, y + (params.offsetY - dragStart))
158
- params.target.childAt(1)?.animate('style', false).when(1, { text: round(newValue, 3) }).start()
172
+ const newValue = mainChartIns.convertFromPixel({ yAxisIndex: 0 }, y + (params.offsetY - dragStart));
173
+ params.target
174
+ .childAt(1)
175
+ ?.animate("style", false)
176
+ .when(1, { text: round(newValue, 3) })
177
+ .start();
159
178
  }
160
179
  },
161
180
  // 事件:结束拖拽
@@ -181,7 +200,7 @@ export const getWarningLineOptions = (mainChartIns, warningLineData, props, conf
181
200
  callback && callback();
182
201
  }
183
202
  },
184
- }
185
- ]
186
- }, [])
187
- };
203
+ },
204
+ ];
205
+ }, []);
206
+ };
@@ -1,6 +1,6 @@
1
1
  import axios from "axios";
2
2
 
3
- const token = "490cdb08082fe518cdfa476bd53edc86";
3
+ const token = "85970551b09341348682bc679ad58bdb";
4
4
  const host = "http://192.168.12.38:5173";
5
5
 
6
6
  // 获取指标线配置
@@ -33,6 +33,7 @@
33
33
  :indicatorStore="indicatorStore"
34
34
  :config="config"
35
35
  :env="{ VITE_BASE_URL: 'http://192.168.12.38:5173' }"
36
+ :brushRange="['2025-06-03 00:00:00', '2025-06-05 23:59:59']"
36
37
  />
37
38
  </div>
38
39
  </div>