SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
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 Stackoverflow.com 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.
I have a chart which has its YAxes and Series bound to a view Model. When I try to add an axis in real time I get an “InvalidOperationException” –
“Could not draw an annotation of type Abt.Controls.SciChart.Visuals.Annotations.AxisMarkerAnnotation. YAxis with Id == DefaultAxisId doesn’t exist. Please ensure that the YAxisId property is set to a valid value.”
I believe this might be because I don’t have an axis set up at start. Here are my Chart Modifiers <s:SciChartSurface.ChartModifier>
<s:AnnotationCreationModifier x:Name="annotationCreation" AnnotationCreated="OnAnnotationCreated" YAxisId="Y1"/>
<s:XAxisDragModifier ClipModeX="None" />
<s:YAxisDragModifier IsEnabled="True" ReceiveHandledEvents="True" AxisId="Y1"/></s:ModifierGroup>
Can you tell me what I need to do to avoid this exception. Also, I don’t see the Series Values Modifier working, I’m sure its related to this problem.
Please let me know,
You are right, the issue happens because of empty axes collection. To workaround it, try binding the Annotations collection to ViewModel and initializing it right after the axes collection. The same for modifiers, you need to bind ChartModifier and initialize it in the ViewModel.
Also, in the case of multiple axes, there are the YAxisId, XAxisId properties in IAnnotation, which allows you to determine which axis the annotation will be bound to/measured against(refer to the Annotations Are Easy example).
Hope this helps! Please, don’t hesitate to ask if you need more info or any assistance.
The YAxisId property has been added to SeriesValueModifier.
Please login first to submit.