DatumHuePlatform v0.0.24datumhue.com
Contents

handle5 methods, 1 field

Mark

A rendered mark (line / points / area / bars / rule / text) inside a plot area. Returned by the area:* mark constructors.

Obtained from
Book:element, PlotArea:line, PlotArea:points, PlotArea:area, PlotArea:rule, PlotArea:text, PlotArea:band, PlotArea:bars and 5 more

The examples on this page start from:

lua
local vec2 = datumhue.math.vec2
local color = datumhue.color
local canvas = datumhue.draw.new({ width = 400, height = 300 })
canvas:mount({ width = 400, height = 300 })
local plot = canvas:chart({ margin = { left = 40, bottom = 40 } })
local mark =
    plot:line({ points = { vec2(0, 1), vec2(4, 3), vec2(8, 2) } })

Fields 1

FieldTypeAccessDescription
visiblebooleanread/writeTrue while the mark is drawn. Assign to show or hide — a hidden mark stops drawing until shown again and re-renders on the next frame when shown; a rule's value label follows the toggle.

Methods 5

Mark:update

method
Mark:update(options: chart.MarkUpdateOptions)

Change the mark's appearance or data. Hidden marks stop drawing until shown again; showing one re-renders it on the next frame. Errors when called on a handle that isn't a mark.

Example
-- Keys left out keep their value.
mark:update({ color = color("#e69875"), width = 4, name = "North" })

options chart.MarkUpdateOptions options 9 keys Omitted keys keep their current value.

KeyTypeDescription
colorColorNew mark color, which a rule's value label takes too. A mark given a color no longer follows the theme.
widthnumberLine / rule stroke width.
namestringLegend name.
pointstableReplacement points array (inline-points marks only).
visiblebooleanShow or hide the mark.
textstringText-mark string.
font_sizenumber | stringText-mark font size — a number (px) or a unit string like "1.5rem"/"50vw".
font_weightnumber | "thin" | "extralight" | "light" | "regular" | "normal" | "medium" | "semibold" | "bold"Text-mark weight on the brand font's variable axis.
font_style"normal" | "italic" | "oblique"Text-mark face.

Mark:nearest

method
Mark:nearest(data_pos: Vec2 | chart.DataPos) -> chart.NearestRow?

Row nearest to the data-space query point. Line / points / area marks answer with the nearest source row (row is the row of the source data, or the position in the inline points); histograms with the bin containing the query x (row is the bin's position, y the bin height); heatmaps with the nearest cell (row is the cell's position); box marks with the category nearest along the band axis (row is the entry's position, value the median); bars marks with the category whose band slot is nearest along the band axis (row is the category's position, value sums the category's series values). Rule / text / band marks carry no data rows and answer nil.

Example
-- The query is in data units; row counts from 1, in the mark's
-- points, and distance is in pixels.
datumhue.time.wait_frames(1)
local hit = mark:nearest(vec2(3.8, 2.9))
print(hit.row, hit.x, hit.y) --> 2 4.0 3.0

data_pos chart.DataPos options 2 keys

KeyTypeDefaultDescription
x requirednumberno defaultData-space x. Exact for time scales (full-precision epoch-ms).
y requirednumberno defaultData-space y.

returns chart.NearestRow record 7 keys

KeyTypeDescription
rowintegerPosition of the nearest point, bin, cell, entry or category, counted from 1.
xnumberData-space x of the nearest point. Exact for time scales (full-precision epoch-ms read from the source rows).
ynumberData-space y of the nearest point.
distancenumberDistance to the query point, in pixel space.
value?numberCell value (heatmap marks), category median (box marks), or category total (bars marks).
x_category?stringCell x-axis category, for categorical heatmap marks.
y_category?stringCell y-axis category, for categorical heatmap marks.

Mark:push_point

method
Mark:push_point(data_pos: Vec2 | chart.DataPos)

Append a single data-space point to a line / points / area mark whose source is inline points. A scale whose domain is pending, or that only this mark's points have filled since it was (a script, a gesture or another mark on the scale ends that), refits to the mark's points after the push, as a constructor's points fit it: a mark created with points = {} fills its scales point by point, and past max_points they follow the points it holds. Any other scale widens to cover the point; a pinned scale stays as it is, a follow scale slides its window with the points, and a time or band scale is not fitted. When the mark was constructed with max_points = N, it keeps the newest N points, dropping the oldest as each new one arrives. Errors on data-bound marks — those reshape via mark:replace_data, not push.

Example
-- Each point widens the scales to cover it, as a constructor's
-- points do; with max_points, the oldest point goes once the mark
-- holds that many.
local recent = plot:line({ points = {}, max_points = 3, width = 3 })
recent:push_point(vec2(4, 1.5))
recent:push_point(vec2(6, 3.5))
recent:push_point({ x = 8, y = 2.5 })
recent:push_point({ x = 10, y = 4 })
print(plot.x_scale.domain.max, plot.y_scale.domain.max) --> 10.0 4.0

data_pos chart.DataPos options 2 keys

KeyTypeDefaultDescription
x requirednumberno defaultData-space x. Exact for time scales (full-precision epoch-ms).
y requirednumberno defaultData-space y.

Mark:replace_data

method
Mark:replace_data(handle: DataHandle)

Swap the underlying data source on a data-bound mark of any kind. Line / points / area marks keep their x_column / y_column and re-render against the new source; aggregating marks (bars, histogram, histogram2d, heatmap, box) keep their column / bin / aggregate bindings and re-aggregate from the new source. Scale domains reset and refit once the new data loads, and a line / area mark with series_column re-partitions its series. Errors on marks built from inline values (recreate those), on inline-points marks (reshape via mark:update({points=...})), and on marks built from a view (update the data through the view).

Example
-- The mark keeps its columns and draws the new rows.
local monday = datumhue.bytes("hour,loaves\n6,4\n7,9\n8,5\n"):csv()
local tuesday = datumhue.bytes("hour,loaves\n6,8\n7,3\n8,7\n"):csv()
local sold = plot:line({
    data = monday,
    x_column = "hour",
    y_column = "loaves",
    width = 3,
})
sold:replace_data(tuesday)

Mark:remove

method
Mark:remove()

Remove the mark. The data or view it was built from stays usable.

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