202 lines
10 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cycle-Line Charts | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Cycle-Line Charts | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="../toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="cycle-line-charts">Cycle-Line Charts</h1>
<p>The cycle-line charts visualise a <strong>per-step, per-cycle detail view</strong> of force / moment signals around the currently-selected step. They are re-fetched whenever <code>SelectedStepInfoHub</code> pushes a new step, so the operator can zoom into one spindle revolution (or the configured cycle window) as they scrub through the mission timeline on the strip charts.</p>
<p>The anatomy covers four cycle-line charts in the webservice, all sharing <code>BaseCycleLineChart.vue</code>:</p>
<table>
<thead>
<tr>
<th>Chart</th>
<th>Source Data</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>Force Cycle-Line Chart</td>
<td><code>MachiningStep.ForceToWorkpieceOnProgramCoordinate</code> or <code>ForceToToolOnToolRunningCoordinate</code></td>
<td>Header dropdown picks between the two flag values; swaps the <code>fetcher</code> prop so <code>BaseCycleLineChart</code> refetches.</td>
</tr>
<tr>
<td>Sim Spindle Moment Cycle-Line Chart</td>
<td><code>MachiningStep.MomentsToToolAboutObservationPointOnSpindleRotationCoordinate_Nm</code></td>
<td>Simulated moment from the physics model.</td>
</tr>
<tr>
<td>Sensor Spindle Moment Cycle-Line Chart</td>
<td><code>IMomentShot</code> via <code>MachiningProject.TimeMapping.GetShots(stepIndex)</code></td>
<td>Sensor-measured moment. Rendered as a sibling card to the sim chart, not a twin overlay (see <em>Deferred</em>).</td>
</tr>
<tr>
<td>Dynamometer Force Cycle-Line Chart</td>
<td><code>IForceShot</code> via <code>TimeMapping.GetShots(stepIndex)</code></td>
<td>Sensor-measured force. Returns empty shape when no dynamometer data.</td>
</tr>
</tbody>
</table>
<p>Key Model: <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>.<a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html#Hi_MachiningProcs_MachiningProject_TimeMapping">TimeMapping</a> + the selected <a class="xref" href="../../api/Hi.MachiningSteps.MachiningStep.html">MachiningStep</a>.</p>
<h2 id="layout">Layout</h2>
<p>Each cycle-line chart is a card:</p>
<ul>
<li>Header Row
<ul>
<li>Title label.</li>
<li>Flag picker (Force chart only) — <code>&lt;q-btn-dropdown&gt;</code> between <code>ForceToWorkpieceOnProgramCoordinate</code> (default) and <code>ForceToToolOnToolRunningCoordinate</code>.</li>
</ul>
</li>
<li>Body — <code>UplotChart.vue</code> rendering three series (X / Y / Z channels) over a shared time axis <code>ts</code>.</li>
<li>Empty-state overlay — when <code>hasData=false</code> (no selection, no shots), a placeholder is shown; the underlying series still carry a shape-preserving <code>ts=[0,360]</code>, <code>xs/ys/zs=[NaN,NaN]</code> payload so the canvas does not jump.</li>
</ul>
<h2 id="behavior">Behavior</h2>
<ul>
<li><strong>Step-driven refetch.</strong> <code>BaseCycleLineChart</code> accepts a <code>fetcher: () =&gt; Promise&lt;CycleLineResponse&gt;</code> prop. On <code>SelectedStepInfoHub.StepChanged</code> the fetcher is re-invoked and the chart re-renders.</li>
<li><strong>Server-resolved step.</strong> Cycle-line endpoints resolve &ldquo;currently-selected step&rdquo; from <code>LocalProjectService.ClStrip.GetSelectedPos()</code> rather than accepting <code>stepIndex</code> as a query parameter. This keeps the contract simple and aligns with the event-driven model used by the rest of the player plumbing.</li>
<li><strong>Toolbar slot.</strong> The optional <code>#toolbar</code> slot lets callers embed per-chart controls (e.g. the Force chart's flag picker) without subclassing.</li>
</ul>
<h2 id="source-code-path">Source Code Path</h2>
<p>See <a href="../index.html">HiNC App Anatomy</a> for git repository links.</p>
<h3 id="wpf-application-source-code-path">WPF Application Source Code Path</h3>
<ul>
<li>Not implemented.</li>
</ul>
<h3 id="web-page-application-source-code-path">Web Page Application Source Code Path</h3>
<p>HiNC-2025-webservice (Quasar CLI SPA):</p>
<ul>
<li><code>wwwroot-src/src/components/player/charts/BaseCycleLineChart.vue</code> — shared cycle-line skeleton.</li>
<li><code>wwwroot-src/src/components/player/charts/UplotChart.vue</code> — uplot wrapper (shared with strip charts).</li>
<li><code>wwwroot-src/src/components/player/charts/ForceCycleLineChart.vue</code> — force cycle-line chart with flag picker.</li>
<li><code>wwwroot-src/src/components/player/charts/SimSpindleMomentCycleLineChart.vue</code> — simulated spindle moment.</li>
<li><code>wwwroot-src/src/components/player/charts/SensorSpindleMomentCycleLineChart.vue</code> — sensor-measured spindle moment.</li>
<li><code>wwwroot-src/src/components/player/charts/DynamometerForceCycleLineChart.vue</code> — dynamometer force.</li>
<li><code>Players/PlayerChartsController.cs</code> — cycle-line endpoints:
<ul>
<li><code>GET /api/player/cycle-line/force?flag=ForceToWorkpieceOnProgramCoordinate|ForceToToolOnToolRunningCoordinate</code></li>
<li><code>GET /api/player/cycle-line/sim-spindle-moment</code></li>
<li><code>GET /api/player/cycle-line/sensor-spindle-moment</code></li>
<li><code>GET /api/player/cycle-line/dynamometer-force</code></li>
</ul>
</li>
</ul>
<p>All four endpoints return <code>{ hasData, ts, xs, ys, zs }</code> flattened for direct uplot consumption. Empty payloads use a shape-preserving <code>ts=[0,360]</code>, <code>xs/ys/zs=[NaN,NaN]</code> fill.</p>
<h2 id="deferred">Deferred</h2>
<ul>
<li><strong>True twin overlay</strong> (two series on one canvas) for Sim + Sensor Spindle Moment. Currently rendered as two sibling cards sharing the same chart grid, which keeps the uplot instances independent. Revisit if operators ask for overlap.</li>
</ul>
<h2 id="related-pages">Related Pages</h2>
<ul>
<li><a href="strip-charts.html">Strip Charts</a> — windowed mission-timeline charts that share the same <code>uplot</code> engine and drive step selection.</li>
<li><a href="index.html">Player Panel</a> — top-level layout that hosts the charts.</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>