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!
- dwoerner asked 10 years ago
- You must login to post comments
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!
- Andrew Burnett-Thompson answered 10 years ago
- last edited 10 years ago
- You must login to post comments
Please login first to submit.