I'm using a composite chart, with that contains a double Y-Axis (Y, Y2). I am attempting to place the legend a few pixels beyond the biggest label on the Y2 axis (so the legend appears on the right hand side).
However, the calculation is being based on the font size applied to the Y2 axis, which uses a minimum and maximum size. When the chart fonts are scaled, this size is incorrect and causes the legend to appear in the correct place (fairly obvious why).
Can someone tell me how I can ensure that the bounds for the legend are always correct based on the scaled fonts?
Thanks...
you can calculate the bounds of the rightmost label using the FillSceneGraph event, and that should work as the left position of the legend.
void UltraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e)
{
int rightMostLabel = int.MinValue;
foreach (Primitive p in e.SceneGraph)
Text t = p as Text;
if (t != null)
rightMostLabel = Math.Max(rightMostLabel, t.bounds.Right);
}