JavaScript Figure Reference: bar Traces

A bar trace is an object with the key "type" equal to "bar" (i.e. {"type": "bar"}) and any of the keys listed below.

The data visualized by the span of the bars is set in `y` if `orientation` is set to "v" (the default) and the labels are set in `x`. By setting `orientation` to "h", the roles are interchanged.

  • type
    Parent: data[type=bar]
    Type: "bar"
  • name
    Parent: data[type=bar]
    Type: string

    Sets the trace name. The trace name appears as the legend item and on hover.

  • visible
    Parent: data[type=bar]
    Type: enumerated , one of ( true | false | "legendonly" )
    Default: true

    Determines whether or not this trace is visible. If "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).

  • showlegend
    Parent: data[type=bar]
    Type: boolean
    Default: true

    Determines whether or not an item corresponding to this trace is shown in the legend.

  • legend
    Parent: data[type=bar]
    Type: subplotid
    Default: legend

    Sets the reference to a legend to show this trace in. References to these legends are "legend", "legend2", "legend3", etc. Settings for these legends are set in the layout, under `layout.legend`, `layout.legend2`, etc.

  • legendrank
    Parent: data[type=bar]
    Type: number
    Default: 1000

    Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with "reversed" `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items. When having unranked or equal rank items shapes would be displayed after traces i.e. according to their order in data and layout.

  • legendgroup
    Parent: data[type=bar]
    Type: string
    Default: ""

    Sets the legend group for this trace. Traces and shapes part of the same legend group hide/show at the same time when toggling legend items.

  • legendgrouptitle
    Parent: data[type=bar]
    Type: object containing one or more of the keys listed below.
    • font
      Parent: data[type=bar].legendgrouptitle
      Type: object containing one or more of the keys listed below.