Strip Charts Behavior
How a gesture on one strip chart writes the shared window, and how a chart fetches that window. The group bar, the three bodies and the empty states are on Strip Charts.
- Windowed fetch. Only the
ClStrip.GetDispBegin() .. AbsDispEndwindow is fetched, at a bucket count matching the chart's pixel width. The server-sideClStrip.GetMinMaxList(threshold, itemCount)handles down-sampling. - Pointer interactions — every one of them writes the shared
ClStrip, so a gesture on one chart moves all three:wheelover the plot area →POST /api/execution/cl-strip/wheelwithscale = Math.pow(1.05, deltaY * 1/166)+xPositionPercentage. Over the legend pane the same wheel scrolls the legend and does not POST; over the divider it does not POST, does not zoom the chart and does not scroll the legend.- Right / middle-button drag →
POST /api/execution/cl-strip/panwith accumulatedxOffsetPercentage. Frame-batched viarequestAnimationFrame. Pen drags also pan without a button modifier. - Left-button drag → a rubber-band x-range zoom: a translucent band tracks the drag over the plot area and the release POSTs the swept fractions to
/api/execution/cl-strip/zoom-range. A drag under 6 px, or under half a percent of the plot width, is discarded so the trailing click selects a step instead — which is what makes click-to-select survive an unsteady hand. The gesture is mouse-only. - Left click →
POST /api/execution/cl-strip/select-stepwith the step of the bucket under the pointer (stepIndexAtClientX, shared with the hover): the nearest point on a chart of magnitudes, and on a staircase — an ID's or a tree's — the first bucket whose x is at or after the pointer, since a bucket holds (x[i−1], x[i]] — on a tree's chart the bucket of the pixel column under the pointer when that column shows a more important leaf (Pointer, under Body for a color tree in Strip Charts); the legend reads the same bucket. The step is the bucket's own first step (firstStepOfBucket: downsampledindexes[i − 1],dispBeginfor bucket 0; raw the point's own step), and on a tree's chartleafStepIndex[i], the first step of its highest lane, unless that is −1. A click that ended a pan or a zoom drag is ignored. Once the select has answered, the chart hands the step to the Control Tree host'srevealStepInProgram(injected asCONTROL_TREE_HOST): Follow off and, with the selection in the Program branch, the Program viewer brought to the step's file node, pass and line — see What a Run Marks. - Right click → the segment menu (
q-menu,data-testid="strip-ctx-menu", itsdata-stepthe step it was opened on), at the pointer, with a project open, forsegmentStepAt's step: downsampled, on a chart of magnitudes, the bucket's step at themaxorminnearest the pointer (maxIndexes/minIndexes), a peak's own; else a left click's (stepIndexAtClientX). A right drag still pans, and the menu answers only a press this chart took (onContextMenu: its pan,panOrigin, or the mouse's rubber band,zoomDrag). Windows raisescontextmenuafter the release, on whatever the pointer is over: a right drag begun elsewhere — the 3D canvas's rotation — and let go over this chart brings one with no press of this chart behind it, which opens nothing; the release of this chart's pan brings it while the pan still holds itsmovedfor 50 ms — that pan alone: a press of the same pointer that begins another pan within those 50 ms keeps its own —, so it opens nothing either; and the pan let go off this chart brings it to the element there, where it is taken (onContextMenuElsewhere, a capture-phasecontextmenuonwindowwith no button down, while a mouse's or a pen's pan of this chart lingers, or for 50 ms after such a pan's lift came off the body,panReleasedElsewhere): neither the browser's menu nor that element's opens. Elsewhere the browser raises it on the press: a mouse's or a pen's menu waits for that button's release (stripMenuOnRelease,onPointerUp) and opens only if the press did not pan; a Ctrl+click's on macOS, raised on a left press, opens at the release only if the press swept no rubber band, and the click that release brings selects no step; a finger's long press opens it as it comes. Select this machining segment (strip-ctx-select-segment) and Select the whole feature (strip-ctx-select-feature) POST/api/execution/cl-strip/select-feature-segmentwith the step andboundaryTouchorFeaturethroughuseFeatureSegment, and the charts follow on theDispRangeChangedbroadcast; Show the whole mission (strip-ctx-reset-range) does what the group bar's Reset does. A refusal notifies itscharts.stripMenutext (stripMenuRefusalText:NoSegmentunderTouchThere is no cut before or after this step.,StepNotBuiltYet,NoStep,NoStrip,Error), any other the server's reason after the item's name. Each item's tooltip says what it does. The menu selects no step and moves no camera. From the menu'sbefore-showto itsbefore-hide(notshow/hide: Quasar raises them after its 300 ms transition), a press anywhere outside it closes it (onStripMenuOutsidePress, a capture-phasepointerdownondocument: Quasar's own click-outside skips the menu's anchor, this chart's body, hears nomousedownafter apointerdownthat prevents the default, and stops and prevents atouchstart, so that a finger pressed elsewhere would lose itstouchstart, its compatibility mouse events and its click, though a control driven by pointer events would still act; the hide in thepointerdowntakes that listener away before thetouchstartcomes); on this chart off its legend pane and divider, any press but a right one starts nothing — no zoom, pan or step selection (stripMenuDismissPress,stripMenuDismissClick), and a finger's press holds the touch gesture: no finger that joins it pans or pinches until all have lifted, and the gesture's synthetic click is swallowed (stripMenuDismissTouches) — but, like every press, takes away the tick name shown over the Y gutter; one on the legend pane or divider acts as it would, a right press closes it and, on a chart, opens it again where it lands if a step lies there and the press does not pan, and so does the long press of a finger, or a Ctrl+click on macOS, that closed it on this chart (stripMenuDismissHold: that press, which starts no gesture, while it is down and for 50 ms after its lift on the body, for a context menu raised after the lift — Chromium's on Windows for a long press, and WebKitGTK's, which synthesizes a long press's right click at the release; a lift elsewhere, a cancel or the next primary press of its pointer's type ends it at once); a right click on the menu opens no browser menu over it (theq-menu's@contextmenu.prevent: Quasar hands the menu's listeners to its own element, out of this chart's body); Esc closes it (Quasar's). - Touch → one finger pans, a second finger converts the pan into an x-axis pinch-zoom; the click that may trail the lift is swallowed so panning past a step never selects it: one click, the first within 32 px of the lift (
SYNTHETIC_CLICK_RADIUS_PX) inside 300 ms, whatever pointer it names (suppressSyntheticClick; WebKitGTK synthesizes a tap's click as a mouse's, so a click'spointerTypedoes not tell a finger's from a mouse's). Where the gesture emits no click of its own — a pan past the tap distance, a pinch, the finger that closed the menu lifted after a long press or a slide — a user's click there within that time is taken in its place; once the gesture's own click has come, a later one goes through, and a click farther from the lift — a group bar's button, a peak elsewhere — is the user's. Each finger takes its pointer capture on the chart's body (captureTouch), which uPlot's rebuild leaves in place, and a finger is down while the body holds its capture (touchStillDown: a lift ends the capture, and so does a cancel, except in WebKitGTK and WPE, which keep it — thereonPointerCanceldrops the finger itself); a mouse's or a pen's capture is taken on the element it presses. - A lift or cancel that reaches the page but not the chart's body → the gesture of its pointer ends as a cancel ends it (
onPointerEndedElsewhere, a capture-phasepointerup/pointercancelonwindow, for a target outside the body): uPlot's rebuild, which a poll's answer may ask for, removes the element that holds a mouse's or a pen's capture, and the pointer then lifts wherever it is; left in its gesture until the next primary press of its pointer's type, a rubber band would stay drawn, and a pan that moved would swallow the click of a pointer of another type made meanwhile. A finger's capture is on the body, which the rebuild leaves, and a finger's lift that lands elsewhere all the same is ended here too. The lift of a mouse's or a pen's pan that came off the body is remembered for 50 ms (panReleasedElsewhere), for the context menu Windows raises after it there (onContextMenuElsewhere). A lift that never reaches the page — a button released over another window, where Chromium gives the page only alostpointercapture— is ended by the next primary press of its pointer's type, wherever on the page it lands (onPagePointerDown, a capture-phasepointerdownonwindow, before the press's own handlers, this chart'sonPointerDownamong them, callsendLostGestures: a touch's held fingers, its pinch and its pan; a mouse's or a pen's pan, the lift of one remembered off the body and a menu waiting for its release; the mouse's rubber band; and the hold of the press that closed the menu), since a primary press is the one pointer of its type that is down: a rubber band whose release went to another window, the 3D canvas pressed next and the button let go over this chart, does not zoom then. A finger whose capture the chart's body still holds is down and kept, though (touchStillDown; WebKitGTK and WPE keep the capture past a cancel, whereonPointerCanceldrops the finger first): WebKitGTK calls the first touch of its touch list primary, not the first finger, so there a second finger's press may be the primary one while the first is down. The body holds a finger's capture, not the element pressed, because the rebuild removes that element: WebKit lets go of only one pointer's capture when an element goes, and another finger captured on it would send its events to the detached element, none of them to the page. - Mouse move (throttled: the first move fires at once, continued movement every 50 ms with the latest position, and nothing while the pointer stays on the same step — in a downsampled answer, within one bucket) →
POST /api/execution/cl-strip/enter-stepfor hover, with the step a click there selects; the bucket the legend reads gives the group bar's readout its x (hoveredXLabel). Over the Y gutter the same move shows the nearest tick's full name and does not change the hovered step. Over the swatch column, inside the plot, the same move shows that name and still posts enter-step.
- Step to bucket. The selected step's rule (
selectedX) and the entered step's cursor (theStepEnteredecho,setHoverIdx) go to the bucket that holds the step (bucketOfStep), on all three charts alike, whichever chart or the 3D view set it: downsampled, bucket i holds[indexes[i − 1], indexes[i] − 1](bucket 0 fromdispBegin), and the last bucket its own last step as well, the window's last step; raw, a point is its own step (a ceil search onindexes). On a staircase the cursor sits three quarters into its bucket (STEPPED_CURSOR_AT), where both of uPlot's readings name it; on a tree's chart, where the pixel column there shows a more important leaf, it moves inside the bucket to the first column that shows the bucket's own (cursorLeftAt). - Picked key first. Picking a key on the Color Index chart POSTs it to
/api/execution/inspecting-keybefore the local key changes and the chart fetches; a POST that fails leaves the key the server holds and notifies. A project without an inspecting key gets the picker's fallback posted as its key. While the host fills the slots for the picked key the chart shows Not ready — reading the values of this property and fetches again on theUpdatedbroadcast the scan's end raises. A key set elsewhere is followed: Set as color index on the Step Colors Branch announces it (inspectingKeyAnnouncement) and the chart adopts it; set in another tab or over the REST, the chart's own key answers pending with no item, and the first such answer reads the step properties and adopts theircurrentKey(a failed read is retried at a later pending answer, 5 s on at the soonest), never while the server still serves the chart's key. - Live refresh.
useClStripHubsubscribes toDispRangeChanged(re-fetch when anyone else zooms / pans) andUpdated(coalesced re-broadcast while a mission is running). A rising edge on the execution status hub'shasProjectalso triggers a refetch. - Single-flight load loop. Each chart runs its fetches through one loop that never overlaps two requests: a trigger arriving while a fetch is in flight only marks one more fetch as due, so a burst of
Updatedevents during a fast-running mission coalesces into at most one extra fetch. Consecutive fetch starts are at least 500 ms apart (MIN_LOAD_INTERVAL_MS), capping a chart at two requests a second. - Fetch deadline. A strip-chart request that has not settled after 30 s is aborted and reported in a notification carrying the chart's title — Request timed out (30 s) when no answer had arrived — so the loop is free to fetch again rather than waiting on it for good.
- Superseded and abandoned requests. A newer
load()— an x-axis mode switch, a new Color Index key, a group reload — aborts the request its chart is still waiting on, and a chart that unmounts (its tab left, the Session Info panel hidden or another page shown) aborts its own; the aborted call ends silently. On the server the strip walk checks the request's cancellation at every chunk of steps and every 8192 steps within one, stops there, and answers the shape-preserving empty payload without writing an error to the log.
See Also
- Strip Charts — the group bar, the three chart bodies and the empty states
- Strip Charts Source Code — the components and the routes these gestures call