Skip to content

Commit d7a39f7

Browse files
committed
rename uvref to arrowref
1 parent a3c5fa2 commit d7a39f7

7 files changed

Lines changed: 24 additions & 24 deletions

File tree

‎src/traces/quiver/attributes.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var attrs = {
3838
anim: true,
3939
description: 'Sets the y components of the vector arrows.'
4040
},
41-
uvref: {
41+
arrowref: {
4242
valType: 'enumerated',
4343
values: ['paper', 'data'],
4444
dflt: 'data',
@@ -58,7 +58,7 @@ var attrs = {
5858
dflt: 'scaled',
5959
description: [
6060
'Determines whether vector arrows are drawn according to their raw lengths,',
61-
'or scaled based on the maximum vector length and point density. Note: When `uvref` is *paper*',
61+
'or scaled based on the maximum vector length and point density. Note: When `arrowref` is *paper*',
6262
'vectors are always scaled and `lengthmode` *raw* is ignored.'
6363
].join(' ')
6464
},

‎src/traces/quiver/calc.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function calc(gd, trace) {
3333
const uArr = trace.u || [];
3434
const vArr = trace.v || [];
3535

36-
const { anchor, lengthmode, uvref } = trace;
36+
const { anchor, lengthmode, arrowref } = trace;
3737
const isTip = anchor === 'tip';
3838
const isCenter = anchor === 'center';
3939

@@ -107,8 +107,8 @@ module.exports = function calc(gd, trace) {
107107
// Store maxNorm for use by plot step
108108
trace._maxNorm = normMax;
109109

110-
if (lengthmode === 'scaled' || uvref === 'paper') {
111-
// Ignore lengthmode 'raw' if uvref is set to 'paper': always scale
110+
if (lengthmode === 'scaled' || arrowref === 'paper') {
111+
// Ignore lengthmode 'raw' if arrowref is set to 'paper': always scale
112112

113113
// Compute point density of the entire trace: Area of bounding box
114114
// divided by number of points. This is used to scale arrows in
@@ -128,7 +128,7 @@ module.exports = function calc(gd, trace) {
128128
} else {
129129
trace._scaleFactor = Math.sqrt(pointDensity) / trace._maxNorm;
130130
}
131-
// Note: If uvref === 'paper', this scale factor must be
131+
// Note: If arrowref === 'paper', this scale factor must be
132132
// multiplied by Math.sqrt(xa._m * ya._m), but we can't do that quite yet
133133
// since the axis scales are not fully determined. Do it in plot step instead.
134134
} else {
@@ -146,7 +146,7 @@ module.exports = function calc(gd, trace) {
146146
const yTailPositions = new Array(len);
147147
var arrowLenX, arrowLenY;
148148
// Compute the x- and y-positions of the tip of each arrow,
149-
// assuming uvref === 'data' (i.e. u/v are in data coordinates)
149+
// assuming arrowref === 'data' (i.e. u/v are in data coordinates)
150150
for(var i = 0; i < len; i++) {
151151
var cdi = cd[i];
152152
arrowLenX = cdi._u * trace._scaleFactor;
@@ -169,12 +169,12 @@ module.exports = function calc(gd, trace) {
169169
}
170170
}
171171

172-
if (uvref === 'data') {
173-
// If uvref is 'data', we can use the arrow tip positions directly to expand the axes ranges
172+
if (arrowref === 'data') {
173+
// If arrowref is 'data', we can use the arrow tip positions directly to expand the axes ranges
174174
trace._extremes[xa._id] = Axes.findExtremes(xa, xTipPositions.concat(xTailPositions), {padded: true});
175175
trace._extremes[ya._id] = Axes.findExtremes(ya, yTipPositions.concat(yTailPositions), {padded: true});
176-
} else { // uvref === 'paper'
177-
// TODO: For now, just do the same thing as for uvref === 'data', but this is not correct.
176+
} else { // arrowref === 'paper'
177+
// TODO: For now, just do the same thing as for arrowref === 'data', but this is not correct.
178178
// We actually need more sophisticated logic here, since this will give a bad result
179179
// if the data aspect ratio is very different from the plot aspect ratio.
180180
trace._extremes[xa._id] = Axes.findExtremes(xa, xTipPositions.concat(xTailPositions), {padded: true});

‎src/traces/quiver/defaults.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3030
for(var j = 0; j < len; j++) traceOut.v[j] = 0;
3131
}
3232

33-
coerce('uvref');
33+
coerce('arrowref');
3434

3535
// Sizing API inspired by cone, but not identical
3636
coerce('lengthmode');

‎src/traces/quiver/plot.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
102102
lineSegments.exit().remove();
103103

104104
// Use maxNorm precomputed in calc
105-
const { anchor, maxNorm = 0, uvref } = trace;
105+
const { anchor, maxNorm = 0, arrowref } = trace;
106106

107-
// Adjust scale factor if uvref is 'paper'
108-
const scaleFactor = (uvref === 'paper') ? trace._scaleFactor * Math.sqrt(Math.abs(xa._m * ya._m)) : trace._scaleFactor;
107+
// Adjust scale factor if arrowref is 'paper'
108+
const scaleFactor = (arrowref === 'paper') ? trace._scaleFactor * Math.sqrt(Math.abs(xa._m * ya._m)) : trace._scaleFactor;
109109
const markerArrowsize = trace.marker.arrowsize;
110110

111111
// Update line segments
@@ -119,12 +119,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
119119
}
120120

121121
// Compute pixel location of vector tip, *relative to* vector base (before scaling).
122-
// If uvref is 'paper', then u/v are interpreted in pixel coordinates, so we can use them directly.
123-
// If uvref is 'data', then u/v are interpreted in data coordinates, so we need to convert them to pixel coordinates.
122+
// If arrowref is 'paper', then u/v are interpreted in pixel coordinates, so we can use them directly.
123+
// If arrowref is 'data', then u/v are interpreted in data coordinates, so we need to convert them to pixel coordinates.
124124
// TODO: This probably doesn't work for log axes, but let's ignore log axes for now
125125
// since I'm not sure they make sense for quiver plots anyway
126-
const pu = ((uvref === 'paper') ? cdi._u * Math.sign(xa._m) : d3.round(xa._m * cdi._u)) * scaleFactor;
127-
const pv = ((uvref === 'paper') ? cdi._v * Math.sign(ya._m) : d3.round(ya._m * cdi._v)) * scaleFactor;
126+
const pu = ((arrowref === 'paper') ? cdi._u * Math.sign(xa._m) : d3.round(xa._m * cdi._u)) * scaleFactor;
127+
const pv = ((arrowref === 'paper') ? cdi._v * Math.sign(ya._m) : d3.round(ya._m * cdi._v)) * scaleFactor;
128128

129129
// Compute arrow in data space
130130
// Check whether arrowsize was set explicitly in the input trace

‎src/types/generated/schema.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6731,7 +6731,7 @@ export interface QuiverData {
67316731
*/
67326732
lengthfactor?: number;
67336733
/**
6734-
* Determines whether vector arrows are drawn according to their raw lengths, or scaled based on the maximum vector length and point density. Note: When `uvref` is *paper* vectors are always scaled and `lengthmode` *raw* is ignored.
6734+
* Determines whether vector arrows are drawn according to their raw lengths, or scaled based on the maximum vector length and point density. Note: When `arrowref` is *paper* vectors are always scaled and `lengthmode` *raw* is ignored.
67356735
* @default 'scaled'
67366736
*/
67376737
lengthmode?: 'scaled' | 'raw';
@@ -6853,7 +6853,7 @@ export interface QuiverData {
68536853
* Determines how the u/v vector components are interpreted. If *paper*, u/v are interpreted in pixel coordinates and the rendered vector angle does not change regardless of the axis scales. If *data*, u/v are interpreted in data coordinates and the rendered vector angle may change, e.g. if zooming in along a single axis
68546854
* @default 'data'
68556855
*/
6856-
uvref?: 'paper' | 'data';
6856+
arrowref?: 'paper' | 'data';
68576857
/** Sets the y components of the vector arrows. */
68586858
v?: Datum[] | Datum[][] | TypedArray;
68596859
/** Sets the hover text formatting rule for `v` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.By default the values are formatted using generic number format. */

‎test/image/mocks/quiver_colorscale.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"v": [1, 1, 1, 2, 2, 2, 3, 3, 3],
99
"lengthmode": "scaled",
1010
"anchor": "tail",
11-
"uvref": "paper",
11+
"arrowref": "paper",
1212
"marker": {
1313
"showscale": true,
1414
"colorbar": {

‎test/jasmine/tests/quiver_test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ describe('Test quiver defaults', function() {
102102
expect(gd._fullData[0].lengthfactor).toBe(1);
103103
});
104104

105-
it('should set uvref default to data', function() {
105+
it('should set arrowref default to data', function() {
106106
gd = makeGD();
107107
supplyAllDefaults(gd);
108-
expect(gd._fullData[0].uvref).toBe('data');
108+
expect(gd._fullData[0].arrowref).toBe('data');
109109
});
110110

111111
it('should set anchor default to tail', function() {

0 commit comments

Comments
 (0)