Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TChart freezing when y values less than zero are added

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
GB
Hi,

I'm experiencing a strange problem when adding y values that are less than 1 to a bar series.

This is the code I use to create and initialise the series:
Code:
  fSpectrumSeries := TBarSeries.Create(Self);
  with fSpectrumSeries do
  begin
    BarPen.Visible := False;
    CustomBarWidth := 6;
    Marks.Visible := False;
    Multibar := mbNone;
    ParentChart := fAmplitudeSpectrum;
    SideMargins := False;
  end;
This is the code I use to populate my series with data:
Code:
  fAmplitudeSpectrum.Series[0].AddXY(1, 0.0158);
  fAmplitudeSpectrum.Series[0].AddXY(2, 0.0024);
  fAmplitudeSpectrum.Series[0].AddXY(3, 0.00078);
If I have fAmplitudeSpectrum.LeftAxis.Automatic set to True then the program freezes at runtime and the panel containing fAmplitudeSpectrum simply shows whatever is behind it i.e. it looks like it hasn't painted the TChart at all.

If I precede the population of the values above by the following line:
Code:
  fAmplitudeSpectrum.Series[0].AddNullXY(1, 1, '');
then it works fine, except that the y axis maximum is now 1 and consequently the small values I added are barely visible because of the scaling.

Therefore, I tried setting fAmplitudeSpectrum.LeftAxis.Automatic to False and I manually set the LeftAxis maximum to the highest value entered multiplied by 10%.
Code:
  fAmplitudeSpectrum.LeftAxis.Maximum := highestMagnitude * 1.1;
However, this also caused a freeze as above.

Has anyone experience any problems like this before?
Does anyone know of a fix/solution/workaround?

This has been giving me a headache for a while now so your help would be VERY MUCH appreciated!!!

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top