SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.


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
            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

  • You must to post comments
Best Answer

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,

  • Alexander Volkov
    Thank you, Andrew, this truly was my issue. Best regards, Alexander.
  • Andrew
    No probs, glad to be of help!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.