Hello,
I have a SciChart with as XAxis a DateTimeAxis and a dynamic/changing number of YAxes. Under the chart I have two DatePickers, the left one linked to the start of the DateTimeAxis, the right one linked to the end of the DateTimeAxis.
Now I would like to horizontally align these DatePickers right under the XAxis (so not just under SciChartSurface, see attached screenshot). How do I do this ? Note that the number of YAxes change, so I cannot just hardcode a margin.
Thanks in advance for any help,
Stefaan
- srillaert asked 11 years ago
- You must login to post comments
Hi Alex
Clamping Axis.Visiblerange
in SciChart WPF can be achieved with a VisibleRangeChanged
event handler
Take a look at Clipping the Axis.VisibleRange on Zoom and Pan
Clipping Axis.VisibleRange in Code To clip the VisibleRange and force a certain maximum or minimum, just use the following code:
axis.VisibleRangeChanged += (s, e) => { // e is VisibleRangeChangedEventArgs // Assuming axis is NumericAxis if (e.NewVisibleRange != null && e.NewVisibleRange.Min < 0) { // Force minimum visiblerange to zero always ((NumericAxis)sender).VisibleRange = new DoubleRange(0, e.NewVisibleRange.Max); } };
There are other methods in there such as using VisibleRangeLimit
but these have their limitations (no pun intended), such as not clamping when user zoom/pan occurs
- Andrew Burnett-Thompson answered 11 years ago
- last edited 3 weeks ago
- Thanks Andrew, this helped ! The critical part of my code for this is now : DependencyPropertyDescriptor.FromProperty(FrameworkElement.ActualWidthProperty, typeof(FrameworkElement)).AddValueChanged(sciChartSurface.AxisAreaLeft, RecalculatePeriodSelectorMargin); Enjoy the evening, Stefaan
- You must login to post comments
Please login first to submit.