Page 1 of 1

DBChart: Dynamically Assigning data.

Posted: Thu Feb 17, 2005 7:20 pm
by 8443014
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?

Posted: Fri Feb 18, 2005 6:41 am
by Marjan
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; 

Not the problem -- still something else needed.

Posted: Fri Feb 18, 2005 12:54 pm
by 8443014
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.

Posted: Fri Feb 18, 2005 1:06 pm
by 8443014
I am told from another source that the "ApplyResults.close" statement is my problem. I removed that and it is working.