Group: Forum Members
Last Active: 11 Years Ago
Posts: 16,
Visits: 1
|
Hello, I would like to ask: - Is correctly written code for placing the annotation in the chart? (it seems to me that y coordinates are not displayed correctly and when I'm zooming the chart, the annottation is on the other place) - Is it possible to move (drag and drop) the annotation in the chart?
My code to draw the anntotation with "text" on the coordinates x,y
private void DrawNote(NCartesianChart chart, NXYScatterSeries series, float x, float y, string text) { NRoundedRectangularCallout note = new NRoundedRectangularCallout();
NVector3DF vecModelPoint = new NVector3DF(); NAxis xAxis = chart.Axis(StandardAxis.PrimaryX); NAxis yAxis = chart.Axis(series.VerticalAxes[0]);
vecModelPoint.X = xAxis.TransformScaleToModel(true, x); vecModelPoint.Y = yAxis.TransformScaleToModel(true, y); vecModelPoint.Z = 0;
note.FillStyle = new NColorFillStyle(Color.DeepPink); note.UseAutomaticSize = true; note.TextStyle.FontStyle = new NFontStyle(_doc.SeriesNoteFont.Name, _doc.SeriesNoteFont.Size, _doc.SeriesNoteFont.Style); note.Visible = true; note.Anchor = new NModelPointAnchor(chart, vecModelPoint);
note.Orientation = 120; note.Text = text;
if (text != "") nChartControl.Panels.Add(note);
}
Thank you,
Daniela
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Daniela, When you zoom in the scale to model transform will change - that's why the annotation will keep on appearing on its original place. To fix the problem you need to use a different anchor: note.Anchor = new NScalePointAnchor(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY, (int)StandardAxis.Depth, AxisValueAnchorMode.Clip, new NVector3DD(x, y, 0)); You can also take a look at the following example - All Examples\Panels\Annotations. Let us know if you meet any problems...
Best Regards, Nevron Support Team
|