categoryshapeshiftstart and categoryshapeshiftend properties for category axes#7010
categoryshapeshiftstart and categoryshapeshiftend properties for category axes#7010my-tien wants to merge 3 commits intoplotly:masterfrom
Conversation
read xsizemode for horizontal axes and ysizemode for vertical axes.
|
|
||
| function shapeBounds(ax, v0, v1, path, paramsToUse) { | ||
| var convertVal = (ax.type === 'category' || ax.type === 'multicategory') ? ax.r2c : ax.d2c; | ||
| function shapeBounds(ax, shape, paramsToUse, isVerticalAxis) { |
There was a problem hiding this comment.
Let's drop the isVerticalAxis argument and instead use the ax._id.
var isY = axi._id.charAt(0) === 'y';
| ax = Axes.getFromId(gd, shape.xref); | ||
|
|
||
| bounds = shapeBounds(ax, vx0, vx1, shape.path, constants.paramIsX); | ||
| bounds = shapeBounds(ax, shape, constants.paramIsX, false); |
There was a problem hiding this comment.
After considering https://github.com/plotly/plotly.js/pull/7010/files#r1626065612
| bounds = shapeBounds(ax, shape, constants.paramIsX, false); | |
| bounds = shapeBounds(ax, shape, constants.paramIsX); |
| ax = Axes.getFromId(gd, shape.yref); | ||
|
|
||
| bounds = shapeBounds(ax, vy0, vy1, shape.path, constants.paramIsY); | ||
| bounds = shapeBounds(ax, shape, constants.paramIsY, true); |
There was a problem hiding this comment.
After considering https://github.com/plotly/plotly.js/pull/7010/files#r1626065612
| bounds = shapeBounds(ax, shape, constants.paramIsY, true); | |
| bounds = shapeBounds(ax, shape, constants.paramIsY); |
| valType: 'number', | ||
| dflt: 0, | ||
| min: -0.5, | ||
| max: 0.5, |
There was a problem hiding this comment.
Perhaps increasing the range of min and max a bit could be useful to highlight points for cases e.g. histogram and bars with tiny gaps.
I suggest we allow values between -0.7 and 0.7 or maybe even -1 and 1?
| "x0": 0, | ||
| "x1": 0.25, | ||
| "xref": "x3 domain" | ||
| } |
There was a problem hiding this comment.
Let's also test these case using circle.
Thank you!
| description: [ | ||
| 'Only relevant if axis is a (multi-)category axes. Shifts x0/y0 by a fraction of the', | ||
| 'reference unit.' | ||
| ] |
There was a problem hiding this comment.
| ] | |
| ].join(' ') |
| description: [ | ||
| 'Only relevant if axis is a (multi-)category axes. Shifts x1/y1 by a fraction of the', | ||
| 'reference unit.' | ||
| ] |
There was a problem hiding this comment.
| ] | |
| ].join(' ') |
|
Some interaction tests are failing onCircleCI https://app.circleci.com/pipelines/github/plotly/plotly.js/10521/workflows/ce906b62-b6c2-4ae3-a52f-1e8e3001ae83/jobs/230944?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-checks-link&utm_content=summary as well as on my machine, if you please try npm run test-jasmine shapes |
|
To me it feels a little limiting to put these attributes on the axes rather than in each shape. What if you want a rectangle outlining one bar (or bar group), a line going from the middle of one category to the middle of another, and a circle around a single scatter point? The name is also awfully long. What about just |
@alexcjohnson |
|
Closing in favor of #7005. |
This is an alternative to PR #7005 for adjusting shapes' start and end coordinates (no selection yet)
Introduces
categoryshapeshiftstart(influences x0 or y0) andcategoryshapeshiftend(influences x1 or y1) for category axes.Disclaimer
I am required to add that…the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.