Hi,
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:ModifierGroup >
<s:SeriesValueModifier/>
<s:AnnotationCreationModifier x:Name="annotationCreation" AnnotationCreated="OnAnnotationCreated" YAxisId="Y1"/>
<s:XAxisDragModifier ClipModeX="None" />
<s:YAxisDragModifier IsEnabled="True" ReceiveHandledEvents="True" AxisId="Y1"/></s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
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,
Thanks,
Deepak
- deepakb1 asked 10 years ago
- You must login to post comments
Hi Deepak,
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.
UPDATE 2014:
The YAxisId property has been added to SeriesValueModifier.
Best regards,
Yuriy
- Yuriy Zadereckiy answered 10 years ago
-
Thanks for the reply Yuriy.
- You must login to post comments
Please login first to submit.