Page 1 of 1

ChartImageTool problem

Posted: Mon Feb 14, 2005 9:25 pm
by 9340003
There is a possible unintended dependency between the chart image's axis orientation and the image's appearance.
If the axis is inverted, the image is flipped.
If this is a desirable effect, it should be at least made optional, so that if an image is placed on the chart based on axes that are inverted, one would at least have a choice to view it flipped (mirrored) or not.
My temporary correction in TeeTools is as follows:

Code: Select all

procedure TChartImageTool.ChartEvent(AEvent: TChartToolEvent);
var R : TRect;
begin
  inherited;

  if (AEvent=cteBeforeDrawSeries) and Assigned(FPicture) then
  begin
    if Assigned(Series) then
    With Series do
    begin
      R.Left:=Min(CalcXPosValue(MinXValue), CalcXPosValue(MaxXValue));
      R.Right:=Max(CalcXPosValue(MinXValue), CalcXPosValue(MaxXValue));
      R.Top:=Min(CalcYPosValue(MaxYValue), CalcYPosValue(MinYValue));
      R.Bottom:=Max(CalcYPosValue(MaxYValue), CalcYPosValue(MinYValue));;
    end
    else
    begin
      With GetHorizAxis do
      begin
        R.Left:=Min(CalcPosValue(Minimum), CalcPosValue(Maximum));
        R.Right:=Max(CalcPosValue(Minimum), CalcPosValue(Maximum));
      end;
      With GetVertAxis do
      begin
        R.Top:=Min(CalcYPosValue(Maximum), CalcYPosValue(Minimum));
        R.Bottom:=Max(CalcYPosValue(Maximum), CalcYPosValue(Minimum));
      end;
    end;

    With ParentChart,Canvas do
    begin
      if CanClip then ClipCube(ChartRect,0,Width3D);
      if View3D and (not View3DOptions.Orthogonal) then
         StretchDraw(R,FPicture.Graphic,Width3D)
      else
         StretchDraw(CalcRect3D(R,Width3D),FPicture.Graphic);
      UnClipRectangle;
    end;
  end;
end;
I simply applied "Min(..." to the let and top coordinates and (Max(..." to the right and bottom coordinates of the rectangle. I am sure thhere are numerous vastly more elegant solutions, but this illustrates the problem.

Thanks,
Thomas

Posted: Mon Feb 21, 2005 4:17 pm
by Pep
Hi Thomas,

yes, this is by default. I've added this as "feature request" on our wish list to be considered for further releases.