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

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.