ChartImageTool problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Thomas
Newbie
Newbie
Posts: 10
Joined: Thu Nov 25, 2004 5:00 am
Location: Calgary, Canada
Contact:

ChartImageTool problem

Post by Thomas » Mon Feb 14, 2005 9:25 pm

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Feb 21, 2005 4:17 pm

Hi Thomas,

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

Post Reply