DatumHueEnterprise v0.0.24datumhue.com
Contents

handle9 methods, 1 field

DataHandle

Opaque tabular-data handle produced by bytes:csv() and bytes:parquet(). Methods read the data when first needed or return a derived handle; a later read reuses that work rather than repeating it.

Obtained from
Bytes:csv, Bytes:parquet, DataMount:query
Accepted by
Scale:fit, Scale:reset, Mark:replace_data, PlotArea:line, PlotArea:points, PlotArea:area, PlotArea:bars, PlotArea:histogram and 4 more

The examples on this page start from:

lua
local csv = [[
day,item,loaves
Mon,Bread,12
Mon,Buns,30
Tue,Bread,9
Tue,Buns,24
]]
local sales = datumhue.bytes(csv):csv()

Fields 1

FieldTypeAccessDescription
stateReadyStateread-onlyCompletion state of this operation. Reading it never raises or suspends; a failed operation's error surfaces at :ready().

Methods 9

DataHandle:count

methodsuspends
DataHandle:count() -> integer

Row count, computed from the source — see len() on in-memory batches.

DataHandle:query

method
DataHandle:query(sql: string, params?: any[]) -> DataHandle

Create a lazy SQL query rooted on this handle (bound as the table data). params is an array bound to ? placeholders; a Dir or File handle binds the next ? to a location inside its grant; another DataHandle binds the next ? as a table to select from or join. The query runs once, on first read.

Example
-- In the SQL the table is called data; each ? takes the next value.
local sql = "SELECT SUM(loaves) AS total FROM data WHERE item = ?"
local buns = sales:query(sql, { "Buns" })
for _, row in buns:rows() do
    print(row.total) --> 54
end

DataHandle:rows

method
DataHandle:rows(opts?: data.RowsOptions) -> function, table, integer

Streaming row iterator (for _, row in h:rows() do). One row table per step; each step suspends until the data is available. A full pass over the source with a table allocated per row — for rendering, bind the handle to a chart mark instead of iterating.

Example
-- A table per row, keyed by column; columns picks which to read.
for i, row in sales:rows({ columns = { "item", "loaves" } }) do
    print(i, row.item, row.loaves, row.day) --> 1 Bread 12 nil
    break
end

opts data.RowsOptions options 1 key, 1 inherited

KeyTypeDefaultDescription
From data.ColumnSelectBase
columnsstring[]every columnColumn names to include.

DataHandle:batches

method
DataHandle:batches(opts?: data.BatchesOptions) -> function, table, integer

Streaming batch iterator yielding DataBatch values that expose columns directly via DataColumn — no per-row Lua table allocation. Each step suspends until the data is available.

Example
-- Columns of up to size rows at a time; get counts from 1 in each.
local total = 0
for _, batch in sales:batches({ size = 3 }) do
    local loaves = batch:column("loaves")
    for i = 1, batch:len() do
        total = total + loaves:get(i)
    end
end
print(total) --> 75

opts data.BatchesOptions options 2 keys, 1 inherited

KeyTypeDefaultDescription
sizeintegereach source batch wholeRows per batch; each source batch is sliced into chunks of at most this many rows.
From data.ColumnSelectBase
columnsstring[]every columnColumn names to include.

DataHandle:schema

methodsuspends
DataHandle:schema() -> Schema

Describe the columns, their types, nullability, and metadata.

Example
local schema = sales:schema()
print(schema:len(), schema:field("loaves"):dtype()) --> 3 int64

DataHandle:view

methodsuspends
DataHandle:view(options: data.ViewOptions) -> DataView

Create a viewport-aware, downsampled projection of this handle.

Example
-- A mark bound to the view draws its rows downsampled to the
-- pixel budget.
local lines = { "t,v" }
for t = 1, 1000 do
    lines[#lines + 1] = t .. "," .. math.sin(t / 50)
end
local wave = datumhue.bytes(table.concat(lines, "\n")):csv()
local view =
    wave:view({ x_column = "t", y_column = "v", pixel_width = 100 })
print(view:range().x_max) --> 1000.0

options data.ViewOptions options 10 keys, 4 inherited

KeyTypeDefaultDescription
x_column requiredstringno defaultColumn name for the x axis.
y_column requiredstringno defaultColumn name for the y axis.
strategy"none" | "lttb_pixel" | "stride" | "bin_2d""lttb_pixel"Downsampling strategy.
pixel_widthnumberthe canvas's width, else 400X-axis downsampling pixel budget.
pixel_heightnumberthe canvas's height, else 300Y-axis downsampling pixel budget.
canvasDrawCanvasthe budget comes from pixel_width and pixel_height aloneDraw canvas to size the pixel budget from.
From data.RangeBounds
x_minnumber | string"auto"Lower x bound: a number, or "auto" to fit the data.
x_maxnumber | string"auto"Upper x bound: a number, or "auto".
y_minnumber | string"auto"Lower y bound: a number, or "auto".
y_maxnumber | string"auto"Upper y bound: a number, or "auto".

DataHandle:encode_csv

methodsuspends
DataHandle:encode_csv() -> Bytes

Serialize the handle's contents as CSV, returning a Bytes userdata.

Example
local tuesday =
    sales:query("SELECT item, loaves FROM data WHERE day = 'Tue'")
local encoded = tuesday:encode_csv()
print(encoded:text()) --> item,loaves Bread,9 Buns,24

DataHandle:encode_parquet

methodsuspends
DataHandle:encode_parquet() -> Bytes

Serialize the handle's contents as Parquet, returning a Bytes userdata.

DataHandle:ready

methodsuspends
DataHandle:ready() -> DataHandle

Wait until this asset is fully loaded, then return it for chaining. An in-memory asset returns at once; one still loading (a file read or remote fetch) yields the coroutine until it lands. A load failure raises; format errors on playable assets still surface at use time.

Example
-- A query runs when first read; ready runs it now, and raises if it
-- fails.
local typo = sales:query("SELECT loaf FROM data")
print(typo.state) --> pending
local ok = pcall(function()
    typo:ready()
end)
print(ok, typo.state) --> false failed

Types 3

data.ColumnSelectBase

options

options 1 key

KeyTypeDefaultDescription
columnsstring[]every columnColumn names to include.

Extended by: data.BatchesOptions, data.RowsOptions

data.DownsampleStrategy

enum
ValueDescription
"none"
"lttb_pixel"
"stride"
"bin_2d"

Nested in: data.ViewOptions

data.RangeBounds

options

options 4 keys

KeyTypeDefaultDescription
x_minnumber | string"auto"Lower x bound: a number, or "auto" to fit the data.
x_maxnumber | string"auto"Upper x bound: a number, or "auto".
y_minnumber | string"auto"Lower y bound: a number, or "auto".
y_maxnumber | string"auto"Upper y bound: a number, or "auto".

Extended by: data.SetRangeOptions, data.ViewOptions

datumhue.com

(c) 2026 Shuusei AB. Quote excerpts of this manual, with attribution to DatumHue, in your own documentation, tutorials, course materials, reviews, and other writing or video. Republishing it in whole or in substantial part needs written permission: support@datumhue.com.

Victor Mono is licensed under the SIL Open Font License 1.1
Copyright (c) 2024, Rune Bjørnerås (https://github.com/rubjo)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Try

    ↑↓ selectEnter openTab filter

    Settings

    Theme
    Text
    Print

    Keyboard shortcuts

    / or Ctrl KSearch
    ↑ ↓ EnterPick a result
    TabNext result filter
    j kNext or previous entry
    [ ]Previous or next page
    yCopy a link to the current entry
    ?These shortcuts
    EscClose

    On this page