Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1484 - Setting Bar datasources throws an Access Violation error.
Summary: Setting Bar datasources throws an Access Violation error.
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Functions (show other bugs)
Version: 150901
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://stackoverflow.com/questions/36...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-30 10:39 EDT by narcís calvet
Modified: 2016-03-31 03:14 EDT (History)
0 users

See Also:
Chart Series: Bar
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description narcís calvet 2016-03-30 10:39:04 EDT
Code below crashes with an Access Violation error when setting first datasource series. If tmpLineSeries is a line series, it works fine. A workaround is setting function's period > 0.

uses Series, TeeFunci;

procedure TForm1.FormCreate(Sender: TObject);
var tmpBarSeries1,
    tmpBarSeries2 : TBarSeries;
    tmpLineSeries : TBarSeries;
begin
  //Add 2 data Series

  tmpBarSeries1:=TBarSeries.Create(Self);
  tmpBarSeries2:=TBarSeries.Create(Self);

  DBChart1.AddSeries(tmpBarSeries1);
  DBChart1.AddSeries(tmpBarSeries2);

  //Populate them with data (here random)
  tmpBarSeries1.FillSampleValues(10);
  tmpBarSeries2.FillSampleValues(10);

  //Add a series to be used for an Average Function
  tmpLineSeries:=TBarSeries.Create(Self);
  DBChart1.AddSeries(tmpLineSeries);

  //Define the Function Type for the new Series
  tmpLineSeries.SetFunction(TAverageTeeFunction.Create(Self));

  //Define the Datasource for the new Function Series
  //Datasource accepts the Series titles of the other 2 Series
  tmpLineSeries.DataSources.Clear;

  //workaround
  //tmpLineSeries.FunctionType.Period:=1;

  tmpLineSeries.DataSources.Add( tmpBarSeries1 ); ////// AV occurs here!!!
  tmpLineSeries.DataSources.Add( tmpBarSeries2 );

  //    *Note - When populating your input Series manually you will need to
  //    use the Checkdatasource method
  //    - See the section entitled 'Defining a Datasource'
  //Change the Period of the Function so that it groups averages
  //every 2 Points

  tmpLineSeries.FunctionType.Period := 2;
end;