{*********************************************}
{  TeeChart Charting Library for FireMonkey   }
{  Copyright (c) 2012-2020 by Steema Software }
{  All Rights Reserved                        }
{*********************************************}
unit FMXTee.Editor.Functions.Average;
{$I TeeDefs.inc}

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
  {$IFNDEF UPTOXE3}
  FMX.StdCtrls,
  {$ENDIF}
  FMXTee.Editor.Functions.Period, FMX.Edit, FMX.ListBox;

type
  TAverageFuncEditor = class(TTeeFunctionEditor)
    CBNulls: TCheckBox;
    procedure CBNullsChange(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure ApplyFormChanges; override;
    procedure SetFunction; override;
  public
    { Public declarations }
  end;

implementation

{$R *.fmx}

uses
  FMXTee.Procs, FMXTee.Chart.Functions;

procedure TAverageFuncEditor.ApplyFormChanges;
begin
  inherited;
  TAverageTeeFunction(IFunction).IncludeNulls:=CBNulls.IsChecked;
end;

procedure TAverageFuncEditor.CBNullsChange(Sender: TObject);
begin
  EnableApply;
end;

procedure TAverageFuncEditor.SetFunction;
begin
  inherited;
  CBNulls.IsChecked:=TAverageTeeFunction(IFunction).IncludeNulls;
end;

initialization
  RegisterSeriesEditor(TAverageFuncEditor);
end.
