Back to Devexpress

TdxChartCustomSeries.Points Property

vcl-dxchartcore-dot-tdxchartcustomseries-0c64f10d.md

latest6.6 KB
Original Source

TdxChartCustomSeries.Points Property

Provides access to the series point collection.

Declaration

delphi
property Points: TdxChartSeriesPoints read;

Property Value

TypeDescription
TdxChartSeriesPoints

Stores a collection of series points.

|

Remarks

You can call Points.Add and Points.Insert procedures in unbound data access mode to populate the series with data points. Points.Arguments, Points.Values, Points.ArgumentDisplayTexts, and Points.ValueDisplayTexts properties provide indexed access to series point arguments, values, and the corresponding display text strings. Note that SortBy and SortOrder properties do not affect the order of series points in the collection.

Tip

You can also use a series point collection to manage series points in bound data access mode. Refer to the TdxChartSeriesPoints class description for detailed information on all available options.

Code Example: Create an Unbound Doughnut Series

The following code example creates a simple series with the Doughnut View and populates it with data points in unbound mode:

delphi
uses cxDataStorage; // 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;
cpp
#include "cxDataStorage.hpp" // Declares the TcxStringValueType class
// ...
  TdxChartSimpleDiagram *ASimpleDiagram;
  TdxChartSimpleSeries *ASimpleSeries;
  TdxChartSimpleSeriesDoughnutView *ADoughnutView;
  TdxChartSimpleSeriesUnboundDataBinding *ADataBinding;
  // ...
  dxChartControl1->BeginUpdate(); // Initiates the following batch change
  try
  {
    ASimpleDiagram = new TdxChartSimpleDiagram(dxChartControl1->Owner);
    ASimpleDiagram->SetParentComponent(dxChartControl1);
    ASimpleDiagram->Title->Text = "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;
    // Selects the Doughnut series View
    ASimpleSeries->ViewClass = __classid(TdxChartSimpleSeriesDoughnutView);
    // Selects the unbound data access mode
    ASimpleSeries->DataBindingClass = __classid(TdxChartSimpleSeriesUnboundDataBinding);
    ADataBinding = dynamic_cast<TdxChartSimpleSeriesUnboundDataBinding*>(ASimpleSeries->DataBinding);
    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 = dynamic_cast<TdxChartSimpleSeriesDoughnutView*>(ASimpleSeries->View);
    ADoughnutView->HoleRadius = 50;
    ADoughnutView->ExplodedValueOptions->Mode = TdxChartExplodedValueMode::All;
  }
  __finally
  {
    dxChartControl1->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
  }
  // ...

See Also

TdxChartCustomSeries.EmptyPointsDisplayMode Property

TdxChartCustomSeries Class

TdxChartCustomSeries Members

dxChartCore Unit