No, it does not depend on text lenght, however...
It depends on various other things:
- Horizontal and vertical align of the text box (see: Location )
- Current size of the pane. The font size is scaled dynamically to fit the changing size of the chart.
- Counting proper positions to have TextObj (or any other object) always at the same place is quite hard. So you need avoid as much as you can any numbers/fractions in your location coordinates. ZedGraph sometimes calculates the true position in quite odd way then.
You haven t provided any code, so it s hard to tell if and where you made the mistake (if any). But, if I were you, I would do something like that:
TextObj fakeTitle = new TextObj("some title
", 0.0, 0.0); // I m using
to have additional line - this would give me some space, margin.
fakeTitle.Location.CoordinateFrame = CoordType.ChartFraction;
fakeTitle.Location.AlignH = AlignH.Left; // Left align - that s what you need
fakeTitle.Location.AlignV = AlignV.Bottom; // Bottom - it means, that left bottom corner of your object would be located at the left top corner of the chart (point (0,0))
fakeTitle.FontSpec.Border.IsVisible = false; // Disable the border
fakeTitle.FontSpec.Fill.IsVisible = false; // ... and the fill. You don t need it.
zg1.MasterPane[0].GraphObjList.Add(fakeTitle);
I m using ChartFraction
coordinates instead of PaneFraction
(as drharris suggests) coordinates to have the title nicely aligned with the left border of the chart. Otherwise it would be flushed totally to the left side (no margin etc...) - it looks better this way.
But make sure you didn t set too big font size - it could be clipped at the top