Coordinate

Coordinate :: # (opaque)

One Cartesian coordinate: a category/date string or a finite number. String and numeric literals are checked by their literal conversions. Runtime text uses Coordinate.from_text; runtime floating numbers pass through Coordinate.from_number before entering a point.

is_eq : _

Compare coordinates by kind and value; text "1" differs from numeric 1.

from_text : Str -> Coordinate

Construct categorical or date text. Plotly interprets date strings according to the selected axis type.

from_number : F64 -> Try(Coordinate, [NonFiniteCoordinate(F64)])

Construct a numeric coordinate after checking that it is finite. Returns NonFiniteCoordinate(number) for NaN or either infinity. All finite F64 values, including negative values and zero, are accepted without changing them. Numbers use F64 precision.

expect {
    coordinate = Coordinate.from_number(2.5)?
    coordinate.to_json() == "2.5"
}
from_quote : Str -> Try(Coordinate, [BadQuotedBytes(Str)])

A string literal denotes a text coordinate.

to_json_value : Coordinate -> InternalJson

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

to_json : Coordinate -> Str

Serialize this scalar as a complete JSON document.