Skip to content

Commit c21fa34

Browse files
committed
Derive scaling from axes
1 parent 22dea5d commit c21fa34

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/traces/quiver/attributes.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ var attrs = {
7373
editType: 'calc',
7474
description: 'Angle of arrowhead in radians. Default = π/9'
7575
},
76-
scaleratio: {
77-
valType: 'number',
78-
min: 0,
79-
editType: 'calc',
80-
description: 'The ratio between the scale of the y-axis and the scale of the x-axis (scale_y / scale_x). Default = null, the scale ratio is not fixed.'
81-
},
8276
hoverdistance: {
8377
valType: 'number',
8478
min: -1,

src/traces/quiver/defaults.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4646
// back-compat
4747
coerce('arrow_scale');
4848
coerce('angle', Math.PI / 9);
49-
coerce('scaleratio');
5049
coerce('hoverdistance', 20);
5150

5251
// Line styling

src/traces/quiver/plot.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
106106
}
107107

108108
// Compute arrow in data space
109-
var scaleRatio = trace.scaleratio || 1;
109+
// Derive pixel-per-data scaling from axes at this point
110+
var pxPerX = Math.abs(xa.c2p(cdi.x + 1) - xa.c2p(cdi.x));
111+
var pxPerY = Math.abs(ya.c2p(cdi.y + 1) - ya.c2p(cdi.y));
112+
var scaleRatio = (pxPerX && pxPerY) ? (pxPerY / pxPerX) : 1;
110113
var baseHeadScale = 0.2;
111114
var arrowScale = (trace.arrowsize !== undefined)
112115
? (baseHeadScale * trace.arrowsize)

0 commit comments

Comments
 (0)