Dynamic Creation of RChart

Problem I am trying to create RCharts dynamically, but end up with a floating point error.
Solution

By default, RChart redraws itself whenever a chart parameter is changed. When creating a chart dynamically, RChart most probably tries to rescale itself before the dimensions of the axes have been set. To fix the problem, you have to add the SetRange command immediately after creating an RChart:

var
  RC1   : TRChart;
  Form1 : TForm;

begin
RC1 := TRChart.Create (Form1);
RC1.Parent := Form1;
RC1.SetRange (0,0,1,1);
  ... now you can safely change any other RChart parameter ....
  ...
end;

 


Last Update: 2006-01-13