Page 1 of 1
Custom Axis
Posted: Tue Apr 15, 2008 5:18 pm
by 13045128
I have a strip chart, Similiar to the Permenant custom axis example, with the top being my left axis and the one below it being a custom axis.
The Y labels on the top axis go from 100 - 300
The Y labels on the custom axis go from 10,000 - 30,000
The left margin is not being adjusted to display all the digits in the custom axis.
Thanks
Posted: Wed Apr 16, 2008 7:58 am
by narcis
Hi history,
You can try setting left margin like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
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);
line2.CustomVertAxis = axis1;
axis1.StartPosition = 50;
axis1.EndPosition = 100;
tChart1.Axes.Left.EndPosition = 50;
for (int i = 0; i < 10; i++)
{
line1.Add(i * 100);
line2.Add(i * 10000);
}
Bitmap bmp = tChart1.Bitmap;
tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
tChart1.Panel.MarginLeft = Math.Max(line1.GetVertAxis.MaxLabelsWidth(), line2.GetVertAxis.MaxLabelsWidth());
}
Posted: Wed Apr 16, 2008 1:01 pm
by 13045128
Does MaxLabelsWidth take into account the Font size?
Posted: Wed Apr 16, 2008 1:33 pm
by narcis
Hi history,
Yes, internal methods use
MeasureString method for this calculation.