Hi Yeray,
I tried the supplied code ... but it doesn't seem to be working predictably.
Code: Select all
private void StockChart_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
StockChart.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
StockChart.Panel.MarginRight = StockChart.Axes.Left.MaxLabelsWidth() +StockChart.Axes.Left.Ticks.Length;
Debug.Print("MarginRight: " + StockChart.Panel.MarginRight.ToString());
}
My full code is somethign like this
Code: Select all
StockChart.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
double maxMargin = StockChart.Axes.Left.MaxLabelsWidth() + StockChart.Axes.Left.Ticks.Length;
foreach (Axis axis in StockChart.Axes.Custom)
{
double tmp = axis.MaxLabelsWidth() + axis.Ticks.Length;
if (maxMargin < tmp)
{
maxMargin = tmp;
}
}
StockChart.Panel.MarginRight = maxMargin;
But it still overestimates the Label size and not by any constant value that I could adjust the Margin value by .. i.e. 50%
When I first open my chart the axis labels render like so
- flakey1.png (3.65 KiB) Viewed 7980 times
When I add a custom axis with much larger labels the spacing doesnt change.(but by luck happens to fit)
- flakey2.png (5.66 KiB) Viewed 7977 times
When I change to another instrument that has larger labels I again have quite a gap
- flakey3.png (4.1 KiB) Viewed 7979 times
Does it matter that my 'Right Axis' is actually the 'Left Axis' with the 'otherside' property set to true?
I'm guessing the main problem I am having is that it is calculating a far bigger label size than is actually being drawn.
And I am assuming that I need to do this routine for EVERY vertical axis and Custom axis.