Questions about annotations


Author
Message
Alina Voskova
Alina Voskova
Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)
Group: Forum Members
Posts: 43, Visits: 1
Hello.
1. I have NArrowCallout attached to the data point in the line series. It has the default EndCapStyle: Arrow with size 5x5. But I see that the arrow not points to the data point. I tried to set the Offset property, but I have not seen any changes.
2. Is it possible not render part of annotation (or the whole annotation) that is on the chart but outside the area bounded with axes?
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.2K

Hi Ereona,

1. I have NArrowCallout attached to the data point in the line series. It has the default EndCapStyle: Arrow with size 5x5. But I see that the arrow not points to the data point. I tried to set the Offset property, but I have not seen any changes.

Can you post the code that configures the callout?

2. Is it possible not render part of annotation (or the whole annotation) that is on the chart but outside the area bounded with axes?
No - the chart cannot clip child panels at tis point. You can wordaround this by using custom painting (All examples\Custom Painting). There you can set a clip region based on the plot bounds of the chart.



Best Regards,
Nevron Support Team


Alina Voskova
Alina Voskova
Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)
Group: Forum Members
Posts: 43, Visits: 1
Thanks for answers.
My code to configure the annotation:
//type is one of the following types: NArrowAnnotation, NArrowCallout, NOvalCallout, NRectangularCallout, NRoundedRectangularCallout, NCutEdgeRectangularCallout
NAnnotation callout = Activator.CreateInstance(type) as NAnnotation;
callout.UseAutomaticSize = true;
//chartLine is NLineSeries
callout.Anchor = new NDataPointAnchor(chartLine, 0, ContentAlignment.MiddleCenter, StringAlignment.Center);
//line_descriptor is an object that configures annotation's properties
int alpha = 255 - (int)(line_descriptor.AnnotationTransparency / 100.0 * 255);
callout.FillStyle = new NColorFillStyle(Color.FromArgb(alpha, line_descriptor.AnnotationFillColor));
callout.Text = line_descriptor.AnnotationText;
callout.Visible = line_descriptor.AnnotationVisible;
callout.Orientation = line_descriptor.AnnotationAngle;
if (callout is NCallout)
{
((NCallout)callout).ArrowLength = new NLength(line_descriptor.AnnotationArrowLength, NRelativeUnit.ParentPercentage);
}
else if (callout is NArrowAnnotation)
{
NArrowAnnotation arrow = callout as NArrowAnnotation;
arrow.ArrowHeadWidthPercent = line_descriptor.AnnotationArrowLength;
}
callout.TextStyle = new NTextStyle(line_descriptor.AnnotationTextFont, line_descriptor.AnnotationTextColor);
callout.StrokeStyle = new NStrokeStyle(1, Color.Black, (LinePattern)((int)line_descriptor.AnnotationLineType));
if (callout is NArrowCallout)
{
NArrowCallout arrow = callout as NArrowCallout;
arrow.EndCapStyle.Offset = new NLength(5);
arrow.EnableBaseLine = false;
arrow.BeginCapStyle.Style = CapStyle.None;
}
//and this code runs after adding values to line:
int linePointsCount = chartLine.Values.Count;
float positionPercent = line_descriptor.AnnotationPosition;
int linePointIndex = (int)(((double)linePointsCount) * positionPercent / 101.0);
((NDataPointAnchor)callout.Anchor).DataPointIndex = linePointIndex;
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