Page 1 of 1

Help - TChartShape AV

Posted: Wed Mar 16, 2005 9:22 pm
by 9336985
Hi,

I have a problem with a TShapeShape component. I reduced it to the following code - obviously the real code is more complex but this illustrates the point. I place a chart on the form at design time, but no series. I use the following code to create and initialize the series.

The clear, indiciated by the comment NB below, causes the subsequent assignment to x0 to fail. Without the clear it works fine. Obiously the clear is clearing something I need to re-establish...I know I can remove the clear - but as I said in the real app. it's a bit more complex.

Thanks in advance,

Regards,

Rick

var
uhActionLevelText : TChartShape;

begin

uhActionLevelText := TChartShape.Create( Self );
with uhActionLevelText do
begin
clear; // NB - this causes X0 assignment below to fail
ParentChart := self.Chart1;
Alignment := taLeftJustify;
Font.Color := clRed;
Font.Style := [fsBold];
Font.Size := 10;
Pen.Visible := False;
Transparent := True;

X0 := 100;
X1 := Chart1.BottomAxis.Maximum;
Y0 := Chart1.LeftAxis.Maximum / 2.0;
Y1 := Chart1.LeftAxis.Maximum;
Text.Text := '< AL = %-1.1n ppm';
end;

Posted: Thu Mar 17, 2005 8:47 am
by narcis
Hi Rick,

I've been able to reproduce your problem here. Replacing your clear line for Delete(0,Count); makes the AV disappear. Working code would be:

Code: Select all

var
  uhActionLevelText : TChartShape;
begin
  uhActionLevelText := TChartShape.Create( Self );
  with uhActionLevelText do
  begin
    //clear; // NB - this causes X0 assignment below to fail
    Delete(0,Count);
    ParentChart := self.Chart1;
    Alignment := taLeftJustify;
    Font.Color := clRed;
    Font.Style := [fsBold];
    Font.Size := 10;
    Pen.Visible := False;
    Transparent := True;

    X0 := 100;
    X1 := Chart1.BottomAxis.Maximum;
    Y0 := Chart1.LeftAxis.Maximum / 2.0;
    Y1 := Chart1.LeftAxis.Maximum;
    Text.Text := '< AL = %-1.1n ppm';
  end;
end;

Posted: Thu Mar 17, 2005 10:47 pm
by 9336985
Once again thanks - I guess you will log this for possible fix in a maintenance release - or do I need to do that?

Does the delete have the same effect as the clear?

Regards,

Rick

Posted: Fri Mar 18, 2005 8:36 am
by narcis
Hi Rick,
Once again thanks - I guess you will log this for possible fix in a maintenance release - or do I need to do that?
You're welcome. Yes, I have already added this bug to our defect list to be fixed for future releases.
Does the delete have the same effect as the clear?


According to TeeChart help definitions:

Clear: This method deletes all Series values. Dependent Series are notified. If no new points are appended to the Series, nothing will be painted.

Delete: The Delete method will remove the # ValueIndex point from the Series values lists. The ParentChart will be automatically redrawn. Dependent Series will be recalculated.