fair-acc / chart-fx

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.
GNU Lesser General Public License v3.0
499 stars 92 forks source link

Automatic scale the data of Y values to min/max visible X range. #315

Closed raven2cz closed 3 years ago

raven2cz commented 3 years ago

This functionality is based on the requirements for financial charts, see issue #294

In common, this is not just a financial chart feature; it is a reasonable behavior for chart where is necessary to research specific part of X range (mainly time range) and see whole compact information min-max of Y data values for this specific selected/slide X range (because Y min-max are very important to be visible; dangerous).

The feature is important mainly for:

Note: Standard zooming (standard zoomer) with mouse scroll wheel has to be kept, no change. It's very good feature, there is no restriction for min-max. If there is some problem to mixture of this features together? Usage of mouse scroll wheel DISABLE this feature, if you use RIGHT mouse button (which is already supported in zoomer) it's activate this feature again, because it has higher priority. In my point of view, the zoomer In/Out is activated for mouse wheel (only), but it is disabled if the right button is used, or another behavior has higher priority for Y-range restrictions. This is standard solution from any analytic software.

What I mean is presented in this amibroker youtube video from 1:24 for sliding, zooming etc. please look to this short video for understanding. There is not shown zoomer, but main requirement is visible.

Required chart features - example video from Amibroker >1:24

wirew0rm commented 3 years ago

Quick note on this, the ContourChartRenderer does this with its color axis, which can be set to automatically re-scale to the visible data range. That case is a bit simpler as usually there is only one contour/heatmap plot per chart/axis, so renderers will not 'argue' about updating the axis range. This might nevertheless help you implementing this or if you find a more general/elegant solution we should reuse that aproach over there as well.

As for the keybindings, application specific keybindings should probably be handled by the application. The right click funtionality in the zoomer is handled in the ObservableDeque zoomStacks which is currently not exposed, you would need to integrate with this, probably by extending Zoomer.