This issue attempts to combine ideas from several individual feature requests into coherent picture (i.e. the least number of new attribute possible).
In a private conversation with @alexcjohnson , we proposed adding two new (cartesian) axis attributes: bounds and boundmode. bounds would expect 2-item array values similar to the current range. bounds can be thought of as representing the maximum possible extend of the axis ranges. In turn, boundmode would determine if bounds applies during the auto-range routine (i.e. on first view - discuss in #1861 (comment)) or during interactions as well (as proposed in #887). For example,
xaxis: {
autorange: true,
boundmode: 'soft',
bounds: [0, 100]
}
would restrict the auto-range logic to compute an x-axis range between 0 and 100. This might be useful when plotting percentages where users don't want the axis ranges to go beyond 100%.
xaxis: {
boundmode: 'hard',
bounds: [0, 100]
}
would restrict the axis range to [0,100] in the auto-range logic and during interactions.
In doing so, 1-way bounds values such as [null, 100] or [0, null] should be allowed. null items here mean don't restrict the min (or max) bound acting. This behavior is similar to cmin and cmax for color scales. This call signature should also be extended to the axis range attribute - taking care of #400
A few more things to think about:
This issue attempts to combine ideas from several individual feature requests into coherent picture (i.e. the least number of new attribute possible).
In a private conversation with @alexcjohnson , we proposed adding two new (cartesian) axis attributes:
boundsandboundmode.boundswould expect 2-item array values similar to the currentrange.boundscan be thought of as representing the maximum possible extend of the axis ranges. In turn,boundmodewould determine ifboundsapplies during the auto-range routine (i.e. on first view - discuss in #1861 (comment)) or during interactions as well (as proposed in #887). For example,would restrict the auto-range logic to compute an x-axis
rangebetween 0 and 100. This might be useful when plotting percentages where users don't want the axis ranges to go beyond 100%.would restrict the axis range to
[0,100]in the auto-range logic and during interactions.In doing so, 1-way
boundsvalues such as[null, 100]or[0, null]should be allowed.nullitems here mean don't restrict the min (or max) bound acting. This behavior is similar tocminandcmaxfor color scales. This call signature should also be extended to the axisrangeattribute - taking care of #400A few more things to think about:
'tight'value for axisautorangewould take care of Implement different data-based autorange mode #928'once'value for axisautorangefor .animate method that can handle any type of figure diff #1849range(andbounds) values for Range selectors + streaming and/or markers #387