Assign different Anchor-Point to NRectangularCallout


Author
Message
joern kunze
joern kunze
Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)
Group: Forum Members
Posts: 86, Visits: 221
I use a NRectangularCallout together with a 2d-LineChart (just a couple of X-Y pairs) - the NRectangularCallout configuration:

    m_RectangularCallout.ArrowLength = new NLength(10, NRelativeUnit.ParentPercentage);
      m_RectangularCallout.StrokeStyle.Width = new NLength(1);  //disable Callout border: = 0
      m_RectangularCallout.UseAutomaticSize = true;
      m_RectangularCallout.Orientation = iLabelPos;
      m_RectangularCallout.Text = oLine.m_sLabel;

      _NevronChart.Panels.Add(m_RectangularCallout);

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

This works as expected. But now I want to change the anchor for the Callout - I tried the following:

1- Approach: Anchor at DataPoint 2
 NDataPointAnchor anchor = new NDataPointAnchor(oNevronLineSeries, 1, ContentAlignment.MiddleCenter, StringAlignment.Center);

           oCallout.RecalcLayout(NevronChart.View.Context);

      oChart.Chart.RecalcLayout(NevronChart.View.Context);
      oChart.Chart.Refresh();


Unfortunatly, nothing happens at all. So how can I change the anchor for the Callout?
 
2. Approach: Using a ScaleAnchor:

           oCallout.Anchor = new NScalePointAnchor(oChart.Chart, 0, 0, 0, AxisValueAnchorMode.Show, new NVector3DD(42348.931761342596, 0.0, 0));

           oCallout.RecalcLayout(NevronChart.View.Context);
        
      oChart.Chart.RecalcLayout(NevronChart.View.Context);
      oChart.Chart.Refresh();

But same as approach 1: Nothing happens at all. So how do I change the anchor to a NScalePointAnchor?

Thanks for the help,
Best regards, Joern
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
Hi Joern,

We could not replicate the problem - we tested with the following code:

  private void Form1_Load(object sender, EventArgs e)
   {
    // setup chart
    NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

    NLineSeries line = new NLineSeries();
    line.DataLabelStyle.Visible = false;
    Random rand = new Random();

    for (int i = 0; i < 100; i++)
    {
      line.Values.Add(rand.Next(100));
    }

    chart.Series.Add(line);

    callout = new NRectangularCallout();
    callout.Text = "Some text";
    callout.UseAutomaticSize = true;
    callout.Anchor = new NDataPointAnchor(line, 50, ContentAlignment.MiddleCenter, StringAlignment.Center);
    chart.ChildPanels.Add(callout);
   }

   NRectangularCallout callout;

   private void button1_Click(object sender, EventArgs e)
   {
    NLineSeries line = (NLineSeries)nChartControl1.Charts[0].Series[0];
    callout.Anchor = new NDataPointAnchor(line, 99, ContentAlignment.MiddleCenter, StringAlignment.Center);
    nChartControl1.Refresh();
   }

and the callout is repositioned properly.

Best Regards,
Nevron Support Team


joern kunze
joern kunze
Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)
Group: Forum Members
Posts: 86, Visits: 221
thanks a lot - your example does work on my site as well - so I will try to find the difference with the real project to clarify this issue.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search