SetYDataLabelPos
Prev | PHPlot Function Reference | Next

## SetYDataLabelPos

SetYDataLabelPos — Position and control Y data labels

## Synopsis

    $plot->SetYDataLabelPos($ydlp)

## Description

`SetYDataLabelPos` determines if and where Y data labels are drawn. Currently, Y data labels are only implemented for 'bars' and 'stackedbars' plot types. For bar charts, the Y data label shows the Y value above each bar. For stacked bar charts, there are two types of data labels. Bar total labels indicate the total Y value for a bar stack, and are drawn above the bar. Bar segment labels indicate the incremental value of each segment within the bar, and are drawn inside the segment below the top. Y data labels are shown in Example 5.19, “Bar Chart with Data Labels” and Example 5.20, “Stacked Bars with Y Data Labels”.

## Parameters

`$ydlp`

  A string indicating the desired position for the Y data labels:

  Position | Description
  --- | ---
  plotin | Data labels above each bar. For stacked bar charts, this means only the bar total labels and not the bar segment labels.
  plotstack | Data labels above each bar and below the top of each segment. This is valid only for stacked bar charts, and turns on both bar total labels and bar segment labels.
  none | No data labels

## Notes

These labels are only available for plot type 'bars' and 'stackedbars'. The default is not to draw Y data labels. Y data labels work best when the values are short enough to fit.

The bar segment labels, if enabled, are drawn inside the bars and may not be very visible if dark colors are used for the bar fill. Bar segment labels will be omitted for segments which are too short.

Y data labels will be drawn below the bars for negative values. This only applies to bar charts. Stacked bar charts are not allowed to have negative values.

The Y data label text angle is set with SetYDataLabelAngle. The Y data label text format can be controlled with SetYDataLabelType or SetYLabelType.

## History

The Y data label feature for stacked bar graphs was added in PHPlot-5.1.1.

The Y data label feature for bar graphs was added to PHPlot-5.0rc3.

Prev | Up | Next
SetYDataLabelAngle | Home | SetYDataLabelType