Skip to content

Commit d3940c6

Browse files
committed
Merge remote-tracking branch 'origin/master' into cam/7334/switch-geodata-providers
2 parents e385014 + e2fd2bb commit d3940c6

33 files changed

+845
-542
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: No CI Test
5+
6+
on: push
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x]
16+
17+
steps:
18+
- uses: browser-actions/setup-chrome@v1
19+
- uses: actions/checkout@v4
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
- run: chrome --version
26+
- run: ls
27+
- run: npm run pretest
28+
- run: npm ci
29+
- run: npm run cibuild
30+
- name: Run headless test
31+
uses: coactions/setup-xvfb@v1
32+
with:
33+
run: ./tasks/noci_test.sh jasmine

devtools/regl_codegen/devtools.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,3 @@ function handleOnLoad() {
158158
window.close();
159159
});
160160
}
161-
162-
module.exports = Tabs;

devtools/test_dashboard/devtools.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,3 @@ function handleOnLoad() {
268268
plotFromHash();
269269
}
270270

271-
module.exports = Tabs;

draftlogs/7280_add.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add `pattern.path` attribute as an alternative to the preset `pattern.shape` values, so you can use any SVG path string as a pattern fill. [[#7280](https://github.com/plotly/plotly.js/pull/7280)]

draftlogs/7407_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Move css-loader and other dependencies into devDependencies section [[#7407](https://github.com/plotly/plotly.js/pull/7407)]

draftlogs/7420_add.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Add support for ticklabelposition "inside"/"outside" for category axes with `tickson` set to "boundaries" [[#7420](https://github.com/plotly/plotly.js/pull/7420)],
2+
with thanks to @my-tien for the contribution!

package-lock.json

Lines changed: 198 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,13 @@
8686
"color-parse": "2.0.0",
8787
"color-rgba": "3.0.0",
8888
"country-regex": "^1.1.0",
89-
"css-loader": "^7.1.2",
9089
"d3-force": "^1.2.1",
9190
"d3-format": "^1.4.5",
9291
"d3-geo-projection": "^2.9.0",
9392
"d3-hierarchy": "^1.1.9",
9493
"d3-interpolate": "^3.0.1",
9594
"d3-time": "^1.1.0",
9695
"d3-time-format": "^2.2.3",
97-
"esbuild-style-plugin": "^1.6.3",
9896
"fast-isnumeric": "^1.1.4",
9997
"gl-mat4": "^1.2.0",
10098
"gl-text": "^1.4.0",
@@ -115,7 +113,6 @@
115113
"regl-scatter2d": "^3.3.1",
116114
"regl-splom": "^1.0.14",
117115
"strongly-connected-components": "^1.0.1",
118-
"style-loader": "^4.0.0",
119116
"superscript-text": "^1.0.0",
120117
"svg-path-sdf": "^1.1.3",
121118
"tinycolor2": "^1.4.2",
@@ -138,13 +135,15 @@
138135
"canvas": "^3.1.0",
139136
"check-node-version": "^4.2.1",
140137
"chttps": "^1.0.6",
138+
"css-loader": "^7.1.2",
141139
"d3-geo": "^3.1.1",
142140
"deep-equal": "^2.2.3",
143141
"ecstatic": "^4.1.4",
144142
"esbuild": "^0.25.5",
145143
"esbuild-plugin-browserify-adapter": "^0.1.4",
146144
"esbuild-plugin-environment": "^0.4.0",
147145
"esbuild-plugin-glsl": "^1.2.2",
146+
"esbuild-style-plugin": "^1.6.3",
148147
"extra-iterable": "^2.5.22",
149148
"falafel": "^2.2.5",
150149
"fs-extra": "^10.1.0",
@@ -180,6 +179,7 @@
180179
"run-series": "^1.1.9",
181180
"sass": "^1.78.0",
182181
"stream-browserify": "^3.0.0",
182+
"style-loader": "^4.0.0",
183183
"through2": "^4.0.2",
184184
"topojson": "^1.6.27",
185185
"transform-loader": "^0.2.4",

src/components/drawing/attributes.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ exports.pattern = {
2828
'By default, no pattern is used for filling the area.',
2929
].join(' ')
3030
},
31+
path: {
32+
valType: 'string',
33+
arrayOk: true,
34+
editType: 'style',
35+
description: [
36+
'Sets a custom path for pattern fill.',
37+
'Use with no `shape` or `solidity`, provide an SVG path string for',
38+
'the regions of the square from (0,0) to (`size`,`size`) to color.'
39+
].join(' ')
40+
},
3141
fillmode: {
3242
valType: 'enumerated',
3343
values: ['replace', 'overlay'],

src/components/drawing/index.js

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,14 @@ drawing.dashStyle = function(dash, lineWidth) {
218218
function setFillStyle(sel, trace, gd, forLegend) {
219219
var markerPattern = trace.fillpattern;
220220
var fillgradient = trace.fillgradient;
221-
var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, 0, '');
221+
var pAttr = drawing.getPatternAttr;
222+
var patternShape = markerPattern && (pAttr(markerPattern.shape, 0, '') || pAttr(markerPattern.path, 0, ''));
222223
if(patternShape) {
223-
var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, 0, null);
224-
var patternFGColor = drawing.getPatternAttr(markerPattern.fgcolor, 0, null);
224+
var patternBGColor = pAttr(markerPattern.bgcolor, 0, null);
225+
var patternFGColor = pAttr(markerPattern.fgcolor, 0, null);
225226
var patternFGOpacity = markerPattern.fgopacity;
226-
var patternSize = drawing.getPatternAttr(markerPattern.size, 0, 8);
227-
var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, 0, 0.3);
227+
var patternSize = pAttr(markerPattern.size, 0, 8);
228+
var patternSolidity = pAttr(markerPattern.solidity, 0, 0.3);
228229
var patternID = trace.uid;
229230
drawing.pattern(sel, 'point', gd, patternID,
230231
patternShape, patternSize, patternSolidity,
@@ -662,6 +663,16 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
662663
fill: fgRGB
663664
};
664665
break;
666+
default:
667+
width = size;
668+
height = size;
669+
patternTag = 'path';
670+
patternAttrs = {
671+
d: shape,
672+
opacity: opacity,
673+
fill: fgRGB
674+
};
675+
break;
665676
}
666677

667678
var str = [
@@ -869,7 +880,10 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd, pt) {
869880
}
870881

871882
var markerPattern = marker.pattern;
872-
var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, d.i, '');
883+
var pAttr = drawing.getPatternAttr;
884+
var patternShape = markerPattern && (
885+
pAttr(markerPattern.shape, d.i, '') || pAttr(markerPattern.path, d.i, '')
886+
);
873887

874888
if(gradientType && gradientType !== 'none') {
875889
var gradientColor = d.mgc;
@@ -888,14 +902,15 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd, pt) {
888902
fgcolor = pt.color;
889903
perPointPattern = true;
890904
}
891-
var patternFGColor = drawing.getPatternAttr(fgcolor, d.i, (pt && pt.color) || null);
905+
var patternFGColor = pAttr(fgcolor, d.i, (pt && pt.color) || null);
892906

893-
var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, d.i, null);
907+
var patternBGColor = pAttr(markerPattern.bgcolor, d.i, null);
894908
var patternFGOpacity = markerPattern.fgopacity;
895-
var patternSize = drawing.getPatternAttr(markerPattern.size, d.i, 8);
896-
var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, d.i, 0.3);
909+
var patternSize = pAttr(markerPattern.size, d.i, 8);
910+
var patternSolidity = pAttr(markerPattern.solidity, d.i, 0.3);
897911
perPointPattern = perPointPattern || d.mcc ||
898912
Lib.isArrayOrTypedArray(markerPattern.shape) ||
913+
Lib.isArrayOrTypedArray(markerPattern.path) ||
899914
Lib.isArrayOrTypedArray(markerPattern.bgcolor) ||
900915
Lib.isArrayOrTypedArray(markerPattern.fgcolor) ||
901916
Lib.isArrayOrTypedArray(markerPattern.size) ||

src/components/legend/style.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,14 @@ module.exports = function style(s, gd, legend) {
376376
var fillColor = mcc || d0.mc || marker.color;
377377

378378
var markerPattern = marker.pattern;
379-
var patternShape = markerPattern && Drawing.getPatternAttr(markerPattern.shape, 0, '');
379+
var pAttr = Drawing.getPatternAttr;
380+
var patternShape = markerPattern && (
381+
pAttr(markerPattern.shape, 0, '') || pAttr(markerPattern.path, 0, '')
382+
);
380383

381384
if(patternShape) {
382-
var patternBGColor = Drawing.getPatternAttr(markerPattern.bgcolor, 0, null);
383-
var patternFGColor = Drawing.getPatternAttr(markerPattern.fgcolor, 0, null);
385+
var patternBGColor = pAttr(markerPattern.bgcolor, 0, null);
386+
var patternFGColor = pAttr(markerPattern.fgcolor, 0, null);
384387
var patternFGOpacity = markerPattern.fgopacity;
385388
var patternSize = dimAttr(markerPattern.size, 8, 10);
386389
var patternSolidity = dimAttr(markerPattern.solidity, 0.5, 1);

src/lib/coerce.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,14 @@ exports.coerceFont = function(coerce, attr, dfltObj, opts) {
502502
*/
503503
exports.coercePattern = function(coerce, attr, markerColor, hasMarkerColorscale) {
504504
var shape = coerce(attr + '.shape');
505-
if(shape) {
506-
coerce(attr + '.solidity');
505+
var path;
506+
if(!shape) {
507+
path = coerce(attr + '.path');
508+
}
509+
if(shape || path) {
510+
if(shape) {
511+
coerce(attr + '.solidity');
512+
}
507513
coerce(attr + '.size');
508514
var fillmode = coerce(attr + '.fillmode');
509515
var isOverlay = fillmode === 'overlay';

src/plot_api/validate.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ function crawl(objIn, objOut, schema, list, base, path) {
214214
} else if(!Lib.validate(valIn, nestedSchema)) {
215215
list.push(format('value', base, p, valIn));
216216
} else if(nestedSchema.valType === 'enumerated' &&
217-
((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut)
217+
(
218+
(nestedSchema.coerceNumber && valIn !== +valOut) ||
219+
(!isArrayOrTypedArray(valIn) && valIn !== valOut) ||
220+
(String(valIn) !== String(valOut))
221+
)
218222
) {
219223
list.push(format('dynamic', base, p, valIn, valOut));
220224
}

src/plots/cartesian/axes.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,6 +3073,7 @@ function getPosX(d) {
30733073
// v is a shift perpendicular to the axis
30743074
function getTickLabelUV(ax) {
30753075
var ticklabelposition = ax.ticklabelposition || '';
3076+
var tickson = ax.tickson || '';
30763077
var has = function(str) {
30773078
return ticklabelposition.indexOf(str) !== -1;
30783079
};
@@ -3083,7 +3084,7 @@ function getTickLabelUV(ax) {
30833084
var isBottom = has('bottom');
30843085
var isInside = has('inside');
30853086

3086-
var isAligned = isBottom || isLeft || isTop || isRight;
3087+
var isAligned = (tickson !== 'boundaries') && (isBottom || isLeft || isTop || isRight);
30873088

30883089
// early return
30893090
if(!isAligned && !isInside) return [0, 0];
@@ -3167,6 +3168,8 @@ axes.makeTickPath = function(ax, shift, sgn, opts) {
31673168
*/
31683169
axes.makeLabelFns = function(ax, shift, angle) {
31693170
var ticklabelposition = ax.ticklabelposition || '';
3171+
var tickson = ax.tickson || '';
3172+
31703173
var has = function(str) {
31713174
return ticklabelposition.indexOf(str) !== -1;
31723175
};
@@ -3175,12 +3178,12 @@ axes.makeLabelFns = function(ax, shift, angle) {
31753178
var isLeft = has('left');
31763179
var isRight = has('right');
31773180
var isBottom = has('bottom');
3178-
var isAligned = isBottom || isLeft || isTop || isRight;
3181+
var isAligned = (tickson !== 'boundaries') && (isBottom || isLeft || isTop || isRight);
31793182

31803183
var insideTickLabels = has('inside');
31813184
var labelsOverTicks =
31823185
(ticklabelposition === 'inside' && ax.ticks === 'inside') ||
3183-
(!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries');
3186+
(!insideTickLabels && ax.ticks === 'outside' && tickson !== 'boundaries');
31843187

31853188
var labelStandoff = 0;
31863189
var labelShift = 0;
@@ -3895,14 +3898,16 @@ axes.drawLabels = function(gd, ax, opts) {
38953898
}
38963899
} else {
38973900
var ticklabelposition = ax.ticklabelposition || '';
3901+
var tickson = ax.tickson ||'';
3902+
38983903
var has = function(str) {
38993904
return ticklabelposition.indexOf(str) !== -1;
39003905
};
39013906
var isTop = has('top');
39023907
var isLeft = has('left');
39033908
var isRight = has('right');
39043909
var isBottom = has('bottom');
3905-
var isAligned = isBottom || isLeft || isTop || isRight;
3910+
var isAligned = (tickson !== 'boundaries') && (isBottom || isLeft || isTop || isRight);
39063911
var pad = !isAligned ? 0 :
39073912
(ax.tickwidth || 0) + 2 * TEXTPAD;
39083913

src/plots/cartesian/axis_defaults.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
167167
(axType === 'category' || isMultiCategory) &&
168168
(containerOut.ticks || containerOut.showgrid)
169169
) {
170-
var ticksonDflt;
171-
if(isMultiCategory) ticksonDflt = 'boundaries';
172-
var tickson = coerce('tickson', ticksonDflt);
173-
if(tickson === 'boundaries') {
170+
if (isMultiCategory) {
171+
coerce('tickson', 'boundaries');
174172
delete containerOut.ticklabelposition;
173+
} else { // category axis
174+
coerce('tickson');
175175
}
176176
}
177177

src/plots/cartesian/layout_attributes.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,12 +663,13 @@ module.exports = {
663663
dflt: 'outside',
664664
editType: 'calc',
665665
description: [
666-
'Determines where tick labels are drawn with respect to the axis',
666+
'Determines where tick labels are drawn with respect to the axis.',
667667
'Please note that',
668-
'top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*.',
669-
'Similarly',
670-
'left or right has no effect on y axes or when `ticklabelmode` is set to *period*.',
671-
'Has no effect on *multicategory* axes or when `tickson` is set to *boundaries*.',
668+
'top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*',
669+
'or when `tickson` is set to *boundaries*. Similarly,',
670+
'left or right has no effect on y axes or when `ticklabelmode` is set to *period*',
671+
'or when `tickson` is set to *boundaries*.',
672+
'Has no effect on *multicategory* axes.',
672673
'When used on axes linked by `matches` or `scaleanchor`,',
673674
'no extra padding for inside labels would be added by autorange,',
674675
'so that the scales could match.'
150 KB
Loading
Loading

0 commit comments

Comments
 (0)