Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Call out annotations in webchart
posted

Hi

 I am using callout annotation as show in the chart with Automatic offset mode. But i need the annotation to be moved and point  to the bottom x-axis. I have tried setting the offset mode to manual but didnt succeed. Can any one help me plz.

 

Thanks,

Swathi

  • 26458
    Offline posted

    The offset isn't meant to change the bounds of the callout bubble, but you can still do that with the help of FillSceneGraph event.

    The annotation is actually two objects: a callout and a text, so you need to set bounds on both. Like so:

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
    {
     if (e.Grid.Count == 0) return;

     xAxis = (IAdvanceAxis)e.Grid["X"];
     yAxis = (IAdvanceAxis)e.Grid["Y"];

     Callout annotation = null;
     Text annotationText = null;

     foreach (Primitive p in e.SceneGraph)
     {
      if (p is Callout)
      {
       annotation = p as Callout;
       int annotationIndex = e.SceneGraph.IndexOf(annotation)+1;
       annotationText = e.SceneGraph[annotationIndex] as Text;
      }
     }

     if (annotation != null && annotationText != null)
     {
      annotation.Origin = new Point(annotation.Origin.X, (int)yAxis.MapMinimum);

      Rectangle bounds = new Rectangle(
       annotation.BubbleRectangle.X,
       annotation.Origin.Y - 25,
       annotation.BubbleRectangle.Width,
       annotation.BubbleRectangle.Height);

      annotation.BubbleRectangle = bounds;
      annotationText.bounds = bounds;
     }
    }