|
@@ -638,6 +638,9 @@
|
|
|
|
|
|
|
|
// 创建BPS图表
|
|
// 创建BPS图表
|
|
|
displayBpsChart(data);
|
|
displayBpsChart(data);
|
|
|
|
|
+
|
|
|
|
|
+ // 同步两个图表的缩放
|
|
|
|
|
+ syncChartsZoom();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 显示BPS图表
|
|
// 显示BPS图表
|
|
@@ -761,7 +764,62 @@
|
|
|
|
|
|
|
|
bpsChart.setOption(option);
|
|
bpsChart.setOption(option);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 同步两个图表的缩放
|
|
|
|
|
+ function syncChartsZoom() {
|
|
|
|
|
+ if (!priceChart || !bpsChart) return;
|
|
|
|
|
+
|
|
|
|
|
+ // 监听价格图表的缩放事件
|
|
|
|
|
+ priceChart.on('datazoom', function(event) {
|
|
|
|
|
+ // 获取价格图表的缩放范围
|
|
|
|
|
+ const option = priceChart.getOption();
|
|
|
|
|
+ const dataZoom = option.dataZoom;
|
|
|
|
|
+
|
|
|
|
|
+ if (dataZoom && dataZoom.length > 0) {
|
|
|
|
|
+ // 将缩放范围应用到BPS图表
|
|
|
|
|
+ bpsChart.setOption({
|
|
|
|
|
+ dataZoom: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'inside',
|
|
|
|
|
+ start: dataZoom[0].start,
|
|
|
|
|
+ end: dataZoom[0].end
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'slider',
|
|
|
|
|
+ start: dataZoom[0].start,
|
|
|
|
|
+ end: dataZoom[0].end
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 监听BPS图表的缩放事件
|
|
|
|
|
+ bpsChart.on('datazoom', function(event) {
|
|
|
|
|
+ // 获取BPS图表的缩放范围
|
|
|
|
|
+ const option = bpsChart.getOption();
|
|
|
|
|
+ const dataZoom = option.dataZoom;
|
|
|
|
|
+
|
|
|
|
|
+ if (dataZoom && dataZoom.length > 0) {
|
|
|
|
|
+ // 将缩放范围应用到价格图表
|
|
|
|
|
+ priceChart.setOption({
|
|
|
|
|
+ dataZoom: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'inside',
|
|
|
|
|
+ start: dataZoom[0].start,
|
|
|
|
|
+ end: dataZoom[0].end
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'slider',
|
|
|
|
|
+ start: dataZoom[0].start,
|
|
|
|
|
+ end: dataZoom[0].end
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 加载缩略图数据(24小时,只显示币安价格,每秒最多一条)
|
|
// 加载缩略图数据(24小时,只显示币安价格,每秒最多一条)
|
|
|
async function loadThumbnailData(symbol) {
|
|
async function loadThumbnailData(symbol) {
|
|
|
try {
|
|
try {
|