CustomFormat: String;
CustomFormat: string;
The CustomFormat property determines custom format of numeric values of tooltips on the chart.
Available formats:
%Autovalue. Default. Automatic value format.
%Value. Point value.
%YValue. Value of point on the Y axis.
%Part. Stacked value.
%Percent. Parts in percents.
%PercentPart. Stacked parts in percents.
%PercentHundredth. Parts is a ratio of series point value to the sum of values of the same point of all series.
%PercentPartHundredth. Parts in percents.
To determine the format of data label view on the chart, use IChartHint.StringFormat.
Executing this example requires a form containing the components:
ChartBox with the ChartBox1 identifier.
UiChart with the UiChart1 identifier. It is required to set the number of points and series for UiChart1. The UiChart1 component is a data source for ChartBox1. To built a chart, create event handlers OnGetDataValue and OnGetSerieName.
Sub Userproc;
Var
Chart: IChart;
Hint: IChartHint;
Color: IGxColor;
Font: IGxFont;
Begin
// Get chart
Chart := UiChart1.Chart;
// Get chart tooltips
Hint := chart.HintFormat;
// Enable displaying of tooltips
Chart.UseSignatureHint := True;
// Change tooltip background color
Hint.BackgroundInfo.Color := New GxColor.CreateRGB(120, 0, 120);
// Create a new color
Color := New GxColor.CreateRGB(127, 127, 127);
// Disable ability to take color from the indicator for tooltip border
Hint.UseIndicatorColorForBorder := False;
// Apply the new color for tooltip contour
Hint.BorderPen := New GxPen.CreateSolid(Color);
// Set default format
Hint.CustomFormat := "0,0000";
// Create a new font
Font := New GxFont.Create("Arial", 5);
// Apply the new font for tooltips
Hint.Font := Font;
//Change color font
Hint.FontColor := Color;
// Change horizontal position of label on the tooltip
Hint.HorizontalAlignment := ChartHorizontalAlignment.Left;
// Change format of tooltip displaying for the stacked value
Hint.StringFormat := "%Part";
// Refresh chart
Chart.Refresh;
End Sub Userproc;
After executing the example, on pointing the cursor on chart bars, tooltips of the specified format appear.
The requirements and result of the Fore.NET example execution match with those of the Fore example. Use Fore.NET analogs instead of Fore components.
Public Sub UserProc();
Var
Chart: IChart;
Hint: IChartHint;
Color: GxColorClass_2 = New GxColorClass_2();
Color1: GxColorClass_2 = New GxColorClass_2();
Font: GxFont = New GxFontClass();
Pen: GxPen = New GxPenClass();
Unit: GxUnit;
Style: GxFontStyle = New GxFontStyle();
Begin
// Get chart
Chart := UiChartNet1.ChartUi.Chart;
// Get chart tooltips
Hint := chart.HintFormat;
// Enable displaying of tooltips
Chart.UseSignatureHint := True;
// Change tooltip background color
Color.CreateRGB(120, 0, 120);
Hint.BackgroundInfo.Color := Color;
// Create a new color
Color1.CreateRGB(127, 127, 127);
// Disable ability to take color from the indicator for tooltip border
Hint.UseIndicatorColorForBorder := False;
// Apply the new color for tooltip contour
Hint.BorderPen.CreateSolid(Color1, 5);
// Set default format
Hint.CustomFormat := "0,0000";
// Create a new font
Font.Create("Arial", 5, GxFontStyle.gfsRegular, GxUnit.guPoint);
// Apply the new font for tooltips
Hint.Font := Font;
//Change color font
Hint.FontColor := Color1;
// Change horizontal position of label on the tooltip
Hint.HorizontalAlignment := ChartHorizontalAlignment.chaLeft;
// Change format of tooltip displaying for the stacked value
Hint.StringFormat := "%Part";
// Refresh chart
Chart.Refresh();
End Sub UserProc;
See also: