Function TChartAxis.AxisRect:TRect;

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
BoikovSoft
Newbie
Newbie
Posts: 20
Joined: Thu Mar 26, 2009 12:00 am
Location: Russia, Samara

Function TChartAxis.AxisRect:TRect;

Post by BoikovSoft » Thu May 07, 2009 12:23 pm

As to me to define TRect object TChartAxis taking into account a font of a thickness of lines. It is necessary for definition of total height. All axes settle down horizontally.

In TeeEngine there is a function:
Function TChartAxis. AxisRect:TRect;

But she is not accessible in the basic appendix.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu May 07, 2009 2:28 pm

Hi BoikovSoft,

We are not sure to understand what are you exactly trying to do here. It would be helpful if you could send us an image, or a project we can run as-is to reproduce the issue here.
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

BoikovSoft
Newbie
Newbie
Posts: 20
Joined: Thu Mar 26, 2009 12:00 am
Location: Russia, Samara

Post by BoikovSoft » Fri May 08, 2009 5:01 am

Hi

Here a code for an example:

Code: Select all


...

uses Math, TeeProcs, TeEngine, Chart, Series;

...

var
  AChart: TChart;

...

procedure TForm1.FormCreate(Sender: TObject);
Procedure MyADD;
VAr
 AX: TChartAxis;
 Ser: TChartSeries;
Begin
  Ser := AChart.AddSeries(THorizLineSeries);
  AChart.CustomAxes.Add;
  AX := AChart.CustomAxes[AChart.CustomAxes.Count - 1];
  AX.Title.Caption := 'Title';
  AX.OtherSide := true;
  AX.Grid.Visible := false;
  AX.Horizontal := true;
  AX.PositionUnits := muPixels;
  Ser.CustomHorizAxis := AX;
  Ser.FillSampleValues();
end;
begin
  AChart := TChart.Create(Self);
  AChart.Parent := Self;
  AChart.OnMouseMove := ChartMouseMove; // <- It is necessary for idea demonstration.
  AChart.Align := alClient;
  AChart.Legend.Visible := false;
  AChart.View3D := false; // <- 3D properties to consider it is not necessary
  MyADD;
  MyAdd;
  MyADD;
  { I have intentionally made different height Axis.}
  AChart.CustomAxes[0].PositionPercent := -100;
  AChart.CustomAxes[0].Title.Font.Size := 15;
  AChart.CustomAxes[1].PositionPercent := -50;
  AChart.CustomAxes[1].Title.Font.Size := 30;
  AChart.CustomAxes[1].LabelsAngle:=90;
  //AChart.CustomAxes[1].LabelsSize:=-45; // <- It needs to be considered too
  AChart.CustomAxes[2].PositionPercent := 0;
  AChart.CustomAxes[2].Title.Font.Size := 13;
  Achart.MarginUnits := muPixels;
  AChart.MarginTop := 150; // <- It is necessary to instal property MargineTop
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  AChart.Destroy;
end;

procedure TForm1.ChartMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  { It is necessary for idea demonstration. }
  TChart(Sender).Repaint;
  if InRange(Y, 0, 50) then TChart(Sender).Canvas.Rectangle(0, 0, TChart(Sender).Width, 50);
  if InRange(Y, 50, 100) then TChart(Sender).Canvas.Rectangle(0, 50, TChart(Sender).Width, 100);
  if InRange(Y, 100, 150) then TChart(Sender).Canvas.Rectangle(0, 100,TChart(Sender).Width, 150);
end;

Problem:
1) how automatically to place Axis taking into account all its properties (3D properties to consider it is not necessary)?
2) It is necessary to instal property MargineTop so that the working area of the schedule was not under axes.
3) At mouse passage over rectangular area of an axis it is necessary to paint her.

BoikovSoft
Newbie
Newbie
Posts: 20
Joined: Thu Mar 26, 2009 12:00 am
Location: Russia, Samara

Post by BoikovSoft » Fri May 08, 2009 9:53 am

Has spent today all the day for the decision of this problem.

Here that I managed to make:

Code: Select all

function TForm1.GetAxisRect(AX: TChartAxis; var AHeigth: Integer): TRect;
var
    H       : Integer;
    R       : TRect;
    AData: Array [1..7] of Integer;
begin
  With AX do
  Begin
    R := AX.Title.ShapeBounds;
    if Horizontal then
    Begin
      H := Axis.Width div 2;
      AData[1] := r.Top;
      AData[2] := r.Bottom;
      AData[3] := PosAxis + H;
      AData[4] := PosAxis - H;

      H := AX.MaxLabelsWidth;

      AData[5] := PosLabels + H;
      AData[6] := PosTitle;
      AData[7] := PosLabels - H;

      result.Top    := MinIntValue(AData);
      result.Bottom := MaxIntValue(AData);

      result.Left   := Min(IStartPos, IEndPos+1);
      result.Right  := Max(IStartPos, IEndPos+1);

      AHeigth := result.Bottom - result.Top;
    end
    else
    Begin
      H := Axis.Width div 2;
      AData[1] := r.Left;
      AData[2] := r.Right;
      AData[3] := PosAxis + H;
      AData[4] := PosAxis - H;

      H := AX.MaxLabelsWidth;

      AData[5] := PosLabels + H;
      AData[6] := PosTitle;
      AData[7] := PosLabels - H;

      result.Left   := MinIntValue(AData);
      result.Right  := MaxIntValue(AData);

      result.Top    := Min(IStartPos, IEndPos+1);
      result.Bottom := Max(IStartPos, IEndPos+1);

      AHeigth := result.Right - result.Left;
    end;
  end;
end;
Can eat more successful decision?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Fri May 08, 2009 10:23 am

Hi BoikovSoft,

It seems a quite good function. I've added this to the wish list be implemented (and improved if possible) for further releases (TV52014141).

Thank you very much.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

BoikovSoft
Newbie
Newbie
Posts: 20
Joined: Thu Mar 26, 2009 12:00 am
Location: Russia, Samara

Post by BoikovSoft » Tue May 12, 2009 4:19 am

What is TV52014141?
Where it is possible to look the description?
And the full list of these problems or errors?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue May 12, 2009 7:30 am

Hi BoikovSoft,

This is the number that identifies the issue in our database. We use to inform in the forums thread about the issue number for future tracking but I'm afraid that this is, in general, for internal purposes only.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply