Page 1 of 1

How to make x and y axis the same scale

Posted: Mon Feb 28, 2011 5:27 pm
by 16658474
Hi,

I'd like to plot a gear with teeth and some circle, as show in the Figure 1 below. I am using TChart ActiveX control in MFD dialog. What I got does not have the right aspect ratio, i.e. the circle looks like an ellipse.

1. I tried making the chart width and height the same, but still the scales of x axis and y axis are not exactly the same. How can I make the scale of x and y the same?
2. The legend can be put at the bottom which will make it looks better, but still the legend will affect the scale of x and y axis. Is there a way to avoid that?
3.In the case that the X range (Xmin~Xmax) and Y range (Ymin~Ymax) are not the same, for example only plot several teeth, the tooth shape will be distorted as shown in Figure 2. So how to fix it?
4. When I change the dialog size, I want the size of TChart control changed accordingly/automatically. Is there a way to do that?

Thanks
JW

Re: How to make x and y axis the same scale

Posted: Tue Mar 01, 2011 3:10 pm
by 10050769
Hello John,
1. I tried making the chart width and height the same, but still the scales of x axis and y axis are not exactly the same. How can I make the scale of x and y the same?
You can use property of Axes SetMinMax as do in below lines of code:

Code: Select all

TChart1.Axis.Bottom.SetMinMax 0, 50
TChart1.Axis.Left.SetMinMax 0, 50
2. The legend can be put
at the bottom which will make it looks better, but still the legend will affect the scale of x and y axis. Is there a way to avoid that?
Sorry but I don't understand well what do you achieve with legend. Could you please, explain exactly what do you want do with legend, step to step?
3.In the case that the X range (Xmin~Xmax) and Y range (Ymin~Ymax) are not the same, for example only plot several teeth, the tooth shape will be distorted as shown in Figure 2. So how to fix it?
I think that a good option for your is use Anti-Alaising tool. You can find an example in TeeChartActiveX Demo Project concretely All Features\Tools\Antialias Filter
4. When I change the dialog size, I want the size of TChart control changed accordingly/automatically. Is there a way to do that?
You can use OnResize event of Chart to change automatically the size of Chart

Thanks,