addTraceForBarTypeDataLabelAnnotations | R Documentation |
This function adds traces for data labels and annotations to bar/column charts Because these type of charts show bars that up space surrounding the position of the data point, it is necessary to be more careful about the offset of the data labels (from the data point). Also, circle annotations can be added to the plot. These are added as separate traces to allow for more flexible positioning
addTraceForBarTypeDataLabelAnnotations(
p,
type,
name,
data.label.xpos,
data.label.ypos,
data.label.show,
data.label.text,
data.label.sign,
data.label.nchar,
annotation.list,
annot.data,
i,
xaxis,
yaxis,
data.label.font,
is.stacked,
data.label.centered,
data.label.horizontal.align = "center",
stackgroupname = "datalabel"
)
p |
the plotly plot object to which the trace is added |
type |
the type of the chart (i.e. Bar or Column) |
name |
the name to be given to the data label trace. This is visible in the hover text |
data.label.xpos |
The position of the data label trace on the xaxis.
This is usually a component of the output from |
data.label.ypos |
The position of the data label trace on the yaxis.
This is usually a component of the output from |
data.label.show |
A logical vector of the same length as data.label.xpos indicating whether a data label will be shown at each point. |
data.label.text |
A text vector of the same length as data.label.xpos containing the text to show on the data label. |
data.label.sign |
The sign indicating whether the data point is positive or negative. |
data.label.nchar |
The maximum number of characters in the data labels. This is used to position the circle annotations. |
annotation.list |
A list of annotations as given to the charting function. |
annot.data |
The data (usually a 3d array) used create the annotations. |
i |
The index of the data series. Used to control legend.group |
xaxis |
The name of the xaxis |
yaxis |
The neme of the yaxis |
data.label.font |
A list specifying the font to use. |
is.stacked |
A logical indicating if the chart is stackeed. |
data.label.centered |
A logical indicating if data label is placed at the center of bar. Only used in Stacked Column charts. |
data.label.horizontal.align |
Text to control the horizontal alignment of labels on the column chart annotations |
stackgroupname |
For stacked charts, the current trace will be added on top of the previous trace with the same stackgroupname |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.