anchor annotation to legend data item


Author
Message
Daniela Rybarova
Daniela Rybarova
Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)
Group: Forum Members
Posts: 16, Visits: 1
Hello, I have a problem with the anchor of annotation.

I have the Cartesian chart _chart and its legend with these properties:

NLegend legend = new NLegend();

legend.Dock = DockStyle.Top;
legend.Data.ExpandMode = LegendExpandMode.ColsOnly;
legend.FitAlignment = ContentAlignment.TopCenter;

_chart.DisplayOnLegend = legend;

And I have the annotation:
_annotation = new NRoundedRectangularCallout();
_annotation.FillStyle = new NColorFillStyle(Color.Yellow);
_annotation.UseAutomaticSize = true;


I want to show the annotation when I click to legend data item. But the position of annotation is wrong. I think the position corresponds
to legend FitAligment TopLeft. What am I doing wrong?


private void nChartControl_MouseDown(object sender, MouseEventArgs e)
{
NHitTestResult hitTestResult = nChartControl.HitTest(e.X, e.Y);
NLegend legend = _chart.DisplayOnLegend;

_annotation.Anchor = new NLegendDataItemAnchor(legend, hitTestResult.ObjectIndex);
_annotation.Text = "......";

nChartControl.Panels.Add(_annotation);
}

Thanks for your help,
Daniela
Attachments
anchor_annotation.png (82 views, 215.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search