This commit is contained in:
齐斌 2025-05-31 00:23:07 +08:00
commit 7e0ef75a5e
2 changed files with 21 additions and 10 deletions

View File

@ -87,6 +87,13 @@ const initEcharts = (data) => {
animation: false, animation: false,
progressive: 500, progressive: 500,
progressiveThreshold: 3000, progressiveThreshold: 3000,
// title: {
// text: 'FiEE, Inc. Stock Price History',
// },
grid: {
left: '8%', // '2%'
right: '12%', // yylabel
},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@ -331,15 +338,15 @@ function findClosestDateIndexDescLeft(data, targetDateStr) {
let left = 0, let left = 0,
right = data.length - 1 right = data.length - 1
const target = new Date(targetDateStr).getTime() const target = new Date(targetDateStr).getTime()
let res = -1 // -1 let res = -1
while (left <= right) { while (left <= right) {
const mid = Math.floor((left + right) / 2) const mid = Math.floor((left + right) / 2)
const midTime = new Date(data[mid].date).getTime() const midTime = new Date(data[mid].date).getTime()
if (midTime < target) { if (midTime > target) {
right = mid - 1 // left = mid + 1 // mid
} else { } else {
res = mid // res = mid // mid <= target
left = mid + 1 // right = mid - 1
} }
} }
return res return res

View File

@ -84,6 +84,10 @@ const initEcharts = (data) => {
// title: { // title: {
// text: 'FiEE, Inc. Stock Price History', // text: 'FiEE, Inc. Stock Price History',
// }, // },
grid: {
left: '8%', // '2%'
right: '15%', // yylabel
},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@ -327,15 +331,15 @@ function findClosestDateIndexDescLeft(data, targetDateStr) {
let left = 0, let left = 0,
right = data.length - 1 right = data.length - 1
const target = new Date(targetDateStr).getTime() const target = new Date(targetDateStr).getTime()
let res = -1 // -1 let res = -1
while (left <= right) { while (left <= right) {
const mid = Math.floor((left + right) / 2) const mid = Math.floor((left + right) / 2)
const midTime = new Date(data[mid].date).getTime() const midTime = new Date(data[mid].date).getTime()
if (midTime < target) { if (midTime > target) {
right = mid - 1 // left = mid + 1 // mid
} else { } else {
res = mid // res = mid // mid <= target
left = mid + 1 // right = mid - 1
} }
} }
return res return res