Skip to content

Tick

Creates short line marks: a thickness-wide bar length pixels long, centered on each point, running across it (orient "horizontal") or along it ("vertical"). A barcode plot draws one at each value.

Configuration

import {Tick} from "@d3plus/core";

Extends Rect → Shape → BaseClass.

activefunction | null

The active callback function for highlighting shapes.

activeOpacitynumberDefault 0.25

Opacity applied to non-active data points (default ~0.25).

activeStylerecord

The style to apply to active shapes.

ariaLabelconstoraccessor

ARIA label per datum (accessibility).

backgroundImageconstoraccessor

An image drawn inside each shape: a URL (or data: URI), or an accessor returning one per datum (a falsy value draws none). Every chart's filled data shapes support it; stroked marks like lines and links, and Gauge needles, don't. Set it for all shapes in shapeConfig, or for one shape kind under its name (like shapeConfig.Rect.backgroundImage). The image is clipped to the shape's outline, sized by backgroundImageFit, and drawn over the shape's fill and under its label.

backgroundImageFitconstoraccessor

How a backgroundImage fits its shape: "cover" (default) fills the shape's bounding box, cropping the overflow and clipping to the outline; "contain" fits the whole image, centered and fully visible, inside the shape's largest inscribed rectangle.

classNamestring | array.<string> | undefined

CSS classes added to the outermost element this chart or component draws into, next to its fixed d3plus classes, so page CSS can target it: a chart's root <svg class="d3plus-viz"> (its <canvas> with the Canvas renderer) and a standalone component's <svg>. Takes a space-separated string or an array. A new value replaces the classes the previous one added; unset adds none. Tooltips take their own tooltipConfig.className.

colorDefaultscolordefaultsconfig

Overrides the default colors used when assigning fills from data and choosing legible text colors: dark and light (the text colors picked for contrast against a background), missing (null/undefined values), on/off (true/false values), sequential (the anchor hue for magnitude ramps), and scale (the categorical palette, given as a d3 ordinal scale or an array of colors). Keys are merged into the current defaults, and a Viz passes its overrides down to the shapes and components it draws.

configpartial

Narrowed .config() for Tick.

dataarray.&lt;datapoint&gt;

The data array used to create shapes. A shape will be drawn for each object in the array.

discrete"x" | "y"

Discrete-axis key ("x" | "y") for charts that flip layout per axis.

durationnumberDefault 600

Animation duration in ms.

fillcsscolor | function

Fill color or accessor returning one.

fillOpacityconstoraccessor

Fill opacity (0..1).

heightconstoraccessor
hitArearecord | false | function

An invisible hover and click target drawn behind each mark: bounds (x, y, width, height, relative to the mark's position), or a function returning them per datum. A Line takes a wide transparent stroke along its path. Side-by-side bars in a Plot (a BarChart that isn't stacked, or a Histogram) fill their whole slot by default, from one edge of the plot to the other, so a short bar is as easy to hover as a tall one; shapeConfig: {Bar: {hitArea: false}} limits them to the bars themselves.

hoverfunction | null

The hover callback function for highlighting shapes on mouseover.

hoverOpacitynumberDefault 0.5

Opacity applied to non-hovered data points.

hoverStylerecord

The style to apply to hovered shapes.

idaccessorfn

Unique-id accessor per datum (used for keyed enter/update/exit).

labelconstoraccessor

Label text(s) per datum. False/undefined skips.

labelBoundsrecord | function

Label-bounds accessor (where to mount the label).

labelConfigrecord

A pass-through to the config method of the TextBox class used to create a shape's labels.

lengthconstoraccessor

The tick's length in pixels (default 20; a Plot sizes it to its band).

localestring | object

The locale used for all text and number formatting. Supports the locales defined in d3plus-format. The locale can be a complex Object, a locale code (like "en-US"), or a 2-digit language code (like "en"). If a 2-digit code is provided, the "findLocale" function is used to identify the most approximate locale.

onstring

Event listener for the specified event typenames. Mirrors the core d3-selection behavior.

opacityconstoraccessor

Overall opacity (0..1).

orientconstoraccessor

"horizontal" (default) runs the tick along x, "vertical" along y.

parentunknown

Parent config used by the wrapper.

pointerEventsconstoraccessor

SVG pointer-events attribute per datum.

roleconstoraccessor

ARIA role per datum (accessibility).

rotateconstoraccessor

Rotation in degrees per datum.

rxconstoraccessor

SVG rx (rect rounded-corner x) — applies to Rect/Bar.

ryconstoraccessor

SVG ry (rect rounded-corner y) — applies to Rect/Bar.

scaleconstoraccessor

Scale factor (1 = identity).

selectstring | htmlelement | svgelement | null

The SVG container element as a d3 selector or DOM element.

shapeConfigd3plusconfig

Configuration object with key/value pairs applied as method calls on each shape.

shapeRenderingconstoraccessor

SVG shape-rendering attribute per datum.

sortfunction | null

A comparator function used to sort shapes for layering order.

strokecsscolor | function

Stroke color.

strokeDasharrayconstoraccessor

SVG stroke-dasharray.

strokeLinecapconstoraccessor

SVG stroke-linecap.

strokeOpacityconstoraccessor

SVG stroke-opacity.

strokeWidthconstoraccessor

Stroke width in pixels.

textAnchorconstoraccessor

SVG text-anchor for labels.

textureconstoraccessor

Texture (per textures.js) — name string or full config.

textureDefaultrecord

A series of global texture methods to be used for all textures (ie. {stroke: "darkorange", strokeWidth: 2}).

thicknessconstoraccessor

The tick's thickness in pixels (default 2).

trailbooleanDefault false

Sweep a tapering motion trail behind the rect as it moves between frames.

trailPersistnumber | booleanDefault 0

Steps of trail history to keep (number), or true for a long fading tail.

translatefunction

Defines how informational text strings should be displayed. By default, this function will try to find the string in question (which is the first argument provided to this function) inside of an internally managed translation Object. A string with numbered placeholders ("{0} hidden") has them filled from the arguments after the locale, so each language can order its words naturally. If you'd like to override to use custom text, simply pass this method your own custom formatting function.

vectorEffectconstoraccessor

SVG vector-effect (e.g. "non-scaling-stroke").

verticalAlignconstoraccessor

Label vertical-align ("top"/"middle"/"bottom").

widthconstoraccessor
xconstoraccessor

X position.

yconstoraccessor

Y position.