Returns the chart class type that corresponds to the input ChartType parameter
Warning
|
This function will return nil if the given chart class has not been registered. To ensure a chart class is registered, use that unit (i.e., uses RSDonutCharts) or use all units (i.e., uses RSRegisterAllCharts) in your main application
|
Namespace: FMX.RS.ChartPanel
Parameters
ChartType
Type: TRSChartType
Return Value
Type: TRSCustomChartClass
The following code uses the TRSChartType enumeration and the GetChartClass function to dynamically create all charts in the RCCS:
Delphi
|
uses
RSChartConsts, FMX.RS.ChartPanel, FMX.RS.RegisterAllCharts;
var
ChartType: TRSChartType;
aChart: TRSCustomChart;
aPanel: TRSChartPanel;
procedure TForm1.MakeAllCharts;
begin
// create all chart types
for ChartType := Succ(Low(TRSChartType)) to High(TRSChartType) do
begin
aPanel := TRSChartPanel.Create(Self);
GridLayout1.AddObject(aPanel);
aPanel.Header.Text := GetChartClass(ChartType).ClassName;
aPanel.Footer.Visible := False;
aPanel.Legend.Visible := False;
aChart := GetChartClass(ChartType).Create(aPanel);
aChart.Panel := aPanel;
aChart.CreatePreviewValues;
aPanel.TopAxis.Visible := False;
aPanel.RightAxis.Visible := False;
aPanel.Gradient.StartColor := aChart.Color;
aPanel.Gradient.Direction := TGradientDirection(Random(Ord(High(TGradientDirection))));
end;
end;
|
|