Axis auto-range improvements
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
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 https://github.com/plotly/plotly.js/pull/1861#issuecomment-314518657) or during interactions as well (as proposed in https://github.com/plotly/plotly.js/issues/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 https://github.com/plotly/plotly.js/issues/400
A few more things to think about:
- Adding a
'tight'value for axisautorangewould take care of https://github.com/plotly/plotly.js/issues/928 - Maybe adding
'once'value for axisautorangefor https://github.com/plotly/plotly.js/issues/1849 - Maybe allow span axis
range(andbounds) values for https://github.com/plotly/plotly.js/issues/387
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by reviewing the proposed axis attributes and the linked discussions in PR #1861 and issues #887, #400, #928, #1849, and #387, then locate the axis autorange and interaction logic. Done would require a settled scope for bounds, boundmode, null bounds, and the additional autorange and range behavior; the issue does not name files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100