Skip to content

updated the way to calculate time window - #26

Open
ljiang-slac wants to merge 5 commits into
mainfrom
feature/work-space
Open

updated the way to calculate time window#26
ljiang-slac wants to merge 5 commits into
mainfrom
feature/work-space

Conversation

@ljiang-slac

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts how the frontend computes the x-axis time window for time-synced plotting, and adds a helper script to start the Vite dev server (intended for manual use and/or systemd).

Changes:

  • Update time-window anchoring in MultiPVPlot to use the newest buffered data timestamp instead of the browser wall clock.
  • Add start-frontend.sh for starting the frontend dev server with an NVM-based Node setup.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
start-frontend.sh Adds a startup script for the Vite frontend dev server (Node/NVM setup + exec).
src/components/MultiPVPlot.jsx Changes x-axis time-window calculation to anchor to latest buffered data timestamp when time sync is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/MultiPVPlot.jsx Outdated
return;
}

Comment on lines 219 to 230
}




//if (timeSyncEnabled) {
// const now = new Date();
// xMax = now;
// xMin = new Date(now.getTime() - globalTimeWindow * 1000);
//}

const traces = pvNames.map((pvName) => {
Comment thread src/components/MultiPVPlot.jsx Outdated
let xMax = null;


// use the last point data time stamp to replace current time
Comment thread start-frontend.sh
Comment on lines +13 to +27
export NVM_DIR="/home/b_bluesky/.nvm"
# shellcheck disable=SC1091
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"

# 使用指定的 node 版本(和你 which node 一致)
nvm use v20.11.1 >/dev/null 2>&1 || true

# 兜底:直接把 node bin 目录加进 PATH
export PATH="/home/b_bluesky/.nvm/versions/node/v20.11.1/bin:$PATH"

# ------------------------------------------------------------
# 2. 进入项目目录
# ------------------------------------------------------------
cd /home/b_bluesky/Documents/epics-pv-plotter

Comment thread start-frontend.sh
# Can be run manually for testing, or invoked by systemd.
#

set -e # 出错即退出
Comment thread start-frontend.sh
Comment on lines +3 to +6
# start-frontend.sh
# Starts the EPICS PV Plotter frontend (Vite dev server).
# Can be run manually for testing, or invoked by systemd.
#
Comment thread start-frontend.sh
# 4. 启动 Vite dev server
# exec 让 npm 进程替换当前 shell,便于 systemd 正确管理进程
# ------------------------------------------------------------
exec npm run dev -- --host 0.0.0.0 --port 5173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants