Skip to content

ohlc attributes ​

OHLC bars: the open, high, low and close of each period as a low–high line with an open tick on the left and a close tick on the right, green when the price rose and red when it fell, drawn as batched GPU line segments.

  • Categories: cartesian, showLegend
  • Plotly equivalent: ohlc
  • Guide: ohlc chart page
  • Used in examples: demos/index-funds/ohlc-monthly, demos/tqqq-soxl/intraday, ohlc/basic, ohlc/indicators, ohlc/monthly, ohlc/range-breaks, ohlc/styled

Generated from the attribute schema (66 entries). Machine-readable: plot-schema.json.

Attribute tree

type string ​

Trace type, e.g. 'scatter'. Defaults to 'scatter'.

  • Type: string (non-empty)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

visible enumerated ​

Whether the trace is drawn. legendonly hides it but keeps its (toggleable) legend entry.

  • Type: enumerated
  • Values: true | false | "legendonly"
  • Default: true
  • Array OK: no
  • Edit type: calc
  • Animatable: no

name string ​

Trace name shown in the legend and hover labels. Defaults to trace N.

  • Type: string
  • Default: none
  • Array OK: no
  • Edit type: legend+plot
  • Animatable: no

uid string ​

Stable identity used to match traces across updates, so reordered traces are moved instead of rebuilt.

  • Type: string
  • Default: none
  • Array OK: no
  • Edit type: plot
  • Animatable: no

showlegend boolean ​

Whether this trace has a legend entry.

  • Type: boolean
  • Default: true
  • Array OK: no
  • Edit type: legend+layout
  • Animatable: no

legend subplotid ​

The legend this trace's item is shown in: 'legend' (layout.legend), 'legend2' (layout.legend2), ….

  • Type: subplotid (legend, legend2, legend3, …)
  • Default: "legend"
  • Array OK: no
  • Edit type: legend+layout
  • Animatable: no

legendgroup string ​

Traces in the same legend group toggle together.

  • Type: string
  • Default: ""
  • Array OK: no
  • Edit type: legend
  • Animatable: no

hovertext string ​

Hover text per point; defaults to text.

  • Type: string
  • Default: ""
  • Array OK: yes (one value per point)
  • Edit type: style
  • Animatable: no

hoverinfo flaglist ​

Which fields hover labels show; 'skip' also turns hover events off for this trace. Default 'all'.

  • Type: flaglist
  • Flags: "x", "y", "z", "text", "name" (combine with +)
  • Also accepts: "all" | "none" | "skip"
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hovertemplate string ​

Template for hover labels, e.g. '%{x}: %{y:.2f}<extra></extra>' (d3-format / d3-time-format after : / |). Overrides hoverinfo.

  • Type: string
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel ​

Hover label style for this trace. Unset fields fall back to layout.hoverlabel (so there are no trace-level defaults).

  • Type: object
  • Edit type: none

hoverlabel.bgcolor color ​

Label background. Default: the point color.

  • Type: color
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.bordercolor color ​

Label border. Default: contrasting with the background.

  • Type: color
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.font ​

Label font.

  • Type: object
  • Edit type: none

hoverlabel.font.family string ​

Font family.

  • Type: string
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.font.size number ​

Font size in px.

  • Type: number ≥ 1
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.font.color color ​

Font color.

  • Type: color
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.align enumerated ​

Text alignment inside labels.

  • Type: enumerated
  • Values: "left" | "right" | "auto"
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.namelength integer ​

Characters of the trace name shown (-1: all, 0: none).

  • Type: integer ≥ -1
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: none
  • Animatable: no

hoverlabel.split boolean ​

Show the open, high, low and close in separate labels, each at its price, instead of one label. hovertemplate is then ignored.

  • Type: boolean
  • Default: false
  • Array OK: no
  • Edit type: style
  • Animatable: no

selectedpoints any ​

Indices of the selected points (set by box/lasso selection, or programmatically). null clears the selection.

  • Type: any
  • Default: none
  • Array OK: no
  • Edit type: style
  • Animatable: no

legendrank number ​

Sort key for legend entries: lower ranks come first (top, or left). Ties keep trace order; traces default to 1000.

  • Type: number
  • Default: 1000
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendwidth number ​

Width of this trace's item in horizontal legends, overriding legend.entrywidth (same units). Default: its text's.

  • Type: number ≥ 0
  • Default: none
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendgrouptitle ​

Title of the legend group this trace belongs to.

  • Type: object
  • Edit type: legend

legendgrouptitle.text string ​

Title heading this trace's legend group.

  • Type: string
  • Default: ""
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendgrouptitle.font ​

Group title font. Unset fields come from legend.grouptitlefont.

  • Type: object
  • Edit type: legend

legendgrouptitle.font.family string ​

Font family.

  • Type: string
  • Default: none
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendgrouptitle.font.size number ​

Font size in px.

  • Type: number ≥ 1
  • Default: none
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendgrouptitle.font.color color ​

Font color.

  • Type: color
  • Default: none
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendgrouptitle.font.weight integer ​

Font weight: a CSS numeric weight (1–1000), normal or bold.

  • Type: integer from 1 to 1000, or "normal" | "bold"
  • Default: none
  • Array OK: no
  • Edit type: legend
  • Animatable: no

legendgrouptitle.font.style enumerated ​

Font style.

  • Type: enumerated
  • Values: "normal" | "italic"
  • Default: none
  • Array OK: no
  • Edit type: legend
  • Animatable: no

opacity number ​

Opacity of the whole trace.

  • Type: number from 0 to 1
  • Default: 1
  • Array OK: no
  • Edit type: style
  • Animatable: yes

meta any ​

Arbitrary user data, available in text templates as %{meta}.

  • Type: any
  • Default: none
  • Array OK: yes (one value per point)
  • Edit type: plot
  • Animatable: no

customdata data_array ​

Per-point user data, returned in events and available in hover templates.

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

ids data_array ​

Per-point ids used to match points across animation frames.

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

dataset string ​

Name of a figure-level dataset (figure.datasets). Data arrays, and per-point attributes whose values cannot start with @ (such as colors and sizes), may then reference its columns as '@column'; on string attributes such as text, '@…' stays literal text.

  • Type: string (non-empty)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

uirevision any ​

While unchanged, user interaction state for this trace (legend visibility, selections) is kept across updates.

  • Type: any
  • Default: none
  • Array OK: no
  • Edit type: none
  • Animatable: no

styleRules any ​

Conditional per-point styling as JSON (plan E8.5): [{ when: { y: { gt: 10 } }, set: { 'marker.color': 'gold' } }]. when tests fields of the point ('y', 'customdata[1]', 'pointNumber', …) with eq, ne, gt, gte, lt, lte, in, nin, between, regex, and, or and not; set gives per-point (arrayOk) attributes a value on the matching points. Later rules win; other points keep the trace's own value.

  • Type: any
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

xaxis subplotid ​

The x axis this trace is plotted against: 'x' → layout.xaxis, 'x2' → layout.xaxis2.

  • Type: subplotid (x, x2, x3, …)
  • Default: "x"
  • Array OK: no
  • Edit type: calc
  • Animatable: no

yaxis subplotid ​

The y axis this trace is plotted against: 'y' → layout.yaxis, 'y2' → layout.yaxis2.

  • Type: subplotid (y, y2, y3, …)
  • Default: "y"
  • Array OK: no
  • Edit type: calc
  • Animatable: no

x data_array ​

x coordinate of each bar (usually dates). Default: 0, 1, 2, …

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

open data_array ​

The open price of each period, in y-axis data units.

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

high data_array ​

The high price of each period, in y-axis data units.

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

low data_array ​

The low price of each period, in y-axis data units.

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

close data_array ​

The close price of each period, in y-axis data units.

  • Type: data_array (array or typed array)
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

xperiod any ​

Only 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.

  • Type: any
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

xperiod0 any ​

A period boundary for xperiod. Default: 2000-01-01 on date axes (a Sunday for weekly periods), 0 otherwise.

  • Type: any
  • Default: none
  • Array OK: no
  • Edit type: calc
  • Animatable: no

xperiodalignment enumerated ​

Where points sit within their xperiod.

  • Type: enumerated
  • Values: "start" | "middle" | "end"
  • Default: "middle"
  • Array OK: no
  • Edit type: calc
  • Animatable: no

xhoverformat string ​

d3 number or date format of x values in hover labels. Default: the axis format.

  • Type: string
  • Default: ""
  • Array OK: no
  • Edit type: none
  • Animatable: no

yhoverformat string ​

d3 number or date format of the prices in hover labels. Default: the y axis format.

  • Type: string
  • Default: ""
  • Array OK: no
  • Edit type: none
  • Animatable: no

text string ​

Hover text: one string for every bar, or one per bar. hovertext wins.

  • Type: string
  • Default: ""
  • Array OK: yes (one value per point)
  • Edit type: calc
  • Animatable: no

zorder integer ​

Stacking order among the traces of a subplot: higher is drawn on top. At equal zorder, financial traces draw above bars and boxes and below scatter traces (Plotly’s layer order), then in trace order.

  • Type: integer
  • Default: 0
  • Array OK: no
  • Edit type: plot
  • Animatable: no

line ​

Line style of every bar.

  • Type: object
  • Edit type: style

line.width number ​

Line width in CSS px of every bar. increasing.line.width and decreasing.line.width override it per direction.

  • Type: number ≥ 0
  • Default: 2
  • Array OK: no
  • Edit type: style
  • Animatable: no

line.dash string ​

Dash style of every bar: 'solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot', or a dash list such as '5px,10px,2px'. increasing.line.dash and decreasing.line.dash override it per direction.

  • Type: string
  • Default: "solid"
  • Array OK: no
  • Edit type: style
  • Animatable: no

increasing ​

Style of rising bars: bars whose close is above their open (an unchanged bar compares its close with the previous close).

  • Type: object
  • Edit type: style

increasing.line ​

Line style of rising bars.

  • Type: object
  • Edit type: style

increasing.line.color color ​

Line color of rising bars.

  • Type: color
  • Default: "#3D9970"
  • Array OK: no
  • Edit type: style
  • Animatable: no

increasing.line.width number ​

Line width in CSS px of rising bars. Default: line.width.

  • Type: number ≥ 0
  • Default: none
  • Array OK: no
  • Edit type: style
  • Animatable: no

increasing.line.dash string ​

Dash style of rising bars (see line.dash). Default: line.dash.

  • Type: string
  • Default: none
  • Array OK: no
  • Edit type: style
  • Animatable: no

decreasing ​

Style of falling bars: bars whose close is below their open (an unchanged bar compares its close with the previous close).

  • Type: object
  • Edit type: style

decreasing.line ​

Line style of falling bars.

  • Type: object
  • Edit type: style

decreasing.line.color color ​

Line color of falling bars.

  • Type: color
  • Default: "#FF4136"
  • Array OK: no
  • Edit type: style
  • Animatable: no

decreasing.line.width number ​

Line width in CSS px of falling bars. Default: line.width.

  • Type: number ≥ 0
  • Default: none
  • Array OK: no
  • Edit type: style
  • Animatable: no

decreasing.line.dash string ​

Dash style of falling bars (see line.dash). Default: line.dash.

  • Type: string
  • Default: none
  • Array OK: no
  • Edit type: style
  • Animatable: no

tickwidth number ​

Length of the open (left) and close (right) ticks, as a fraction of the smallest x spacing between bars of the ohlc traces of the subplot.

  • Type: number from 0 to 0.5
  • Default: 0.3
  • Array OK: no
  • Edit type: calc
  • Animatable: no

Released under the MIT License.