Skip to documentation
SLOP

tiny.zen.diagram.space

Reference tiny.zen diagram space

Defined in diagram.

API (5)

Actions

Public operations.

No direct callersNo direct callsdiagramspace
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallsprivate sourcelib.zen.src.diagram.ascii.plotxCelldiagram.categorycoordinatediagram.categorylabeldiagram.spacexNumberCoordinatediagram.spacexCoordinate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.zen.src.diagram.ascii.markdrawDiagramBoxdiagram.spacexDistance
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsprivate sourcelib.zen.src.diagram.ascii.plotnumberXCelldiagram.spacexCoordinatediagram.domainratiodiagram.spacexNumberCoordinate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsprivate sourcelib.zen.src.diagram.ascii.plotyCelldiagram.domainratiodiagram.spaceyCoordinate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.zen.src.diagram.ascii.markdrawDiagramBoxdiagram.spaceyDistance
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/zen/src/diagram/root.zig:10

zig
pub const space = @import("space.zig");

Source: lib/zen/src/diagram/space.zig

zig
const category = @import("category.zig");const domain = @import("domain.zig");const model = @import("model.zig");const root = @import("root.zig");const spec = root.spec;const Bounds = model.Bounds;pub fn xCoordinate(value: spec.XValue, bounds: Bounds, left: f64, right: f64) !f64 {    if (bounds.categorical) {        var buffer: [category.label_buffer_bytes]u8 = undefined;        const label_value = category.label(&buffer, value);        return category.coordinate(label_value, bounds, left, right);    }    return xNumberCoordinate(value.number, bounds, left, right);}pub fn xNumberCoordinate(value: f64, bounds: Bounds, left: f64, right: f64) !f64 {    return left + try domain.ratio(value, bounds.x_min, bounds.x_max, bounds.x_kind, bounds.x_base) * (right - left);}pub fn yCoordinate(value: f64, bounds: Bounds, bottom: f64, top: f64) !f64 {    return bottom - try domain.ratio(value, bounds.y_min, bounds.y_max, bounds.y_kind, bounds.y_base) * (bottom - top);}pub fn xDistance(value: f64, bounds: Bounds, left: f64, right: f64) f64 {    return value / (bounds.x_max - bounds.x_min) * (right - left);}pub fn yDistance(value: f64, bounds: Bounds, bottom: f64, top: f64) f64 {    return value / (bounds.y_max - bounds.y_min) * (bottom - top);}

Audit

Definitions6
Public names6
Members0
Version26.7.0
Revisiondaab053ee433