Pre loader

is IAxis.IsPrimaryAxis automatic?

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

Answered
2
0

Since many of the modifiers throw an exception if there isn’t exactly 1 primary axis, is there a built-in controller to maintain that?

I ended up having to put an event on all created axes to check if IsPrimaryAxis changes to True.
If it does, then it goes through all the surfaces other axes and sets the others to False.
Without this, the modifier.XAxis get accessor function throws an exception saying either “too many items found” or “no items found” while looking for the single primary axis.

I have a small sample I can include that demonstrates this, but this seems like I’m just missing something simple…

Thanks!

  • You must to post comments
Best Answer
3
1

Hi Dan,

Ok the answer is:

In v3.1

  • IsPrimaryAxis can only be assigned to one axis.
  • The primary axis draws Gridlines. All other axes do not draw gridlines.
  • Assigning to none, or to more than one, results in an exception.
  • When adding or removing an axis the IsPrimaryAxis flag is re-evaluated, ensuring there is only one Primary Axis
  • ChartModifierBase.XAxis will be the only Primary Axis from the SciChartSurface.XAxes collection
  • ChartModifierBase.YAxis will be the only Primary Axis from the SciChartSurface.YAxes collection

As a workaround for v3.1 users, we recommend add all your axes then you can set the IsPrimaryAxis flag to whatever you want. The property is only manipulated automatically when axes are added or removed.

However, in v3.2+

  • IsPrimaryAxis is simply bound to DrawMajorGridLines, DrawMinorGridLines
  • If you set more than one (or no) axis with IsPrimaryAxis, it won’t throw an exception
  • If you override DrawMajorGridLines/DrawMinorGridlines on a non-primary axis, it will draw
  • ChartModifierBase.XAxis will be the first Primary Axis from the SciChartSurface.XAxes collection
  • ChartModifierBase.YAxis will be the first Primary Axis from the SciChartSurface.YAxes collection

So the behaviour in v3.2 is a lot more permissive and perhaps intuitive.

I hope that helps answer your question!

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.