Expand description
Columnar data drawn as vertices, edges, lines, and areas on the GPU.
A Data is a named collection of Tables, changed in place by Patches; a clone is an
O(1) snapshot. A Scene describes what to draw and how it answers input: marks that name tables
of data, in a space, with a theme and controls. A View draws a scene into any wgpu frame, is
given the data by name, and turns platform Input into Events.
Every input is plain data that deserializes: from_json reads one from JSON text, an error
naming the path to what it could not read, and schema gives its JSON Schema.
Modules§
- host
- What the platform does for latkit: set and measure text in its fonts, do jobs off the frame, fetch
bytes (tiles, and the files JSON documents name), and encode video with its
Encoder. AGpuis given its host withGpu::set_host; without one, views draw no text, do their jobs at once, fetch nothing, and encode no video. A browser’s host isBrowser, built with thewebfeature forwasm32. Natively, thenativefeature suppliesNative: lazy fonts, a worker pool doing jobs and reading files, and Media Foundation’s H.264 on Windows, without a window or network client. - resource
- Fetching bytes for CPU data loading, independent of graphics and window systems.
Structs§
- Areas
- Rows drawn as the areas a polygon field holds: parcels, states, lakes, the land and water of a
map. The view cuts each row’s polygons into triangles once, off the frame when they are large;
on the earth they bend with the globe and stay whole across the antimeridian. Outline areas with
a
Linesmark of the same table, which draws their rings. - Axis
- A plot axis.
- Budget
- How much GPU memory latkit uses.
- Color
- An sRGB color with straight alpha, each channel in
0..=1, as in CSS. - Colormap
- Colors for a range of values: one of the catalog’s, or one of your own.
- Controls
- How a view answers the pointer and keyboard, and how much it moves on its own: a preset, or options over the defaults. Each mark says whether its rows pick, select, and drag; these say what the view itself does.
- Data
- A named collection of tables, changed in place by patches.
- Decode
Limits - Limits for one binary frame. These bound encoded bytes and conservative decoded storage accounting; applying a patch and retaining datasets have separate memory costs.
- Description
- What a dataset holds: its tables, their rows and fields, and the axis its sampled fields are recorded over and span.
- Device
Events - Receives events from an application-owned wgpu device without taking over its callbacks.
- Diagram
- A sheet for diagrams, flat and seen from straight above: the camera pans and zooms. Positions are units with y down, and every length is a unit, a CSS pixel at zoom 0 (sizes, padding, ports, strokes, text, and the theme’s), except glow, halo, and pick radius. Zooming scales one fixed picture. Only a diagram has ports, groups, nets, and orthogonal routes; it lays out blocks.
- Earth
- The earth: positions are longitude and latitude in degrees.
- Edges
- Rows drawn as strokes between the vertices two reference fields name: branches, links, wires. In a diagram, a row without ends is a net: it joins every vertex port whose reference field names it.
- Encoding
- A video: its pictures’ size in pixels, frames a second, and the bits a second an encoder spends.
- End
- A vertex a connection ends at, and its port when it has the one the connection meets.
- Envelope
- Rows’ least and greatest values of a sampled field over spans of its axis.
- Expr
- A value for every row of a mark: a constant, a field, view state, or arithmetic of them.
- Faces
- Rows drawn as triangles between the vertices three reference fields name: meshes, surfaces, and fields interpolated across a network. Faces are lit from the camera, so a flat mesh seen from above shows its exact colors.
- Field
Description - A field described: what it holds, the table a reference names, the coordinates samples span.
- Flow
- How comets flowing along edges and lines look: each a round head, brightest at its middle, trailing a tail that thins and fades.
- Frame
- A frame to draw: where, a texture view of a format and size in physical pixels at a ratio of physical pixels to CSS pixels, and when.
- Gpu
- The GPU device that views draw with. Cheap to clone; views of one
Gpushare uploaded data. - Hit
- A row under a point, as the frame drew it.
- Ids
- Row ids, as given to
Table::neworPatch::remove, and the target ids of a reference. - Image
- RGBA texels, straight alpha, sRGB, rows top to bottom.
- Label
- A row’s text, placed beside, inside, or along what its mark draws, following it every frame: a text field, or options. Labels that would overlap give way by priority; among equals, those already shown keep their place. In a diagram a label is part of the drawing: it scales with the zoom, fades out once too small to read, and shows wherever it fits its vertex.
- Layered
- Layered drawing: vertices in ranks, edges pointing along
flow, and nets from their outputs. - Lines
- Rows drawn as lines: along a path field (roads, rivers, borders) or a polygon field’s rings, outlining its areas; on a plot, through a sampled field’s history across the data’s axis, what a monitor shows. On the earth paths bend with the globe and stay whole across the antimeridian.
- Mapped
- A value mapped through a colormap or onto a range, whose domain can be set.
- Modifiers
- Keys held during an input.
- Mp4
- A
Sinkencoding H.264 with the host’s encoder and writing it tooutas fragmented MP4 while frames are drawn. A frame lasts until the next one shows, so held frames cost nothing. - Name
- The name of a dataset, table, or field: cheap to clone, compared and ordered by its text.
- Panels
- Where each of several views draws in a target: x, y, width, and height as fractions of it, a panel per view, in order; a later panel draws over an earlier one. None given is one view filling the target.
- Patch
- Changes to a dataset, applied in order and all at once by
Data::apply. - Patches
- Patches by dataset name, in the order written: what one step of a stream of changes carries, as
JSON
{"grid": [...], "weather": [...]}, each patch inPatch::load’s form. - Path
- Where in an input an
Error::Invalidoccurred. - Pending
- A value still to come: a future its
Resolverresolves, from a view’s frames, a host’s worker, or the network. A view’s answers resolve to an error when the device is lost, and stay pending while no frames are drawn. Destroying their owner cancels them. Await it, ortakeit from a frame loop. - Plane
- A plane: positions are plane units.
- Plot
- A plot: x is the data’s axis, y the values.
- Port
- A vertex’s port: where a net its reference field names meets it, on one side of its marker: a side, or options. An output drives its net: layouts rank a net from its outputs, and its arrows point away from them.
- Query
- The rows of a table to read back: of the rows
idsnames (every row unless set), thosefilterkeeps, sorted bysort, a page of them fromoffsetof at mostlimit, with the fieldsselectnames or computes; sampled fields read at axis coordinateat, their last frame by default. Plain data, like a scene. - Resolver
- What resolves a
Pending: a host keeps it until its job or fetch is done. Dropping it without resolving cancels the answer and wakes its waiter. - Row
- A row of a table in a dataset. It survives any change that keeps the names and the id.
- Rows
- Rows of one table in a dataset, by id: what a view selects, fits, and tells as sets of rows.
- Sample
- A sample of a traced field: its frame, the axis coordinate it was recorded at, and its value.
- Scene
- What a view draws and how it answers input: a space, marks in drawing order, a layout, a theme,
controls, how long changes ease, and the title written over it. Plain data: as JSON, each field by
its name in camelCase, each mark
{ vertices | edges | faces | lines | areas: options }. - Shadow
- How marks that cast shadows cast them onto the ground and onto faces.
- Shot
- A picture of views, each drawn into its panel of
sizepixels atscalepixels per CSS pixel: plain data, like a scene. - Size
- A size: CSS pixels, or position units with
units, kept within a range of CSS pixels. - Stats
- What a view does each frame.
- Stop
- A colormap’s color, at a place from 0 to 1 or evenly between its neighbors: from a
Coloror a(place, Color)pair. - Stress
- Stress majorization: each pair of vertices pulls toward its graph distance; then their boxes part, keeping a quarter of the gap clear.
- Table
- A named set of rows with fields: the rows of one type in a dataset, or rows to write into one.
- Table
Description - A table described: its rows, and its fields by name.
- Theme
- Colors and sizes marks take where their options read nothing, and the look of focus and motion: a
base theme’s name, or options over one (
base, dark unless set). Lengths are CSS pixels; in a diagram they are units, exceptglowandhalo. - Then
- The cases of a
when, waiting for another case or the value otherwise. - Tiles
- Data a view fetches in pieces as it asks for them, kept as a dataset the view owns. Give them to a
view with
View::set_tiles; what the source’s first bytes hold says which they are. - Trigger
- Where, with what keys, and with what the user acted. For keys, the point is the row they point at, else the pointer, else the view’s middle.
- Values
- One column of values, as given to
Table::fieldor read from a page. - Vertices
- Rows drawn as markers: points of a map, nodes of a graph, blocks of a diagram.
- Video
- A video of a shot’s pictures, handed to its sink while they are drawn.
- View
- A scene drawn from named data: the application owns data and scene; the view owns camera,
coordinate, selection, and what the frame needs. It has no loop:
renderrecords a frame into an encoder the application submits, andinputtakes the platform’s pointer and keys. - Waiting
- The work under way a frame stood in for, by kind; nothing when the frame was complete.
- When
- The open cases of a
when. - Work
- What a
Gpudid since it was made; subtract two for what happened between.
Enums§
- Button
- A pointer button.
- Camera
- Where a view looks.
- Colormap
Kind - How a colormap spans values.
- Cursor
- The pointer a view asks for over what it shows.
- Device
- What the user acts with.
- Direction
- A direction on screen.
- Error
- Everything that can go wrong in latkit.
- Event
- What happened in a view, for the application to act on. Drain them with
View::events. - Fit
- What
View::fitframes. - Format
- How an axis writes its tick values.
- Grid
- A plane’s or a diagram’s grid:
"off",{ lines: { pitch } }, or{ dots: { pitch, snap } }. - Id
- A row’s identity within its table: a number or a text. A number above 2^53 − 1 serializes as decimal text, which names the same row, since JSON readers such as JavaScript’s round it.
- Image
Format - How an image is written as a file.
- Input
- A pointer, wheel, or key event, with points in CSS pixels from the view’s top left.
- Interpolation
- How a line runs between its samples.
- Key
- The keys a view answers.
- Kind
- What a field holds.
- Layout
- How the view places vertex rows without positions: a diagram’s blocks, sized, or the points of a
plane or the earth, among the rows linked to them, gaps in the space’s units: a name, or
{ stress | layered: options }. A place, once given, holds: rows added later are placed around the rest, andView::arrangelays every row out again. - Mark
- One drawn table of a scene:
{ vertices | edges | faces | lines | areas: options }as JSON. - Marker
- How a vertex is drawn: a shape’s name,
"block", or{ shape | block | gauge | pie | icon | wgsl: options }. - Motion
- How much a view moves on its own.
- Order
- Which way a sort runs; rows a key reads nothing for come last either way.
- Phase
- The phase of a
Drag. - Pixels
- The bytes a picture is composed into.
- Projection
- How the earth is drawn.
- Route
- How an edge runs between its ends.
- Shape
- A marker’s outline.
- Side
- A side of a marker.
- Space
- The coordinate space a scene’s positions are in: a name, or
{ plane | diagram | earth | plot: options }. A diagram is a flat sheet seen from straight above: y runs down, and every length is a unit, a CSS pixel at zoom 0, except glow, halo, and pick radius. Only a diagram has ports, groups, nets, orthogonal routes, and layouts. - Step
- One step of a
Path: a named part or an index. - Value
- One value read from a dataset.
- Zoom
- What zooms a view.
Traits§
- Sink
- What a video’s frames go to, in order: an
Mp4file, or whatever an application makes of the pixels.
Functions§
- elapsed
- Seconds since the view was created; a mark that reads it redraws every frame.
- field
- The field
nameof each row. - from_
json - What JSON
textholds, read asT: a scene, a camera, a fit, a query, rows, a budget, a shot, or any type that deserializes. An error names the path to what could not be read. - hovered
- Whether the pointer is over the row.
- pointer
- CSS pixels from a vertex to the pointer; for vertices only, and not in their position.
- schema
- The JSON Schema of what
Tdeserializes from, its definitions under$defs. - schemas
- Every input’s JSON Schema in one document, each under its name in
$defswith what it is built of:Scene,Data(a dataset’s document),Patch,Query,Camera,Fit,Budget,Shot. What latkit writes is underoutputs, as it serializes:ViewEvent,Stats,Work,Description,Rows,Camera,Budget,Value, andFailure(an error). - selected
- Whether the row is selected.
- units
- A size measured in position units, so it scales as the view zooms;
Size::at_leastandSize::at_mostkeep it within CSS pixels. - when
- Starts a conditional:
when(c).then(a).when(d).then(b).otherwise(e). - zoom
- The camera’s zoom: the web mercator level on the earth, log₂ CSS pixels per unit elsewhere. Options that read it change with the view, as levels of detail do.