Skip to content

Type Alias: BaseBarTrace ​

ts
type BaseBarTrace = CommonTraceAttributes & CartesianTraceAttributes & object;

Bar: rectangles from a base to a value, vertical or horizontal.

Type Declaration ​

NameTypeDescription
alignmentgroup?stringTraces on the same position axis with the same alignment group split each position between their offset groups; different alignment groups lay out independently.
base?unknownWhere bars start on the length axis (default 0), one value or one per bar, in that axis' data units. On a date axis the base is a date (a date string, a Date or ms since the epoch) and the lengths are durations in ms, so a bar spans base to base + length (Gantt charts); hover then reports the end, base + length. Set the axis type: 'date' explicitly: numeric lengths alone make it linear. On log axes, bars without a positive base start below the visible range.
cliponaxis?booleanClip labels to the plot area. false is not drawn yet: labels are always clipped to the subplot.
constraintext?"inside" | "outside" | "both" | "none"Shrink labels (inside, outside, or both) so they are no larger than their bar.
dx?numberStep between implicit x coordinates (see x0).
dy?numberStep between implicit y coordinates (see y0).
error_x?BarTraceErrorXError bars along the x axis.
error_y?BarTraceErrorYError bars along the y axis.
insidetextanchor?"end" | "middle" | "start"Where inside labels sit along the bar.
insidetextfont?BarTraceInsidetextfontFont of labels inside bars. Defaults to textfont, with a color contrasting the bar fill.
marker?BarTraceMarkerBar style.
offset?PerPointNumberShift of the bar's leading edge from its position, in position-axis units, one value or one per bar. Default: centered in its (group) slot.
offsetgroup?stringTraces with the same offset group share one slot in group mode (and stack together in stack/relative modes); bars at the same position line up, also across subplots on the same position axis.
orientation?"v" | "h"'v': vertical bars at x positions with y lengths; 'h': horizontal bars at y positions with x lengths. Defaults to 'h' when only x is given.
outsidetextfont?BarTraceOutsidetextfontFont of labels outside bars. Defaults to textfont.
selected?BarTraceSelectedStyle of selected bars while a selection is active.
text?PerPoint<string | number>Text per bar, drawn per textposition and shown in hover labels.
textangle?number | "auto"Label rotation in degrees, clockwise. 'auto' turns inside labels 90° when that fits the bar better.
textfont?BarTraceTextfontFont of bar labels. Defaults to layout.font.
textposition?PerPoint<"inside" | "outside" | "auto" | "none">Where bar labels go: inside (against the bar end, see insidetextanchor), outside (past the bar end; inner bars of a stack stay inside), auto (inside when it fits, else outside), none.
texttemplate?PerPoint<string | number>Template for bar labels, overriding text: %{value} (bar length), %{label} (position), %{x}, %{y}, %{text}, %{customdata}, %{meta}, with optional d3 formats (%{value:.1f}) or date formats (`%{x
type"bar"Trace type.
unselected?BarTraceUnselectedStyle of unselected bars while a selection is active.
width?PerPointNumberBar width in position-axis units (category slots, or ms on date axes: 86400000 is one day), one value or one per bar. Default: the slot left by layout.bargap and the bar mode. Minimum: 0
x?DataColumnx coordinates: bar positions for vertical bars, bar lengths otherwise. Numbers, dates or category names depending on the axis type.
x0?unknownStarting x coordinate when x is not given: bar i is at x0 + i·dx.
xperiod?unknownOnly on date or linear x axes: snap each x value to its period of this length (ms, or 'M<n>' months on date axes), positioned per xperiodalignment.
xperiod0?unknownA period boundary for xperiod. Default: 2000-01-01 on date axes (a Sunday for weekly periods), 0 otherwise.
xperiodalignment?"start" | "middle" | "end"Where points sit within their xperiod.
y?DataColumny coordinates: bar positions for horizontal bars, bar lengths otherwise. Numbers, dates or category names depending on the axis type.
y0?unknownStarting y coordinate when y is not given: bar i is at y0 + i·dy.
yperiod?unknownOnly on date or linear y axes: snap each y value to its period of this length (ms, or 'M<n>' months on date axes), positioned per yperiodalignment.
yperiod0?unknownA period boundary for yperiod. Default: 2000-01-01 on date axes (a Sunday for weekly periods), 0 otherwise.
yperiodalignment?"start" | "middle" | "end"Where points sit within their yperiod.
zorder?numberStacking order among the traces of a subplot: higher is drawn on top. At equal zorder, bars draw below scatter traces (Plotly’s layer order), then in trace order.

Released under the MIT License.