I would like to have the annotation to always show up at the top right hand corner of the chart, no matter what size. Below is what i did.
Set the annotationXY coordinate system to "ScreenCoordinates" to reference in pixels. First to compute the size of the annotation box, get the width and height of the chart in pixels.
Code: Select all
PointInt p = chart.MeasureText(annotation.Text,annotation.TextStyle.Font);
int widthPixel = p.X + annotation.AutoSizePadding*2;
int heightPixel = p.Y + annotation.AutoSizePadding*2;
annotation.LocationAxisValues.X = chart.ActualWidth - widthPixel;
annotation.LocationAxisValues.Y = chart.ActualHeight - heightPixel;
What do i need to change to achieve what i need.
And also, is it also possible to print the Annotation text outside the chart, along the margins of the chart so as not to block the chart contents? What do i need to set to do that?
Thanks!