DBChart: Dynamically Assigning data.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Thomas Klingler
Advanced
Posts: 103
Joined: Tue Mar 02, 2004 5:00 am
Location: Bad Wurzach
Contact:

DBChart: Dynamically Assigning data.

Post by Thomas Klingler » Thu Feb 17, 2005 7:20 pm

I have been trying to dynamically assign data to a Series in a DBChart using a TClientDataSet and one scatter point series. I am using the following code:

Code: Select all

  ApplyResults.active := true;
  applyResults.open;
  Series1.YValues.ValueSource := cbContOutputs.Text;
  Series1.XValues.ValueSource :=  'Pred_'+cbContOutputs.Text;
  series1.CheckDataSource;
  contChart.RefreshData;
  ApplyResults.Close;
The correct field is assigned by the value. The charts name is "contChart". When I get to the "contChart.RefreshData" statement I get an Access violation.

Any thoughts to the problem?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Feb 18, 2005 6:41 am

Hi.

I think you forgot to connect the actual dataset. Add the following ling:

Code: Select all

ApplyResults.Open;
Series1.DataSource := ApplyResults; {ADO query ?}
Series1.YValues.ValueSource := cbContOutputs.Text; 
Series1.XValues.ValueSource :=  'Pred_'+cbContOutputs.Text; 
series1.CheckDataSource; 
Marjan Slatinek,
http://www.steema.com

Thomas Klingler
Advanced
Posts: 103
Joined: Tue Mar 02, 2004 5:00 am
Location: Bad Wurzach
Contact:

Not the problem -- still something else needed.

Post by Thomas Klingler » Fri Feb 18, 2005 12:54 pm

I did leave out the detail of what I was doing. The dataset was assigned at design time. Sorry, left that out. Tested it in anyway, not surprise did not help.

Still getting access error.

Thomas Klingler
Advanced
Posts: 103
Joined: Tue Mar 02, 2004 5:00 am
Location: Bad Wurzach
Contact:

Post by Thomas Klingler » Fri Feb 18, 2005 1:06 pm

I am told from another source that the "ApplyResults.close" statement is my problem. I removed that and it is working.

Post Reply