Axis

Axis :: # (opaque)

Plotly axis settings. Numeric and date bounds are explicit closed cases; arbitrary JSON fragments are never accepted as bounds.

default : Axis

Leave the entire axis at Plotly defaults, encoding an empty object. Unlike Axis.new with default props, this adds no range or color overrides.

new : Props -> Try(Axis, [InvalidAxisBounds({ min : F64, max : F64 })])

Validate numeric bounds and construct an axis override. Returns InvalidAxisBounds({ min, max }) if either numeric endpoint is nonfinite. Either endpoint order is accepted. Date bounds remain strings for Plotly to interpret and are not parsed here.

expect {
    axis = Axis.new({ type: Log, range: Bounds({ min: 0, max: 2 }) })?
    axis.to_json().contains("log")
}
to_json_value : Axis -> InternalJson

Internal composition hook used by Plume's renderers. Applications normally use Axis.to_json for complete JSON text; this returns the package's safe internal value without accepting raw JSON.

to_json : Axis -> Str

Serialize this validated value as a complete JSON document.

Type : [Auto, Linear, Log, Date, Category]

Choose how Plotly interprets coordinates on one axis. Auto lets Plotly infer the scale. Linear and Log use numeric coordinates; Date interprets date strings. Category uses category labels represented by text coordinates.

RangeSpec : [Auto, Fixed, Reversed, Bounds({ min : F64, max : F64 }), DateBounds({ start : Str, end : Str })]

Choose automatic range behavior or explicit bounds. Auto lets Plotly choose bounds. Fixed disables interactive range changes without selecting bounds. Reversed automatically orders bounds in reverse. Bounds({ min, max }) supplies finite numeric endpoints, whose order may reverse the axis. For a Log axis these are base-10 exponents, so 0 to 2 shows values from 1 to 100. DateBounds({ start, end }) supplies date strings interpreted by Plotly; Plume does not parse or validate their date syntax.

Props

:= {
    title : Title ?? Title.default,
    type : Type ?? Auto,
    range : RangeSpec ?? Auto,
    color : Color ?? Color.rgb({ red: 68, green: 68, blue: 68 }),
}

Override one axis's scale, range, title and color. type: Auto omits an explicit scale. range: Auto selects automatic bounds. title defaults to Title.default, and color defaults to dark gray. Use Axis.default to leave the whole axis to Plotly.