DataFormat: String;
The DataFormat property determines a format of displaying text for data labels.
To create a value, the user can use variables, text, or substitutes described in the table.
Value | Description |
%Autovalue | Automatic value format (default). |
%Value | Point value. |
%YValue | Y axis point value. |
%XValue | X axis point value. |
%Part | Stacked value. |
%Percent | Parts in percents: the ratio of the point value to the sum of values of this point over all the series expressed in percent. |
%PercentPart | Stacked parts in percents. |
%PercentHundredth | Parts: the ratio of the point value to the sum of values of this point over all the series. |
%PercentPartHundredth | Stacked parts. |
%Data | Custom data format. |
%SerieName | Series name. |
%SerieNo | Series number. |
%PointName | Point name. |
%PointNo | Point number. |
Executing the example requires that the repository contains a form with the UiChart components named UiChart1 and ChartBox, and the Button component with the Button1 identifier. UiChart is a data source for ChartBox. Set the values for UiChart1: PointCount - 3, SerieCount - 1.
Add links to the Chart, ExtCtrls, Forms, Metabase, Report, and Tab system assemblies.
This example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
i, j: Integer;
chart: IChart;
Label: IChartLabel;
text: string;
Begin
chart := UiChart1.Chart;
text := " More: ";
chart.Series.DisplayLabels := True;
chart.UseSignatureHint := True;
For j := 0 To chart.Series.Count - 1 Do
For i := 0 To chart.PointsCount - 1 Do
Label := chart.Series.Item(j).SeriePoint(i).Label;
Label.DataFormat := "%Value" + text + "Serie: " + (j + 1).ToString + " Point: " + (i + 1).ToString;
chart.HintStringFormat := "%Value" + text + "Serie: " + (j + 1).ToString + " Point: " + (i + 1).ToString;
End For;
End For;
End Sub Button1OnClick;
Sub UiChart1OnGetDataValue(Sender: Object; Args: IUiChartGetDataValueEventArgs);
Begin
Args.Result := True;
Args.Value := Math.RandBetween(10, 40);
End Sub UiChart1OnGetDataValue;
After executing the example data labels of all series show series value at the point, followed by the text More: , Serie: , series index, the text Point: and point index. The same information is shown in the tooltips.
Thus, the user can add his own values to the label text, and this value can be different for each series and each specific point.
See also: