Pre loader

AxisMarkerAnnotation

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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

  • You must to post comments
0
0

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

  • deepakb1
    Thanks for the reply Yuriy.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies