Hi,
I have added some custom annotations on my chart.
CalloutAnnotation ca = new CalloutAnnotation();ca.Location.LocationX = this.annotationLocation.X;ca.Location.LocationY = this.annotationLocation.Y;ca.Location.Type = LocationType.Pixels;ca.PE.Fill = Color.Aqua;ca.OffsetMode = LocationOffsetMode.Automatic;ca.Text = ac.AnnotationString;ca.Visible = true;this.DipAzimuthPolarChart.Annotations.Add(ca);
Is there a way to make the chart recompute the location of annotations when window-size changes, without re-drawing them using fillscenegraph event?
Right now, the annotations get re-drawn at the original x and y position specified, always.
Thanks
AK
The other mode that the UltraChart supports is:
annotation.Location.Type = LocationType.Percentage;
You can try setting the location of the annotation as a percentage of the chart.
This did not work for me. Probably I was not clear enough on my requirement.
1. There is a tool which let a user pick any location on the polar chart window - not necessarily within chart-bounds.
2. When the user release the mouse button, a forms comes up and he enter the annotation text.
3. When the form is saved/oked, the annotation is placed at the location where he clicked.
4. Now, the question was, how to make this annotation stick to its selected location when the chart window is re-sized.
Please check for my current solution posted on this page.
Here is the solution I am using today
//1. Event to track window-size changes ..
this.DipAzimuthPolarChart.SizeChanged += new System.EventHandler(this.checkAnnotations);
//2. Set a flag when this event happen.
private void checkAnnotations(object sender, EventArgs args)
{
this.updateAnnotation = true;
}
// 3. In FillSceneGraph event handler, update annotations if required.
if (this.updateAnnotation)
this.updateAnnotations();
// 4. And in updateAnnotations, update points with reference to the center of the circle.
private void updateAnnotations()
int newRadius = polarlayer.RadiusResolved;
System.Drawing.Point newCenter = this.polarlayer.CenterResolved;
for (int k = 0; k < this.DipAzimuthPolarChart.Annotations.Annotations.Count; k++)
Annotation ca = this.DipAzimuthPolarChart.Annotations.Annotations[k] as Annotation;
double newlocX = ca.Location.LocationX ;
double newlocY = ca.Location.LocationY ;
if (newRadius != this.currentRadius)
newlocX = newCenter.X + (newlocX - this.currentCenter.X) * (newRadius / currentRadius);
newlocY = newCenter.Y + (newlocY - this.currentCenter.Y) * (newRadius / currentRadius);
else if (this.currentCenter.X != newCenter.X)
newlocX = newlocX + (newCenter.X - this.currentCenter.X);
else if (this.currentCenter.Y != newCenter.Y)
newlocY = newlocY + (newCenter.Y - this.currentCenter.Y);
this.DipAzimuthPolarChart.Annotations.Annotations[k].Location.LocationX = newlocX;
this.DipAzimuthPolarChart.Annotations.Annotations[k].Location.LocationY = newlocY;
this.currentRadius = newRadius;
this.currentCenter = newCenter;
this.updateAnnotation = false;
Hello AK,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
This is because you are setting pixel positions. If you want to position the annotation to some specific data point, you can use:
ca.Location.ValueX = 10;
ca.Location.ValueY = 3;
ca.Location.Type = LocationType.DataValues;