2.2.3.11 Data Label
A data label is a label on a chart (section 2.2.3.3) that is associated with a data point (section 2.2.3.10), or associated with a series (section 2.2.3.9) on an area or filled radar chart group (section 2.2.3.7). A data label contains information about the associated data point, such as the description of the data point, a legend key, or custom text.
Inheritance
For any given data point, there is an order of inheritance that determines the contents of a data label associated with the data point:
Data labels can be specified for a chart group, specifying the default setting for the data labels associated with the data points on the chart group.
Data labels can be specified for a series, specifying the default setting for the data labels associated with the data points of the series. This type of data label overrides the data label properties specified on the chart group for the data labels associated with the data points in a given series.
Data labels can be specified for a data point, specifying the settings for a data label associated with a particular data point. This type of data label overrides the data label properties specified on the chart group and series for the data labels associated with a given data point.
Records
The set of records that specifies a data label, and the requirements that exist on these records, differ if the data label is specified for a chart group, series, or data point. The set of records that represent a data label are as follows:
For a chart group, properties of a data label are specified by the following collections of records that are specified in the chart group:
The sequence of records that conforms to the DFTTEXT rule (section 2.1.7.20.1).
The DataLabExtContents record (section 2.4.76) that is not contained in the sequence of records that conforms to the LD rule (section 2.1.7.20.1) or the sequence of records that conforms to the DFTTEXT rule.
The AttachedLabel record (section 2.4.5) that is contained in the sequence of records that conforms to the SS rule (section 2.1.7.20.1).
For a series or data point, properties of a data label are specified by the following collections of records that are specified in the chart:
The attached label (section 2.2.3.15) that corresponds to the series or data point. The attached label that corresponds to a series or data point appears in the chart sheet substream (section 2.1.7.20.1) after the axis group (section 2.2.3.5) and is specified by the following properties of the attached label:
The wLinkObj field of the ObjectLink record (section 2.4.182) equals 0x0004.
The wLinkVar1 field of the ObjectLink record equals the index to the corresponding series.
The wLinkVar2 field of the ObjectLink record equals the index to the corresponding data point or equals 0xFFFF for a corresponding series.
The AttachedLabel record (section 2.4.5) that corresponds to the series or data point. The AttachedLabel record that corresponds to a series or data point appears in the sequence of records that conforms to the SS rule that has the following properties:
The yi field of the DataFormat record (section 2.4.74) equals the index to the corresponding series.
The xi field of the DataFormat record equals the index to the corresponding data point or equals 0xFFFF for a corresponding series.
Overrides
Some properties of the records that specify the contents of a data label can overlap and conflict. For the information that overlaps between these records, there is a set of rules that specifies the relationships between these records and specifies the fields that need to be ignored in conflict situations.
In general, properties of the DataLabExtContents record (section 2.4.76) of the data label override properties of the Text record (section 2.4.324) of the of the data label, which overrides the properties of the AttachedLabel record of the data label. Details of the relationships between individual fields are specified in the records.
The following section provides an explanation of how to interpret the data label and when the different records that specify the data label are relevant to the data label.
On a data label associated with a chart group:
When the chart group has a data label, the following algorithm determines the data label contents. Once the set of records that represents the data label has been established, the data label information that overlaps across records is respected on the DataLabExtContents record and ignored on the Text and AttachedLabel records of the data label. In this algorithm, ABNF rules are used to specify the sequence of records that conform to the rule. In this algorithm, "DFTTEXT with id" specifies the sequence of records that conforms to the DFTTEXT rule that contains a DefaultText record (section 2.4.88) with and id field equal to the value specified.
//Define variables X equals a DataLabExtContents record Y equals a DataLabExtContents record SS equals an to AttachedLabel record SWAP equals a boolean //Initialize SWAP SET SWAP equal to FALSE //Initialize SS SET SS equal to AttachedLabel record in the sequence of records that conforms to the SS rule //Initialize X IF DFTTEXT with id field equal to 0 exists IF DFTTEXT with id field equals to 0 has a DataLabExtContents record SET X equal to DataLabExtContents record in DFTTEXT with id field equal to 0 ELSE IF chart group type equals area or filled radar SET field fSerName of X equal to field fShowLabel of Text record in DFTTEXT with id field equal to 0 SET field fCatName of X equal to 0 ELSE SET field fCatName of X equal to field fShowLabel of Text record in DFTTEXT with id field equal to 0 SET field fSerName of X equal to 0 END IF SET field fValue of X equal to field fShowValue of Text record in DFTTEXT with id field equal to 0 SET field fPercent of X equal to field (fShowPercent OR fShowLabelAndPerc) of Text record in DFTTEXT with id field equal to 0 SET field fBubSizes of X equal to field fShowBubbleSizes of Text record in DFTTEXT with id field equal to 0 SET field RgchSet of X equal to NULL END IF ELSE SET field fCatName of X equal 1 SET fields fSerName, fValue, fPercent, fBubSizes of X equal to 0 SET field RgchSet of X equal to NULL END IF //Initialize Y IF DFTTEXT with id field equal to 1 exists IF DFTTEXT with id field equals to 1 has a DataLabExtContents record SET Y equal to DataLabExtContents record in DFTTEXT with id field equal to 1 ELSE IF chart group type equals area or filled radar SET field fSerName of Y equal to field (fShowLabel OR fShowLabelAndPerc)of Text record in DFTTEXT with id field equal to 1 SET field fCatName of Y equal to 0 ELSE SET field fCatName of Y equal to field (fShowLabel OR fShowLabelAndPerc) of Text record in DFTTEXT with id field equal to 1 SET field fSerName of Y equal to 0 END IF SET field fValue of Y equal to field fShowValue of Text record in DFTTEXT with id field equal to 1 SET field fPercent of Y equal to field (fShowPercent OR fShowLabelAndPerc) of Text record in DFTTEXT with id field equal to 1 SET field fBubSizes of Y equal to field fShowBubbleSizes of Text record in DFTTEXT with id field equal to 1 SET field RgchSet of X equal to NULL END IF ELSE SET field fValue of Y equal to 1 SET fields fCatName, fSerName, fPercent, fBubSizes of Y equal to 0 SET field RgchSet of X equal to NULL END IF //Modify X, Y, and SS IF (field fCatName of X equals 1) AND (fields fSerName, fValue, fPercent, AND fBubSizes of X equal 0) IF (field fShowValue of SS equals 1) AND (fields fShowPercent, fShowLabelAndPerc, fShowLabel, fShowBubbleSizes, AND fShowSeriesName of SS equal 0) IF (field fValue of Y equals 1) AND (fields fSerName, fCatName, fPercent, OR fBubSizes of Y equal 1) SET SWAP equals to TRUE SET field fValue of X equal to 1 SET fields fSerName, fCatName, fPercent, AND fBubSizes of X equal to 0 SET field fShowValue of SS equal to field fValue of Y SET field fShowPercent of SS equal to field fSPercent of Y SET field fShowLabel of SS equal to field fCatName of Y SET field fShowBubbleSizes of SS equal to field fBubSizes of Y SET field fShowSeriesName of SS equal to field fSerName of Y END IF ELSE IF ((field fShowPercent of SS equals 1) AND (field fShowBubbleSizes of SS equals 0)) OR ((field fShowPercent of SS equals 0) AND (field fShowBubbleSizes of SS equals 1)) AND (fields fShowLabelAndPerc, fShowLabel, fShowValue, AND fShowSeriesName of SS equal 0) SET SWAP equals to TRUE SET field fValue of X equal to 1 SET fields fSerName, fCatName, fPercent, AND fBubSizes of X equal to 0 SET field fShowValue of SS equal to field fValue of Y SET field fShowPercent of SS equal to field fSPercent of Y SET field fShowLabel of SS equal to field fCatName of Y SET field fShowBubbleSizes of SS equal to field fBubSizes of Y SET field fShowSeriesName of SS equal to field fSerName of Y ELSE IF (field fShowLabel of SS equals 1) AND (fields fShowPercent, fShowLabelAndPerc, fShowValue, fShowBubbleSizes, AND fShowSeriesName of SS equal 0) IF chart group type equals area or filled radar SET field fSerName of X equal to 1 SET fields fCatName, fValue, fPercent, AND fBubSizes equal to 0 SET field fShowValue of SS to 1 SET fields fShowPercent, fShowLabelAndPerc, fShowLabel, fShowBubbleSize, and fShowSeriesName of SS to 0 END IF SET field fValue of Y equals to 1 SET fields fSerName, fCatName, fPercent, AND fBubSizes of Y equal to 0 ELSE IF fields fShowLabel, fShowPercent, fShowLabelAndPerc, fShowValue, fShowBubbleSizes, AND fShowSeriesName of SS equal 0 IF chart group type equals area or filled radar SET fields fShowLabel of SS to 1 SET fields fShowPercent, fShowLabelAndPerc, fShowValue, fShowBubbleSize, and fShowSeriesName of SS to 0 END IF SET field fValue of Y equals to 1 SET fields fSerName, fCatName, fPercent, AND fBubSizes of Y equal to 0 END IF END IF END IF END IF ELSE IF (field fValue of Y equals 1) AND (fields fSerName, fCatName, fPercent, AND fBubSizes of Y equal 0) IF fields fShowLabel, fShowPercent, fShowLabelAndPerc, fShowValue, fShowBubbleSizes, AND fShowSeriesName of SS equal 0 IF (chart group type equals area or filled radar) AND (field fSerName of X equals 1) AND (fields fCatName, fValue, fPercent, AND fBubSizes of X equal 0) SET field fShowSeriesName of SS to 1 SET fields fShowPercent, fShowLabelAndPerc, fShowValue, fShowBubbleSize, and fShowLabel of SS to 0 ELSE SET field fCatName of X equals to 1 SET fields fSerName, fValue, fPercent, AND fBubSizes of X equal to 0 END IF ELSE IF (field fShowValue of SS equals 1) AND (fields fShowLabel, fShowPercent, fShowLabelAndPerc, fShowBubbleSizes, AND fShowSeriesName of SS equal 0) SET field fCatName of X equals to 1 SET fields fSerName, fValue, fPercent, AND fBubSizes of X equal to 0 ELSE SET field fShowValue of SS equal to field fValue of X SET field fShowPercent of SS equal to field fSPercent of X SET field fShowLabel of SS equal to field fCatName of X SET field fShowBubbleSizes of SS equal to field fBubSizes of X SET field fShowSeriesName of SS equal to field fSerName of X END IF END IF END IF END IF //Determine if X or Y is used IF (field fShowValue of SS equals 1) AND (fields fShowLabel, fShowPercent, fShowLabelAndPerc, fShowBubbleSizes, AND fShowSeriesName of SS equal 0) IF (SWAP equals FALSE) IF DFTTEXT with id field equal to 1 exists SET the data label equal to DFTTEXT with id field equal to 1 ELSE SET the data label equal to the default formatting properties END IF SET the DataLabExtContents record of the data label equal to Y ELSE IF DFTTEXT with id field equal to 0 exists SET the data label equal to DFTTEXT with id field equal to 0 ELSE SET the data label equal to the default formatting properties END IF SET the DataLabExtContents record of the data label equal to X END IF ELSE IF (SWAP equals FALSE) IF DFTTEXT with id field equal to 0 exists SET the data label equal to DFTTEXT with id field equal to 0 ELSE SET the data label equal to the default formatting properties END IF SET the DataLabExtContents record of the data label equal to X ELSE IF DFTTEXT with id field equal to 1 exists SET the data label equal to DFTTEXT with id field equal to 1 ELSE SET the data label equal to the default formatting properties END IF SET the DataLabExtContents record of the data label equal to Y END IF END IF
On a data label associated with a series or data point:
The attached label specifies an exception on the data label and indicates that the current data label differs from the data label inherited from the chart group for a series, or from the chart group and series for a data point. The attached label of the data label contains a Text record and can contain a DataLabExtContents record.
On a data label associated with a data point, when the attached label exists and contains a BRAI record (section 2.4.29) with field formula not equal to 0x0000, the formula field specifies the contents of the data label.
On a data label associated with a data point, when the attached label exists and contains a SeriesText record (section 2.4.254) and a BRAI record with field formula equal to 0x0000, the SeriesText record specifies the contents of the data label.
When the attached label exists and contains a DataLabExtContents record, the data label information specified by the DataLabExtContents record that overlaps across records is respected, and the information contained in the Text and AttachedLabel records of the data label that overlaps is ignored.
When the attached label exists and does not contain a DataLabExtContents record, the data label specified by the Text record that overlaps across records is respected, and the information contained in the AttachedLabel record of the data label that overlaps is ignored.
When the data label does not specify an attached label, the AttachedLabel record of the data label specifies the content properties of the data label.
Restrictions
The following requirements and restrictions exist on different parts of the collections of records that represent the data label.
If the chart group contains a data label:
The chart group SHOULD<13> contain two sequences of records that conform to the DFTTEXT rule that have the same records with the same field values.
If the chart group contains a DataLabExtContents record, the DataLabExtContents record in the sequences of records that conform to the DFTTEXT rule on the chart group and the DataLabExtContents record that is not specified in the sequences of records that conform to the DFTTEXT rule on the chart group SHOULD<14> contain the same field values.
If the chart group contains a sequence of records that conforms to the DFTTEXT rule the following restrictions apply:
The fShowValue field of the AttachedLabel record SHOULD<15> equal the fShowValue field of the Text record in the sequence of records that conforms to the DFTTEXT rule.
The fShowPercent field of the AttachedLabel record SHOULD<16> equal the fShowPercent field of the Text record in the sequence of records that conforms to the DFTTEXT rule.
The fShowLabelAndPerc field of the AttachedLabel record SHOULD<17> equal the fShowLabelAndPerc field of the Text record in the sequence of records that conforms to the DFTTEXT rule.