Profile Picture

Questions about annotations

Posted By Ereona 13 Years Ago
Author
Message
Ereona
Posted 13 Years Ago
View Quick Profile
Forum Member

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
Last Active: 11 Years Ago
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;

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

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



Ereona
Posted 13 Years Ago
View Quick Profile
Forum Member

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
Last Active: 11 Years Ago
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?



Similar Topics


Reading This Topic