Nevron Forum

How to get and set position for NRectangularCallout

https://www.nevron.com/Forum/Topic12837.aspx

By joern kunze - Monday, August 26, 2019

Hi Experts,
I have added a NRectangularCallout to a chart () which can be moved with the mouse - so far it works well:
NRectangularCallout m_RectangularCallout = new NRectangularCallout();
m_RectangularCallout.ArrowLength = new NLength(10, NRelativeUnit.ParentPercentage);
m_RectangularCallout.StrokeStyle.Width = new NLength(1);
     m_RectangularCallout.UseAutomaticSize = true;
      m_RectangularCallout.Orientation = iLabelPos;         // 348;   //8;
      m_RectangularCallout.Text = oLine.m_sLabel;
     _NevronChart.Panels.Add(m_RectangularCallout);

      // Anchor the callout to data point
      NDataPointAnchor anchor = new NDataPointAnchor(line, 1, ContentAlignment.MiddleCenter, StringAlignment.Center);
      m_RectangularCallout.Anchor = anchor;

      m_RectangularCallout.AlwaysInsideParent = true; 

The callout can be moved with the mouse (e.g. to drag it to a different location because it hides some important chart data).
Now I want to store the new position of the callout after the user has dragged it and restore the position of the callout when the data is loaded from external file.
So how can I:
1. Get the position of the callout after it has been dragged by mouse (and may be the callout orientation as well) ?
2. Restore the callout position after it has been created ?

Thanks for your help,
Best regards,
Joern
By Nevron Support - Wednesday, October 9, 2019

Hi Joern,
The callout drag tool modifies the callout Orientation and ArrowLength properties, so in order to restore the callout to its original position, you need to restore those two properties to their original values. Similarly, if you want to reposition a callout to the position that the user previously specified you need to alter two properties. Let us know if you meet any problems.