Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita32678d

Browse files
committed
feels weird
1 parenta9fe2a4 commita32678d

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

‎src/plots/plots.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3181,6 +3181,7 @@ function sortAxisCategoriesByValue(axList, gd) {
31813181
value=cdi.s;
31823182
if(value===undefined)value=cdi.v;
31833183
if(value===undefined)value=isX ?cdi.y :cdi.x;
3184+
31843185

31853186
if(!Array.isArray(value)){
31863187
if(value===undefined)value=[];

‎src/traces/scatterquiver/calc.js‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ module.exports = function calc(gd, trace) {
4545

4646
// For category aggregation, we need to set the right properties
4747
// The category aggregation looks for:
48-
// - catIndex = cdi.p (position) or cdi[axLetter] (x/y coordinate)
48+
// - catIndex = cdi.p (position) or cdi[axLetter] (x/y coordinate)
4949
// - value = cdi.s (size) or cdi.v (value) or opposite coordinate
50-
// We'll let the axis system handle the category index mapping
51-
cdi.s=Math.sqrt(u[i]*u[i]+v[i]*v[i]);// magnitude as size/value
52-
cdi.v=cdi.s;// also set v for value-based aggregation
50+
// For scatterquiver, use u component as the value for category ordering
51+
cdi.s=u[i];// use u component for size/value
52+
cdi.v=u[i];// use u component for value-based aggregation
53+
5354

5455
// Calculate arrow components for rendering
5556
vardx=u[i]*scale*(scaleRatio||1);
@@ -100,6 +101,9 @@ function isNumeric(val) {
100101

101102
functioncalcAxisExpansion(gd,trace,xa,ya,x,y){
102103
varserieslen=trace._length;
104+
varfullLayout=gd._fullLayout;
105+
varxId=xa._id;
106+
varyId=ya._id;
103107
varppad=0.1;// padding for arrows
104108

105109
// Calculate padding based on arrow lengths
@@ -112,6 +116,11 @@ function calcAxisExpansion(gd, trace, xa, ya, x, y) {
112116
}
113117
}
114118

115-
xa.expand(x,{ppad:ppad});
116-
ya.expand(y,{ppad:ppad});
119+
// Use the same approach as scatter trace
120+
varxOptions={padded:true,ppad:ppad};
121+
varyOptions={padded:true,ppad:ppad};
122+
123+
// N.B. asymmetric splom traces call this with blank {} xa or ya
124+
if(xId)trace._extremes[xId]=Axes.findExtremes(xa,x,xOptions);
125+
if(yId)trace._extremes[yId]=Axes.findExtremes(ya,y,yOptions);
117126
}

‎src/traces/scatterquiver/hover.js‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
1717
varclosestPoint=null;
1818
varclosestIndex=-1;
1919

20-
// Check each arrowsegment
20+
// Check each arrowpoint
2121
for(vari=0;i<cd.length;i++){
22-
varsegment=cd[i];
23-
if(segment.length<2)continue;
22+
varpoint=cd[i];
23+
if(!point||point.x===undefined||point.y===undefined)continue;
2424

2525
// Calculate distance to the start point of the arrow
26-
varx1=xa.c2p(segment[0].x);
27-
vary1=ya.c2p(segment[0].y);
26+
varx1=xa.c2p(point.x);
27+
vary1=ya.c2p(point.y);
2828

2929
vardistance=Math.sqrt((xpx-x1)*(xpx-x1)+(ypx-y1)*(ypx-y1));
3030

3131
if(distance<minDistance){
3232
minDistance=distance;
33-
closestPoint=segment[0];// Use the start point for hover data
33+
closestPoint=point;// Use the point for hover data
3434
closestIndex=i;
3535
}
3636
}
@@ -41,17 +41,17 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
4141
varhoverPoint={
4242
x:closestPoint.x,
4343
y:closestPoint.y,
44-
u:trace.u[closestIndex],
45-
v:trace.v[closestIndex],
44+
u:closestPoint.u,
45+
v:closestPoint.v,
4646
text:trace.text ?trace.text[closestIndex] :'',
4747
name:trace.name||'',
4848
trace:trace,
4949
index:closestIndex,
5050
// Set label values for proper hover formatting
5151
xLabelVal:closestPoint.x,
5252
yLabelVal:closestPoint.y,
53-
uLabelVal:trace.u[closestIndex],
54-
vLabelVal:trace.v[closestIndex],
53+
uLabelVal:closestPoint.u,
54+
vLabelVal:closestPoint.v,
5555
// Add spikeline support
5656
xa:pointData.xa,
5757
ya:pointData.ya,

‎test/jasmine/tests/calcdata_test.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ describe('calculated data and points', function() {
998998
}
999999
}
10001000

1001-
returnLib.extendDeep({},{
1001+
varbaseData={
10021002
orientation:axName==='yaxis' ?'h' :'v',
10031003
type:type,
10041004
x:cat,
@@ -1032,7 +1032,15 @@ describe('calculated data and points', function() {
10321032
values:b
10331033
}
10341034
]
1035-
});
1035+
};
1036+
1037+
// For scatterquiver, add u and v vector components
1038+
if(type==='scatterquiver'){
1039+
baseData.u=data;
1040+
baseData.v=data;
1041+
}
1042+
1043+
returnLib.extendDeep({},baseData);
10361044
}
10371045

10381046
supportedCartesianTraces.forEach(function(trace){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp