iso axes but also scaled

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

iso axes but also scaled

Post by fjrohlf » Sat Sep 12, 2015 2:03 am

The MakeIsoAxis sample code works but I need one more feature for my TPointSeries charts.

For example, if my x variable goes from 0 to 1 but my y variable goes from only 0 to 0.5 then I want the height of the vertical axis to be half the length of the x axis. What MakeIsoAxis does is to change the offset to extend the axes as necessary to fit the space allocated to the chart. I need the chartwidth and chartheight to be proportional to the desired ranges of the x and y axes (that is, for the chart to be half as tall as it is wide). Note: not always a factor of 0.5, the range will depend on the data entered by the user. I cannot seem to change the chartwidth and chartheight directly because they are read-only.

Is there a simple way to do this? If so, then I will also need an equivalent solution for 3D points (for my next project).

Thanks, Jim

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

Re: iso axes but also scaled

Post by Yeray » Mon Sep 14, 2015 1:33 pm

Hi Jim,

I've extracted the "Isometric Axis" demo from the Features Demo and modified it to use a TPointSeries with values in the ranges you mentioned.
But I'm not sure to understand what would you like to achieve here.

This is how it looks:
ISOPointer.png
ISOPointer.png (15.59 KiB) Viewed 32830 times
And here it is the project:
ISOPointer.zip
(1.99 KiB) Downloaded 1443 times
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

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Mon Sep 14, 2015 4:11 pm

thanks. the result you show if fine (though the 1.0 at the right is not shown along the horizontal axis). I will try your suggested changes.

Jim

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Mon Sep 21, 2015 4:39 pm

One problem remains. Your example extends the scale of the x or y axes so that the chart fills the window while keeping the scales isometric. I need the min and max values on the axes to remain the same. That is, I do not want the min or max values for the scales to be increased - just the axes stretched or compressed as necessary to make the axes isometric. I need to connect this to the resize event so the user can make the window (and the chart) larger or smaller while keeping the axes isometric.

Thanks!

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

Re: iso axes but also scaled

Post by Yeray » Thu Sep 24, 2015 7:34 am

Hello,

I'm not sure to understand what do you mean.
In these examples we are calling MinMax to change the axes scale and this already stretches/compresses the axes.
If you could draw a draft showing what would you expect to get, it may help me to understand it.
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

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Sat Sep 26, 2015 5:44 pm

I have attached an example. Note all the uninformative regions to the left of 0.0 and right of 1.0. What I want is for the window to be constrained so that those areas need not be plotted. In the present example it means that the plotting canvas needs to be constrained so it is twice as wide as high no matter how large or small the user makes the window.

thanks!
Attachments
Screen Shot 09-26-15 at 01.36 PM.PNG
Screen Shot 09-26-15 at 01.36 PM.PNG (24.04 KiB) Viewed 32729 times

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

Re: iso axes but also scaled

Post by Yeray » Tue Sep 29, 2015 3:08 pm

Hello,

I've modified the project above including a button that modifies the ChartRect to the minimum needed to display all the points.
Take a look at it:
ISOPointer.zip
(2.26 KiB) Downloaded 1399 times
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

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Tue Sep 29, 2015 3:37 pm

Getting closer. I will see if I can modify this new version to do what I want. Make iso would be ok if it shrunk the size of the teechart component to be just a little larger than what is actually used to display the plot.

Thanks,
Jim

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Sat Oct 03, 2015 7:50 pm

Unfortunately, still a problem. I need to know some more parameters before I can modify your code to do what I want. I guess it is a little hard to describe. I will try again. In your example if i click iso and then resize I get the first part of what I want. I then need to adjust the Tchart component to match the actual plot.

I need to know the width of the horizontal axes + any labels + legend (if present) so I can make the Tchart width equal to that. Then I need to know the height of the vertical axis + labels + titles so I can make the height of the Tchart equal to that. I don't want to fit the Tchart to the client, I want to adjust the client to fit the chart. Then I want the form's resize event to adjust the size of the Tchart while keeping the width and height of the Tchart in the proper proportion so the axes will remain isometric.

clearer?

Jim

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Sat Oct 10, 2015 1:26 am

Perhaps it will be more clear with a simple example. See the attached ZIP file. It plots x and y axes for data where x ranges from 0 to 4 but y only ranges from 0 to 2. Note that with the checkbox checked one can resize the window and the plot will fill as much of the window as it can while still keeping the lengths of the axes in proper proportion. When not checked the axes simply fill the window and are not usually in proper portion.

My problem using TeeChart is that i do not know how much width (in pixels) will be taken up by labels and marks for the vertical axis and the legend when displayed. I also do not know how much space (also in pixels) will be taken up by any titles, subtitles, and labels and marks for the horizontal axis. I suspect there must be a way to obtain this information but I have not yet found it in the documentation.

This is important for my application because it is for a statistical application where the units for the two axes must be the same.

thanks
Attachments
DemoIsoProblem.zip
Example of isometric plot without using TeeChart.
(5.04 KiB) Downloaded 1287 times

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

Re: iso axes but also scaled

Post by Narcís » Wed Oct 14, 2015 2:39 pm

Hi Jim,

Thanks for your feedback, I think I got your point. I created a new example project with a completely different approach, which consist on using CutomChartRect property.
Attachments
CustomChartRectIsoAxes.zip
(2.66 KiB) Downloaded 1337 times
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

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Thu Oct 15, 2015 4:10 am

Sorry, but not quite yet.

One thing that would help would be to tell me that given a certain axis lengths (found using the chart1.ChartRect in your example) how wide and tall the resulting chart will be in pixels (when including the axes labels and titles and the legend if it is visible). I could then try to resize the window around it so it will just fit. In looking at the documentation, it seems that there are quite a few things to take into account. There are also margins that seem to be set as percentages so i would need to convert to pixels. I suspect there are many more things to take into account. Is there any way to get the outer bounds for the actual plot?

I think I am going to have the same problems when I try to print.

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Thu Oct 15, 2015 1:31 pm

I may be getting to a solution. I can find the size of all that extra stuff by comparing chart1.width with chart1.chartwidth and chart1.height with chart1.chartheight. Then I need to find out how make the chartwidth and chartheight proportional to the scale of my data and fill the window efficiently.

fjrohlf
Newbie
Newbie
Posts: 33
Joined: Mon Sep 07, 2015 12:00 am

Re: iso axes but also scaled

Post by fjrohlf » Fri Oct 16, 2015 12:54 am

I seemed to have solved my problem for keeping axes isometric as a window is resized. :D I have attached a demo. Please let me know if you find a more efficient or more compact solution.

Thanks for your help,

Jim
Attachments
KeepIso.zip
(4.89 KiB) Downloaded 1443 times

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

Re: iso axes but also scaled

Post by Yeray » Fri Oct 16, 2015 9:06 am

Hello Jim,
fjrohlf wrote:I seemed to have solved my problem for keeping axes isometric as a window is resized. :D I have attached a demo. Please let me know if you find a more efficient or more compact solution.
I'm glad to hear you got it!
I'm looking at your solution and it looks very good! Thanks for sharing it!
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