DataFormat: String;
DataFormat: String;
The DataFormat property determines format of displaying text for data labels.
To create a value, you can use variables, text, or substitutes described in the table.
| Value | Description |
| %Autovalue | Auto 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. |
To execute this example, add references to the Chart, Metabase, ExtCtrls, Forms, Report, and Tab system assemblies. Add the following components on the form: UiChart with the identifier UiChart1, ChartBox and a Button component with the identifier Button1. Specify UiChart as the source of ChartBox. For the UiChart1 component set PointCount to 3, and SerieCount to 1.
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 labels of all series show series value at the point, followed by the text More:, Serie: , series index, next goes 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.
To execute this example, add references to the Chart, ExtCtrls, Forms, MathFin, Metabase, Report, and Tab system assemblies. Add the following components on the form: UiChartNet with the identifier uiChartNet1, ChartBoxNet and a Button component with the identifier Button1. Specify uiChartNet1 as the source of ChartBoxNet.
Private Sub uiChartNet1_OnGetDataValue(Sender: System.Object; Args: Prognoz.Platform.Interop.Chart.UiChartGetDataValueEventArgs);
Var Math: Prognoz.Platform.Interop.MathFin.Math = New MathClass();
Begin
Args.Result := True;
Args.Value := Math.RandBetween(10,60);
End Sub;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
i,j: Integer;
chart: IUiChart;
Label: IChartLabel;
text: string;
Begin
chart := UiChartNet1.ChartUi;
text := " More: ";
chart.Chart.Series.DisplayLabels := True;
chart.Chart.UseSignatureHint := True;
For j := 0 To chart.Chart.Series.Count - 1 Do
For i := 0 To chart.PointCount - 1 Do
Label := chart.Chart.Series.Item[j].SeriePoint[i].Label;
Label.DataFormat := "%Value" + text + "Serie: " + (j + 1).ToString()+" Point: " + (i + 1).ToString();
chart.Chart.HintStringFormat := "%Value" + text + "Serie: " + (j + 1).ToString()+" Point: " + (i + 1).ToString();
End For;
End For;
End Sub;
Private Sub OBJ516Form_Shown(sender: System.Object; e: System.EventArgs);
Begin
uiChartNet1.PointCount := 3;
uiChartNet1.SerieCount := 1;
End Sub;
After executing the example labels of all series show series value at the point, followed by the text More:, Serie: , series index, next goes 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: