Page 1 of 1
Determine the relative width (in %) of the Y-Axis?
Posted: Thu Jan 22, 2004 8:37 pm
by 8123490
Is there a way to determine the relative width (in %) of a custom Y-Axis. I am creating custom y-axis, and want them to display next to each other, without overlapping (or drawing off the edge of the control).
Is this possible?
Thanks!
Posted: Thu Jan 22, 2004 9:53 pm
by 8123490
I have two examples that show the problem I'm encountering. The smaller jpeg (Chart1.jpg) has a relative position of 6% between each axis. You'll notice that the text seems to overwrite each other. Chart2.jpg is the same chart, but the chart size it bigger.
http://www.head-west.ca/Chart1.jpg
http://www.head-west.ca/Chart2.jpg
Posted: Fri Jan 23, 2004 9:03 am
by Pep
Hi,
this can be solved increasing the size (width and height) of the Axis.Labels.
Posted: Sat Jan 24, 2004 1:01 am
by 8123490
Is there a way to determine what I need for a height and width value? The main form can be sized dynamically..
Thanks!
Posted: Tue Jan 27, 2004 11:41 am
by Chris
Hi --
You can use code similar to the following to calculate axis width:
Code: Select all
Steema.TeeChart.Axis custom1 = new Steema.TeeChart.Axis(false, false, tChart1.Chart);
tChart1.Aspect.View3D = false;
tChart1.Axes.Custom.Add(custom1);
custom1.RelativePosition = 50;
line1.CustomVertAxis = custom1;
line1.FillSampleValues(150);
Bitmap bmp = tChart1.Bitmap;
int axisWidth = custom1.AxisPen.Width + custom1.Ticks.Length + custom1.MaxLabelsWidth();
tChart1.Header.Text = axisWidth.ToString();
Best regards,
Christopher Ireland
http://support.steema.com
Posted: Tue Jan 27, 2004 8:02 pm
by 8123490
Thanks for the sample, although I still do not know how to move the axis so that it is inside the graph region. The property "custom1.Position" is read-only so I cannot set it directly.
Since I can't use the "Position" property, how can I programmatically shift the axis the required pixels? I guess I could calculate the RelativePosition I need based on:
(width of axis) / (width of graph) * 100
Although, don't think the chart.width property is returning the proper values.
Also, I've just discovered the "Printer.Resolution" which makes my printout different than the display.
Posted: Fri Jan 30, 2004 11:10 am
by Chris
Hi --
Since I can't use the "Position" property, how can I programmatically shift the axis the required pixels?
Well, you could try using the Steema.TeeChart.Axis.PositionUnits Property, e.g.
Code: Select all
private void Form1_Load(object sender, System.EventArgs e) {
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis(false, false, tChart1.Chart);
tChart1.Axes.Custom.Add(axis1);
line1.FillSampleValues(20);
line2.FillSampleValues(20);
tChart1.Axes.Left.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
tChart1.Axes.Left.RelativePosition = 60;
line2.CustomVertAxis = axis1;
axis1.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
axis1.RelativePosition = 60;
}
Also, I've just discovered the "Printer.Resolution" which makes my printout different than the display.
OK, I'll look into this and get back to you.