TdxChartSimpleSeriesDoughnutView Class
Stores Doughnut View settings.
Declaration
TdxChartSimpleSeriesDoughnutView = class(
TdxChartSimpleSeriesCustomPieView
)
Remarks
The Doughnut View displays series values as slices of a doughnut whose radial angles reflect shares of all series values in relation to their total. The Doughnut View is identical to the Pie View but has a hole in its center.
The TdxChartSimpleSeriesDoughnutView
class implements the Doughnut View. To select the Doughnut View, assign 'Doughnut'
to the ViewType property of a simple series.
Main API Members
The list below outlines key members of the TdxChartSimpleSeriesDoughnutView
class that allow you to customize the appearance of a simple series that uses the Doughnut View.
- HoleRadius
- Specifies the hole radius of a Doughnut series.
- SweepDirection
- Arranges series values clockwise or counterclockwise.
- StartAngle
- Rotates a Doughnut series clockwise or counterclockwise.
- TotalLabel
- Provides access to total label settings.
- ExplodedValueOptions
- Allows you to display doughnut slices separately from each other.
- Appearance
- Provides access to general series appearance settings.
- ValueLabels
- Provides access to series value label settings.
- OnCanExplodeValue
- Allows you to display specific doughnut slices separately from each other based on certain conditions.
- Assign
- Copies compatible settings between simple series Views.
Code Example
The following code example creates a simple series with the Doughnut View
and populates it with data points in unbound mode:
uses cxDataStorage; // This unit declares the TcxStringValueType class
// ...
var
ASimpleDiagram: TdxChartSimpleDiagram;
ASimpleSeries: TdxChartSimpleSeries;
ADoughnutView: TdxChartSimpleSeriesDoughnutView;
ADataBinding: TdxChartSimpleSeriesUnboundDataBinding;
begin
dxChartControl1.BeginUpdate; // Initiates the following batch change
try
ASimpleDiagram := dxChartControl1.AddDiagram<TdxChartSimpleDiagram>('Country statistics');
ASimpleDiagram.Title.Appearance.FontOptions.Size := 16;
ASimpleDiagram.Legend.AlignmentHorz := TdxChartLegendAlignment.Near; // Moves the legend pane
ASimpleSeries := ASimpleDiagram.AddSeries('Area'); // Creates a simple series
// Displays series data point arguments on the diagram legend pane
ASimpleSeries.ShowInLegend := TdxChartSeriesShowInLegend.Diagram;
ASimpleSeries.ViewClass := TdxChartSimpleSeriesDoughnutView; // Selects the Doughnut series View
// Selects the unbound data access mode
ASimpleSeries.DataBindingClass := TdxChartSimpleSeriesUnboundDataBinding;
ADataBinding := ASimpleSeries.DataBinding as TdxChartSimpleSeriesUnboundDataBinding;
ADataBinding.ArgumentField.ValueTypeClass := TcxStringValueType; // Selects the string data type
ASimpleSeries.Title.Text := 'Area'; // Specifies the series title
// Populates the unbound simple series with data points
ASimpleSeries.Points.Add('Russia', 17.0752);
ASimpleSeries.Points.Add('Canada', 9.98467);
ASimpleSeries.Points.Add('USA', 9.63142);
ASimpleSeries.Points.Add('China', 9.59696);
ASimpleSeries.Points.Add('Brazil', 8.511965);
ASimpleSeries.Points.Add('Australia', 7.68685);
ASimpleSeries.Points.Add('India', 3.28759);
ASimpleSeries.Points.Add('Others', 81.2);
// Customizes appearance of the Doughnut series View
ADoughnutView := ASimpleSeries.View as TdxChartSimpleSeriesDoughnutView;
ADoughnutView.HoleRadius := 50;
ADoughnutView.ExplodedValueOptions.Mode := TdxChartExplodedValueMode.All;
finally
dxChartControl1.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
Related Compiled Demo
To see the Doughnut series View in action, run the Chart Control demo in the VCL Demo Center installed with compiled VCL DevExpress demos. Select the Doughnut item in the left sidebar.
Tip
You can find full source code for the installed compiled Chart control demo in the following folder:
%PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressChart
Direct TdxChartSimpleSeriesDoughnutView Class References
The View property of a simple series references the TdxChartSimpleSeriesDoughnutView
class as a TdxChartSimpleSeriesCustomView object if the ViewType property is set to 'Doughnut'
. You need to cast the returned object to the TdxChartSimpleSeriesDoughnutView
class to access all public API members.