DisplayMode: ChartDisplayMode;
The DisplayMode property determines a chart display mode.
The chart display mode depends on the chart type.
Executing the example requires a form containing the components:
ChartBox with the ChartBox1 identifier.
UiChart with the UiChart1 identifier that is a data source for ChartBox1.
Add a link to the Chart system assembly.
Sub Form_FormOnShow(Sender: Object; Args: IEventArgs);
Var
Chart: IChart;
Serie: IChartSerieBase;
Begin
//Set the number of series points
UiChart1.PointCount := 5;
//Set the number of chart series
UiChart1.SerieCount := 15;
//Set chart type
UiChart1.Style := ChartStyle.Mixed;
//Set chart display mode
UiChart1.DisplayMode := ChartDisplayMode.ModeManhattan3D;
//Set 3D chart
UiChart1.DisplayVolume3D := True;
Chart := UiChart1.Chart;
Chart.DisplayMode := ChartDisplayMode.ModeManhattan3D;
//Set displaying of Z axis
Chart.DisplayZAxis := True;
//Select Z axis on chart
Chart.AxisZ.Selected := True;
//Get chart series
Serie := Chart.Series.DefaultSerie;
//Enable displaying of data labels
Serie.LabelsEnabled := True;
End Sub Form_FormOnShow;
//Set chart plotting event
{ OnGetDataValue }
Sub UiChart1OnGetDataValue(Sender: Object; Args: IUiChartGetDataValueEventArgs);
Begin
Args.Result := True;
//Set the number of points and chart series
Args.Value := Args.PointIndex + Args.SerieIndex + 5;
End Sub UiChart1OnGetDataValue;
//Set chart group creation event
{ OnGetGroupCount }
Sub UiChart1OnGetGroupCount(Sender: Object; Args: IUiChartGroupCountEventArgs);
Begin
//Set the number of chart groups
Args.Result := 5;
Debug.WriteLine("OnGetGroupCount: " + Args.Result.ToString);
End Sub UiChart1OnGetGroupCount;
//Set event for assigning names to chart groups
{ OnGetGroupName }
Sub UiChart1OnGetGroupName(Sender: Object; Args: IUiChartGroupNameEventArgs);
Begin
//Assign names to chart groups
Args.Result := "GroupName " + Args.GroupIndex.ToString;
Debug.WriteLine("OnGetGroupName: " + Args.GroupIndex.ToString);
End Sub UiChart1OnGetGroupName;
//Set event for assigning indexes to chart parent series
{ OnGetParentSerieIndex }
Sub UiChart1OnGetParentSerieIndex(Sender: Object; Args: IUiChartParentSerieIndexEventArgs);
Begin
If Args.SerieIndex < 5 Then
Args.Result := -1;
End If;
//Assign indexes to chart parent series
Select Case Args.SerieIndex
Case 3, 6, 9, 12: Args.Result := 0;
Case 4, 7, 10, 13: Args.Result := 1;
Case 5, 8, 11, 14: Args.Result := 2;
End Select;
End Sub UiChart1OnGetParentSerieIndex;
//Set event for assigning indexes to chart series groups
{ OnGetSerieGroupIndex }
Sub UiChart1OnGetSerieGroupIndex(Sender: Object; Args: IUiChartSerieGroupIndexEventArgs);
Begin
//Assign indexes to chart series groups
Select Case Args.SerieIndex //5 groups
Case 0, 1, 2: Args.Result := 0;
Case 3, 4, 5: Args.Result := 1;
Case 6, 7, 8: Args.Result := 2;
Case 9, 10, 11: Args.Result := 3;
Case 12, 13, 14: Args.Result := 4;
End Select;
End Sub UiChart1OnGetSerieGroupIndex;
//Set event for assigning names to chart series groups
{ OnGetSerieGroupName }
Sub UiChart1OnGetSerieGroupName(Sender: Object; Args: IUiChartSerieGroupNameEventArgs);
Begin
//Assign names to chart series groups
Args.Result := "SerieGroupName " + Args.SerieIndex.ToString;
Debug.WriteLine("OnGetSerieGroupName: " + Args.SerieIndex.ToString);
End Sub UiChart1OnGetSerieGroupName;
//Set event for assigning names to chart series
{ OnGetSerieName }
Sub UiChart1OnGetSerieName(Sender: Object; Args: IUiChartSerieNameEventArgs);
Begin
//Assign names to chart series
Args.Result := "Serie " + Args.SerieIndex.ToString;
Debug.WriteLine("OnGetSerieName: " + Args.SerieIndex.ToString);
End Sub UiChart1OnGetSerieName;
//Set event for assigning names to chart points
{ OnGetPointName }
Sub UiChart1OnGetPointName(Sender: Object; Args: IUiChartPointNameEventArgs);
Begin
//Assign names to chart points
Args.Result := "Point " + Args.PointIndex.ToString;
Debug.WriteLine("OnGetPointName: " + Args.PointIndex.ToString);
End Sub UiChart1OnGetPointName;
//Set event for using relative series
{ OnGetRelativeSerieEnabled }
Sub UiChart1OnGetRelativeSerieEnabled(Sender: Object; Args: IUiChartRelativeSerieEnabledEventArgs);
Begin
//Use relative series
Args.Result := True;
End Sub UiChart1OnGetRelativeSerieEnabled;
After opening the form a 3D histogram with selected Z axis is rendered in the ChartBox component. The chart will contain:
15 series with data labels.
5 series points with the Point <point number> name.
5 groups with the GroupName <group number> name.
3 series groups with the SerieGroupName <series group number> name.
The console window displays parameters of occurring events.
See also: