Hello, SciChart Team
I am using VerticalLineAnnotations on my charts to show harmonics. I am generating them programmatically by code:
double x = harmonic.Frequency; // interval between lines
int i = 1;
while (x < Math.Min((double)MainChartSurface.XAxes[0].DataRange.Max,10000.0))
{
VerticalLineAnnotation newAnn = new VerticalLineAnnotation() {
X1 = x,
Stroke = new SolidColorBrush(harmonic.Color),
ShowLabel = false,
IsEditable = false
};
MainChartSurface.Annotations.Add(newAnn);
x = harmonic.Frequency * ++i;
}
After this code runs i expect vertical lines to appear, but they don’t.
They appear only when I pan or zoom chart (just do something): images before and after are attached, please help me to understand what i’m missing to make surface refresh. i tried to use method “SciChartSurface.UpdateLayout();” but it didn’t help.
On the first image there’s chart right after code runs. in the left upper corner there appears little line. if i run code for another harmonic right after it – it will appear normally, but the first one wouldn’t appear until user touches chart (uses pan or zoom, etc.)
Please help with this minor but uncomfortable issue.
Thanks in advance
Alexander.
- Alexander Volkov asked 8 years ago
- You must login to post comments
Hi there,
This can occur when you have multiple XAxis or YAxis and have not set the VerticalLineAnnotation.YAxisId or VerticalLineAnnotation.XAxisId.
Please ensure that you either leave all axis IDs default, or, you set both VerticalLineAnnotation.YAxisId or VerticalLineAnnotation.XAxisId to register the vertical line on an axis. It should then work!
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
-
Thank you, Andrew, this truly was my issue. Best regards, Alexander.
-
No probs, glad to be of help!
- You must login to post comments
Please login first to submit.