客流密度-里程图
+x=a到x=b之间的面积S表示平均每年有S万人次乘坐火车的里程(km)在a与b之间。
+线路图数据加载中...
+diff --git a/TODO b/TODO index 92fa9c6e..78ca5daf 100644 --- a/TODO +++ b/TODO @@ -70,4 +70,6 @@ ctx.heatMap.render(0); ctx.mapContext.clear(); ctx.graphContext.clear(); ctx.graphContext.init("distance"); -ctx.graphContext.render(); \ No newline at end of file +ctx.graphContext.render(); + +- 上述奇怪的bug已被解决,因为原来的代码结构不复存在。 diff --git a/index.html b/index.html new file mode 100644 index 00000000..cb7bbb23 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + +
+ + +这是参数内容。
"; - this.sidePanel.classList.remove("hidden"); - } - - public init() { - // 监听按钮点击事件,切换内容或收起侧边栏 - this.tabButtons.forEach((button) => { - button.addEventListener("click", () => { - console.log("[LeftSidePanel] button clicked: ", button.id); - // 如果点击的是当前已选中的按钮,收起侧边栏 - if (button.classList.contains("selected")) { - this.sidePanel.classList.add("hidden"); - button.classList.remove("selected"); - this.contentOnShow = undefined; - } else { - // 先移除所有按钮的选中状态 - this.tabButtons.forEach((btn) => btn.classList.remove("selected")); - // 设置当前按钮为选中状态 - button.classList.add("selected"); - - // 根据按钮不同切换第二层侧边栏的内容 - if (button.id === "btn-intro") { - this.sidePanelTitle.innerText = "介绍"; - const introContent = ` -本项目旨在提供可交互的铁路信息可视化分析工具,侧重于分析站点间的最短距离和最短通行时间,以及站点和线路的新建或删除对铁路运行的影响。
-使用指南:
-这是过滤器内容。
"; - this.contentOnShow = "filter"; - } else if (button.id === "btn-params") { - this.sidePanelTitle.innerText = "参数"; - this.sidePanelContent.innerHTML = - "在任意视图中点击选择点或边,以显示并编辑站点或铁路路段信息。
"; - this.contentOnShow = "params"; - } - - // 显示第二层侧边栏 - this.sidePanel.classList.remove("hidden"); - } - }); - }); - - // 监听拖拽事件,调整侧边栏宽度 - this.splitPaneDragger.addEventListener("mousedown", (e) => { - // 阻止默认事件,防止选中内容 - e.preventDefault(); - - // 获取初始鼠标位置和侧边栏的初始宽度 - const initialMouseX = e.clientX; - const initialWidth = this.sidePanel.offsetWidth; - - // 拖拽过程中更新宽度 - const onMouseMove = (moveEvent: MouseEvent) => { - const deltaX = moveEvent.clientX - initialMouseX - 20; // 计算鼠标的水平移动距离 - const newWidth = initialWidth + deltaX; // 更新宽度 - - if (newWidth > 100 && newWidth < 600) { - // 限制宽度范围 - this.sidePanel.style.width = newWidth + "px"; - } - }; - - // 停止拖拽 - const onMouseUp = () => { - document.removeEventListener("mousemove", onMouseMove); - document.removeEventListener("mouseup", onMouseUp); - }; - - document.addEventListener("mousemove", onMouseMove); - document.addEventListener("mouseup", onMouseUp); - }); - console.log(`[${this.constructor.name}] inited.`); - } -} - -export class RightSidePanel { - private sidebar_ids = [ - { button_id: "sidebarButton1", sidebar_id: "sidebar1", dragger_id: "dragger1" }, - { button_id: "sidebarButton2", sidebar_id: "sidebar2", dragger_id: "dragger2" }, - ]; - private buttons: { button: HTMLElement; sidebar: HTMLElement }[]; - - constructor() { - this.buttons = []; - this.sidebar_ids.forEach(({ button_id, sidebar_id, dragger_id }) => { - const button = - document.getElementById(button_id) ?? - (() => { - throw new Error(`按钮${button_id}不存在`); - }).call(this); - const sidebar = - document.getElementById(sidebar_id) ?? - (() => { - throw new Error(`侧边栏${sidebar_id}不存在`); - }).call(this); - this.buttons.push({ button, sidebar }); - }); - - this.buttons.forEach(({ button, sidebar }) => { - button.addEventListener("click", () => { - console.log(sidebar.style.display); - const display = (sidebar.style.display = - sidebar.style.display === "block" ? "none" : "block"); - if (display === "block") d3.select(sidebar).raise(); - }); - }); - - console.log(`[${this.constructor.name}] Constructed.`); - } - - private addDraggable(draggerId: string, sidebarId: string) { - const dragger = - document.getElementById(draggerId) ?? - (() => { - throw new Error(`拖拽元素${draggerId}不存在`); - }).call(null); - const sidebar = - document.getElementById(sidebarId) ?? - (() => { - throw new Error(`侧边栏${sidebarId}不存在`); - }).call(null); - - let isDragging = false; - let startY: number; - let startTop: number; - - dragger.addEventListener("mousedown", (e) => { - isDragging = true; - startY = e.clientY; - startTop = parseInt(window.getComputedStyle(sidebar).top, 10); - e.preventDefault(); - // 将当前侧边栏置顶 - d3.select(sidebar).raise(); - }); - - document.addEventListener("mousemove", (e) => { - if (!isDragging) return; - const deltaY = e.clientY - startY; - const newTop = startTop + deltaY; - sidebar.style.top = `${newTop}px`; - }); - - document.addEventListener("mouseup", () => { - isDragging = false; - }); - } - - public init() { - // 为每个侧边栏添加拖拽事件 - this.sidebar_ids.forEach(({ button_id, sidebar_id, dragger_id }) => { - this.addDraggable(dragger_id, sidebar_id); - }); - - console.log(`[${this.constructor.name}] inited.`); - } -} - -export class TopSidePanel { - // private buttons_ids = ["btn-map-view", "btn-distance-view", "btn-time-view"]; - private buttons_ids = ["btn-map-view", "btn-distance-view"]; - - private buttons: Map以下为节点/边过滤器的状态,可以进行精细调整。
+本项目旨在提供可交互的铁路信息可视化分析工具,侧重于分析站点间的最短距离和最短通行时间,以及站点和线路的新建或删除对铁路运行的影响。
+使用指南:
+x=a到x=b之间的面积S表示平均每年有S万人次乘坐火车的里程(km)在a与b之间。
+线路图数据加载中...
+此处的内容正在施工中。
+事实上很容易实现,但是我要揣摩原作者意图。
+表示任意两站之间的最短路程长度(km)。点击以在距离拓扑视图中观察最短路程。
+线路图数据加载中...
+我觉得这里应该有个时间热力图,但原作者没做。
+我就是闲着没事改版的,所以我也没做。
+以下为选中的节点/边的参数。
+