SOLVED -Display a circle as circle (not oval) without auto..

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
ChZiegelt
Newbie
Newbie
Posts: 39
Joined: Thu Aug 09, 2007 12:00 am
Contact:

SOLVED -Display a circle as circle (not oval) without auto..

Post by ChZiegelt » Tue Jun 03, 2008 9:28 am

Hi to all the helpful people out there !

I have a little problem in scaling a chart to the right extend.
I want to display different figures with ShapeSeries on my chart, which has a bigger width then height (1.67 times more or less).

The idea now was to use the max / min members of Bottom / Left axis to scale the chart (I want a circle displayed as a circle and a square not like a long table).

Therefor I used the following code, which does not really help me - I think it is because of the margins and maybe others setup values of TChart.

Which Width/Height Values could I use for scaling ?

minx,miny... are the real min / max values in the chart which should be displayed.

the outcommented lower part is for having a little ring of free space around the shapes.

Code: Select all


  { Es soll so skaliert werden, dass das Verhältnis auf X und Y Achse gleich
     bleibt, und im Raster quadratische Muster entstehen }
  chart.LeftAxis.Minimum   := miny; 
  chart.BottomAxis.Minimum := minx; 

  chart.LeftAxis.Maximum   := maxy; 
  chart.BottomAxis.Maximum := 
         (chart.ChartWidth  / chart.chartHeight) * maxx;

  //scale := max((maxx -minx), (maxy-miny));
  //chart.LeftAxis.Minimum   := chart.LeftAxis.Minimum - (scale * 0.1);
  //chart.BottomAxis.Minimum := chart.BottomAxis.Minimum - (scale * 0.1);
  //chart.LeftAxis.Maximum   := chart.LeftAxis.Maximum  + (scale * 0.1);
  //chart.BottomAxis.Maximum := chart.BottomAxis.Maximum + (scale * 0.1);


ChZiegelt
Newbie
Newbie
Posts: 39
Joined: Thu Aug 09, 2007 12:00 am
Contact:

Post by ChZiegelt » Tue Jun 03, 2008 10:21 am

There was a problem in the way I calculated the values.

It needs to be something like this:

Code: Select all

  if ((maxY-minY) / chart.ChartHeight) >= ( (maxX - minX) / chart.ChartWidth ) then
  begin
    chart.LeftAxis.Minimum   := miny;
    chart.LeftAxis.Maximum   := maxy;

    chart.BottomAxis.Minimum := (chart.ChartWidth  / chart.chartHeight) * ((maxY-minY)/(maxX-minX)) * minx;
    chart.BottomAxis.Maximum := (chart.ChartWidth  / chart.chartHeight) * ((maxY-minY)/(maxX-minX)) * maxx;
  end


Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 03, 2008 10:25 am

Hi ChZiegelt,

Sorry but the subject means you have already found a solution to the issue?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ChZiegelt
Newbie
Newbie
Posts: 39
Joined: Thu Aug 09, 2007 12:00 am
Contact:

Post by ChZiegelt » Tue Jun 03, 2008 11:10 am

Yes, the solution is my second posting.

Thanks for the reply.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 03, 2008 11:27 am

Hi ChZiegelt,

Thanks for the information.

Curious, I must have been reading the first post at the moment you were posting the second since I saw the changed subject but not the second post yet.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply