219 lines
13 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Strip Charts | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Strip 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="strip-charts">Strip Charts</h1>
<p>The strip charts visualise a <strong>windowed, downsampled view of the full mission timeline</strong> for physics / quality aspects that are computed per step across the whole NC program. They are rendered as min/max banded series over the <code>ClStrip.GetDispBegin() .. AbsDispEnd</code> window. Operators use them to spot which segments of the mission are loading the spindle, degrading surface quality, or hitting thermal limits.</p>
<p>The anatomy covers three strip charts in the webservice, all sharing <code>BaseStripChart.vue</code>:</p>
<table>
<thead>
<tr>
<th>Chart</th>
<th>Source Aspect</th>
<th>Items</th>
</tr>
</thead>
<tbody>
<tr>
<td>Plural Strip Availability Chart</td>
<td><code>Availability</code></td>
<td>Yielding-stress / max-spindle-torque / max-spindle-power / spindle-working-temperature / thermal-yield ratios (5 series).</td>
</tr>
<tr>
<td>Plural Strip Roughness Chart</td>
<td><code>SurfaceRoughness</code></td>
<td>Re-cut depth + program-side cusp + Δ tip deflection X / Y / Z in µm (5 series).</td>
</tr>
<tr>
<td>Strip Individual Chart</td>
<td><code>Individual</code></td>
<td>One series of a user-picked <code>StepPropertyAccessDictionary</code> key (≈90 keys).</td>
</tr>
</tbody>
</table>
<p>Key Model: <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> via <code>LocalProjectService.ClStrip</code> + <code>LocalProjectService.StepPropertyAccessDictionary</code>.</p>
<h2 id="layout">Layout</h2>
<p>Each strip chart is a card:</p>
<ul>
<li>Header Row
<ul>
<li>Title label (aspect name).</li>
<li>Aspect picker (Individual chart only) — <code>tune</code> icon dropdown listing every <code>StepPropertyAccessDictionary</code> key with a <code>GetQuantityFunc</code>, sorted by <code>PresentAttribute.Name</code>. Picking a key calls <code>POST /api/player/inspecting-key</code> and re-fetches the chart.</li>
<li>X-axis picker — <code>IndexByTime</code> (default) / <code>IndexByStep</code>.</li>
<li>Window chip — displays <code>[dispBegin..absDispEnd] / count</code> for at-a-glance scope.</li>
<li><code>zoom_out_map</code> reset button — returns the window to the full mission.</li>
</ul>
</li>
<li>Body — <code>UplotChart.vue</code> rendering one min/max band pair per item (two stroked series of the same colour + a filled band at 15% opacity).</li>
<li>&ldquo;No physics data&rdquo; overlay — shown when every item's min / max arrays are all NaN (typical for Availability without a physics licence).</li>
</ul>
<h2 id="behavior">Behavior</h2>
<ul>
<li><strong>Windowed fetch.</strong> Only the <code>ClStrip.GetDispBegin() .. AbsDispEnd</code> window is fetched, at a bucket count matching the chart's pixel width. The server-side <code>ClStrip.GetMinMaxList(threshold, itemCount)</code> handles down-sampling.</li>
<li><strong>Pointer interactions</strong>:
<ul>
<li><code>wheel</code> over the plot area → <code>POST /api/cl-strip/wheel</code> with <code>scale = Math.pow(1.05, deltaY * 1/166)</code> + <code>xPositionPercentage</code>.</li>
<li>Right / middle-button drag → <code>POST /api/cl-strip/pan</code> with accumulated <code>xOffsetPercentage</code>. Frame-batched via <code>requestAnimationFrame</code>. Touch / pen drags also pan without a button modifier.</li>
<li>Left click → <code>POST /api/cl-strip/select-step</code> with the nearest bucket's original step index (via <code>chart.valToPos</code> reverse lookup).</li>
<li>Mouse move (debounced 80 ms) → <code>POST /api/cl-strip/enter-step</code> for hover.</li>
</ul>
</li>
<li><strong>Live refresh.</strong> <code>useClStripHub</code> subscribes to <code>DispRangeChanged</code> (re-fetch when anyone else zooms / pans) and <code>Updated</code> (coalesced re-broadcast while a mission is running). <code>PlayerStatusHub.hasProject</code> rising edge also triggers a refetch.</li>
<li><strong>Client-side debounce.</strong> <code>BaseStripChart.load()</code> is debounced 50 ms on the client so a burst of <code>Updated</code> events during a fast-running mission coalesces into one fetch.</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/BaseStripChart.vue</code> — shared strip-chart skeleton.</li>
<li><code>wwwroot-src/src/components/player/charts/UplotChart.vue</code> — uplot wrapper.</li>
<li><code>wwwroot-src/src/components/player/charts/PluralStripAvailabilityChart.vue</code> — availability chart.</li>
<li><code>wwwroot-src/src/components/player/charts/PluralStripRoughnessChart.vue</code> — surface-roughness chart.</li>
<li><code>wwwroot-src/src/components/player/charts/StripIndividualChart.vue</code> — aspect-picker individual chart.</li>
<li><code>wwwroot-src/src/api/clStrip.ts</code> — typed REST wrappers: <code>getClStripRange</code>, <code>setClStripDispRange</code>, <code>clStripWheel</code>, <code>clStripPan</code>, <code>selectClStripStep</code>, <code>enterClStripStep</code>.</li>
<li><code>wwwroot-src/src/composables/useClStripHub.ts</code> — singleton hub wrapper (same ref-counting pattern as the other player hubs).</li>
<li><code>Players/PlayerChartsController.cs</code> — strip-chart data:
<ul>
<li><code>GET /api/player/strip-chart?aspect=Availability|SurfaceRoughness|Individual&amp;xValueCategory=IndexByTime|IndexByStep&amp;widthHint=…&amp;dispBegin=…&amp;dispEnd=…&amp;inspectingKey=…</code><code>{ xs, indexes, items:[{ key, label, unit, min, max }], isXTicksRangeMode, dispBegin, absDispEnd, count }</code>.</li>
</ul>
</li>
<li><code>Players/ClStripController.cs</code> — range manipulation (server-side counterparts of the pointer handlers above):
<ul>
<li><code>GET /api/cl-strip/range</code> — snapshot <code>{ dispBegin, absDispEnd, count, selectedIndex, enteredIndex }</code>.</li>
<li><code>POST /api/cl-strip/disp-range</code> body <code>{ dispBegin, dispEnd }</code>.</li>
<li><code>POST /api/cl-strip/wheel</code> body <code>{ scale, xPositionPercentage, xValueCategory }</code>.</li>
<li><code>POST /api/cl-strip/pan</code> body <code>{ xOffsetPercentage, xValueCategory }</code>. Legacy <code>feelingRatio=2</code>.</li>
<li><code>POST /api/cl-strip/select-step</code> body <code>{ stepIndex }</code><code>ClStrip.SetSelectedPos(...)</code>.</li>
<li><code>POST /api/cl-strip/enter-step</code> body <code>{ stepIndex }</code> (nullable) → <code>ClStrip.SetEnteredPos(...)</code>.</li>
</ul>
</li>
<li><code>Players/ClStripHub.cs</code> + <code>Players/ClStripBroadcastService.cs</code> — SignalR at <code>/clStripHub</code>. Broadcasts <code>DispRangeChanged(snapshot)</code>, <code>StepSelected({ stepIndex })</code>, <code>StepEntered({ stepIndex })</code>, <code>Updated(snapshot)</code>. Single-flight <code>Interlocked</code> mutex coalesces re-broadcasts; client debounce handles the rest of the rate-limiting.</li>
</ul>
<h2 id="deferred">Deferred</h2>
<ul>
<li>Y-axis custom tick formatter (e.g. <code>0.60</code><code>60%</code> for Availability). Port is <code>axes[1].values: (_, vals) =&gt; vals.map(v =&gt; \</code>${(v*100).toFixed(0)}%`)` in uPlot; not yet applied. Same one-liner for µm / N suffixes.</li>
<li><code>triggerHover</code> external programmatic hover — the server-side event flow + client-side hover-on-drag are shipped, but the uPlot cursor is not yet programmatically positioned on incoming <code>StepEntered</code> events from other charts. Pure UX polish.</li>
<li><code>RangeColorRule</code> per-value colour bands — legacy paints bar backgrounds by value thresholds. Requires a custom uPlot <code>draw</code> hook.</li>
<li><code>VRange</code> modes (Fit / Lock / Symmetric) from <code>StripIndividualInputGroup</code> — uPlot supports via <code>scales.y.range</code> function; deferred (auto-fit default is fine for now).</li>
</ul>
<h2 id="related-pages">Related Pages</h2>
<ul>
<li><a href="cycle-line-charts.html">Cycle-Line Charts</a> — per-selected-step charts that share the same <code>uplot</code> engine.</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>