I attached a scrollbar to a Y axis, and it is functioning as expected except for how it handles VisibleRange.
If my code sets the Y Axis VisibleRange to be smaller than the min/max extent of the data series, the scrollbar behaves as expected – the size of the scrollbar decreases, and I can use it to pan through the full VisibleRange.
However, if I set the VisibleRange to be larger than the min/max extent of the data series, the scrollbar resets the VisibleRange to the actual data series extent as soon as I grab it.
Can I disable this behavior?
I would expect the scrollbar to navigate within the current VisibleRange, and not modify it.
This is using v3.21.0.5511
- wrlear asked 9 years ago
- last edited 9 years ago
- You must login to post comments
Good question.
In my specific case, it would be least disruptive to the user if the VisibleRange is left unchanged, and the scrollbar extents are adjusted to fit the new VisibleRange if necessary. I can think of three scenarios:
VisibleRange is changed (increased, decreased, moved), but still includes the full scrollbar extents : Scrollbar extents remain unchanged. Physically, the scrollbar shrinks, grows, and/or moves to reflect its proper size and position relative to the new visible range. This is the most common zoom-in/zoom-out or pan case
VisibleRange is changed to be smaller than the current scrollbar extent: The scrollbar extent is set equal to the new VisibleRange. Scrollbar would span the full axis. This is also common for zoom-in
VisibleRange is changed such that one end of the scrollbar or the entire scrollbar would be outside the new visible range: The range (max-min) of the Scrollbar extent remains the same (or is reduced to the new VisibleRange as in 2), but the max and min values are adjusted so the scrollbar is pegged at the appropriate end of the axis. This would normally be encountered during a pan.
In my case, I rely on the scrollbars for pan, so I would only encounter cases 1 and 2.
- wrlear answered 9 years ago
- Number 1 sounds good. The Chartview (X-Axis) shouldn't get set back if I click on the Scrollbar...
- You must login to post comments
Hi there,
Thanks for your suggestions! We appreciate them and will consider when working on this issue.
Actually, this isn’t an easy issue to resolve. The reason is that a ScrollBar modifies the VisibleRange itself, and its maximum is bound to the DataRange + GrowBy. So I think we could either make the maximum of a ScrollBar configurable or just bound it to VisibleRangeLimit. Does this make sense?
As a workaround for now, I would suggest setting VisibleRangeLimit on the axis which a ScrollBar is bound to. Use a ValueConverter to apply GrowBy (if required):
<sciChart:SciChartSurface.XAxis>
<sciChart:NumericAxis VisibleRangeLimit="{Binding DataRange, Mode=OneWay, RelativeSource={RelativeSource Self}}" />
</sciChart:SciChartSurface.XAxis>
This will prevent the main chart from zooming out of the DataRange along that axis.
Hope this helps!
Best regards,
Yuriy
- Guest answered 9 years ago
- You must login to post comments
Please login first to submit.