Merge branch 'main' of https://gitea-inner.fontree.cn/scout666/fiee-official-website
This commit is contained in:
commit
7e0ef75a5e
@ -87,6 +87,13 @@ const initEcharts = (data) => {
|
||||
animation: false,
|
||||
progressive: 500,
|
||||
progressiveThreshold: 3000,
|
||||
// title: {
|
||||
// text: 'FiEE, Inc. Stock Price History',
|
||||
// },
|
||||
grid: {
|
||||
left: '8%', // 或 '2%',根据实际情况调整
|
||||
right: '12%', // 给右侧y轴留空间,数值可根据y轴label宽度调整
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
@ -331,15 +338,15 @@ function findClosestDateIndexDescLeft(data, targetDateStr) {
|
||||
let left = 0,
|
||||
right = data.length - 1
|
||||
const target = new Date(targetDateStr).getTime()
|
||||
let res = -1 // 默认返回-1(找不到)
|
||||
let res = -1
|
||||
while (left <= right) {
|
||||
const mid = Math.floor((left + right) / 2)
|
||||
const midTime = new Date(data[mid].date).getTime()
|
||||
if (midTime < target) {
|
||||
right = mid - 1 // 向左搜索,因为我们要找的是小于等于目标日期的最近一天
|
||||
if (midTime > target) {
|
||||
left = mid + 1 // mid 比目标新,往更旧的方向找
|
||||
} else {
|
||||
res = mid // 记录当前找到的索引
|
||||
left = mid + 1 // 向右搜索,因为更早的日期在数组后面
|
||||
res = mid // mid <= target,记录下来,继续往更新的方向找
|
||||
right = mid - 1
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
@ -84,6 +84,10 @@ const initEcharts = (data) => {
|
||||
// title: {
|
||||
// text: 'FiEE, Inc. Stock Price History',
|
||||
// },
|
||||
grid: {
|
||||
left: '8%', // 或 '2%',根据实际情况调整
|
||||
right: '15%', // 给右侧y轴留空间,数值可根据y轴label宽度调整
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
@ -327,15 +331,15 @@ function findClosestDateIndexDescLeft(data, targetDateStr) {
|
||||
let left = 0,
|
||||
right = data.length - 1
|
||||
const target = new Date(targetDateStr).getTime()
|
||||
let res = -1 // 默认返回-1(找不到)
|
||||
let res = -1
|
||||
while (left <= right) {
|
||||
const mid = Math.floor((left + right) / 2)
|
||||
const midTime = new Date(data[mid].date).getTime()
|
||||
if (midTime < target) {
|
||||
right = mid - 1 // 向左搜索,因为我们要找的是小于等于目标日期的最近一天
|
||||
if (midTime > target) {
|
||||
left = mid + 1 // mid 比目标新,往更旧的方向找
|
||||
} else {
|
||||
res = mid // 记录当前找到的索引
|
||||
left = mid + 1 // 向右搜索,因为更早的日期在数组后面
|
||||
res = mid // mid <= target,记录下来,继续往更新的方向找
|
||||
right = mid - 1
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
Loading…
Reference in New Issue
Block a user