|
|
@@ -498,6 +498,10 @@
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
maintainAspectRatio: false,
|
|
|
+ interaction: {
|
|
|
+ mode: 'index',
|
|
|
+ intersect: false,
|
|
|
+ },
|
|
|
plugins: {
|
|
|
title: {
|
|
|
display: true,
|
|
|
@@ -505,6 +509,39 @@
|
|
|
},
|
|
|
legend: {
|
|
|
position: 'top'
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ mode: 'index',
|
|
|
+ intersect: false,
|
|
|
+ backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
|
+ titleColor: 'white',
|
|
|
+ bodyColor: 'white',
|
|
|
+ borderColor: 'rgba(255, 255, 255, 0.2)',
|
|
|
+ borderWidth: 1,
|
|
|
+ cornerRadius: 8,
|
|
|
+ displayColors: true,
|
|
|
+ callbacks: {
|
|
|
+ title: function(context) {
|
|
|
+ const dataIndex = context[0].dataIndex;
|
|
|
+ const timestamp = data[dataIndex].timestamp;
|
|
|
+ return new Date(timestamp).toLocaleString();
|
|
|
+ },
|
|
|
+ label: function(context) {
|
|
|
+ const value = context.parsed.y;
|
|
|
+ return `${context.dataset.label}: ${value ? value.toFixed(6) : '--'} USDT`;
|
|
|
+ },
|
|
|
+ afterBody: function(context) {
|
|
|
+ const dataIndex = context[0].dataIndex;
|
|
|
+ const item = data[dataIndex];
|
|
|
+ return [
|
|
|
+ '',
|
|
|
+ `标记价格差: ${item.mark_price_diff ? item.mark_price_diff.toFixed(6) : '--'} USDT`,
|
|
|
+ `价格差: ${item.price_diff ? item.price_diff.toFixed(6) : '--'} USDT`,
|
|
|
+ `标记价格差 (%): ${item.mark_price_diff_pct ? item.mark_price_diff_pct.toFixed(4) : '--'}%`,
|
|
|
+ `价格差 (%): ${item.price_diff_pct ? item.price_diff_pct.toFixed(4) : '--'}%`
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
scales: {
|
|
|
@@ -579,6 +616,10 @@
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
maintainAspectRatio: false,
|
|
|
+ interaction: {
|
|
|
+ mode: 'index',
|
|
|
+ intersect: false,
|
|
|
+ },
|
|
|
plugins: {
|
|
|
title: {
|
|
|
display: true,
|
|
|
@@ -586,6 +627,40 @@
|
|
|
},
|
|
|
legend: {
|
|
|
position: 'top'
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ mode: 'index',
|
|
|
+ intersect: false,
|
|
|
+ backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
|
+ titleColor: 'white',
|
|
|
+ bodyColor: 'white',
|
|
|
+ borderColor: 'rgba(255, 255, 255, 0.2)',
|
|
|
+ borderWidth: 1,
|
|
|
+ cornerRadius: 8,
|
|
|
+ displayColors: true,
|
|
|
+ callbacks: {
|
|
|
+ title: function(context) {
|
|
|
+ const dataIndex = context[0].dataIndex;
|
|
|
+ const timestamp = data[dataIndex].timestamp;
|
|
|
+ return new Date(timestamp).toLocaleString();
|
|
|
+ },
|
|
|
+ label: function(context) {
|
|
|
+ const value = context.parsed.y;
|
|
|
+ const unit = context.dataset.yAxisID === 'y1' ? '%' : 'USDT';
|
|
|
+ return `${context.dataset.label}: ${value ? value.toFixed(6) : '--'} ${unit}`;
|
|
|
+ },
|
|
|
+ afterBody: function(context) {
|
|
|
+ const dataIndex = context[0].dataIndex;
|
|
|
+ const item = data[dataIndex];
|
|
|
+ return [
|
|
|
+ '',
|
|
|
+ `Binance 标记价格: ${item.binance_mark_price ? item.binance_mark_price.toFixed(6) : '--'} USDT`,
|
|
|
+ `Lighter 标记价格: ${item.lighter_mark_price ? item.lighter_mark_price.toFixed(6) : '--'} USDT`,
|
|
|
+ `Binance 最新价格: ${item.binance_price ? item.binance_price.toFixed(6) : '--'} USDT`,
|
|
|
+ `Lighter 最新价格: ${item.lighter_price ? item.lighter_price.toFixed(6) : '--'} USDT`
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
scales: {
|