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|nullThe active callback function for highlighting shapes.
activeOpacitynumberDefault0.25Opacity applied to non-active data points (default ~0.25).
activeStylerecordThe style to apply to active shapes.
ariaLabelconstoraccessorARIA label per datum (accessibility).
backgroundImageconstoraccessorAn 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 inshapeConfig, or for one shape kind under its name (likeshapeConfig.Rect.backgroundImage). The image is clipped to the shape's outline, sized bybackgroundImageFit, and drawn over the shape's fill and under its label.backgroundImageFitconstoraccessorHow a
backgroundImagefits 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>|undefinedCSS 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 owntooltipConfig.className.colorDefaultscolordefaultsconfigOverrides the default colors used when assigning fills from data and choosing legible text colors:
darkandlight(the text colors picked for contrast against a background),missing(null/undefined values),on/off(true/falsevalues),sequential(the anchor hue for magnitude ramps), andscale(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.configpartialNarrowed
.config()for Tick.dataarray.<datapoint>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.
durationnumberDefault600Animation duration in ms.
fillcsscolor|functionFill color or accessor returning one.
fillOpacityconstoraccessorFill opacity (0..1).
heightconstoraccessorhitArearecord|false|functionAn 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|nullThe hover callback function for highlighting shapes on mouseover.
hoverOpacitynumberDefault0.5Opacity applied to non-hovered data points.
hoverStylerecordThe style to apply to hovered shapes.
idaccessorfnUnique-id accessor per datum (used for keyed enter/update/exit).
labelconstoraccessorLabel text(s) per datum. False/undefined skips.
labelBoundsrecord|functionLabel-bounds accessor (where to mount the label).
labelConfigrecordA pass-through to the config method of the TextBox class used to create a shape's labels.
lengthconstoraccessorThe tick's length in pixels (default
20; a Plot sizes it to its band).localestring|objectThe 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.
onstringEvent listener for the specified event typenames. Mirrors the core d3-selection behavior.
opacityconstoraccessorOverall opacity (0..1).
orientconstoraccessor"horizontal"(default) runs the tick along x,"vertical"along y.parentunknownParent config used by the wrapper.
pointerEventsconstoraccessorSVG
pointer-eventsattribute per datum.roleconstoraccessorARIA role per datum (accessibility).
rotateconstoraccessorRotation in degrees per datum.
rxconstoraccessorSVG
rx(rect rounded-corner x) — applies to Rect/Bar.ryconstoraccessorSVG
ry(rect rounded-corner y) — applies to Rect/Bar.scaleconstoraccessorScale factor (1 = identity).
selectstring|htmlelement|svgelement|nullThe SVG container element as a d3 selector or DOM element.
shapeConfigd3plusconfigConfiguration object with key/value pairs applied as method calls on each shape.
shapeRenderingconstoraccessorSVG
shape-renderingattribute per datum.sortfunction|nullA comparator function used to sort shapes for layering order.
strokecsscolor|functionStroke color.
strokeDasharrayconstoraccessorSVG
stroke-dasharray.strokeLinecapconstoraccessorSVG
stroke-linecap.strokeOpacityconstoraccessorSVG
stroke-opacity.strokeWidthconstoraccessorStroke width in pixels.
textAnchorconstoraccessorSVG
text-anchorfor labels.textureconstoraccessorTexture (per textures.js) — name string or full config.
textureDefaultrecordA series of global texture methods to be used for all textures (ie.
{stroke: "darkorange", strokeWidth: 2}).thicknessconstoraccessorThe tick's thickness in pixels (default
2).trailbooleanDefaultfalseSweep a tapering motion trail behind the rect as it moves between frames.
trailPersistnumber|booleanDefault0Steps of trail history to keep (number), or
truefor a long fading tail.translatefunctionDefines 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.vectorEffectconstoraccessorSVG
vector-effect(e.g. "non-scaling-stroke").verticalAlignconstoraccessorLabel vertical-align ("top"/"middle"/"bottom").
widthconstoraccessorxconstoraccessorX position.
yconstoraccessorY position.