10000 Merge remote-tracking branch 'origin-plotly/master' into ticklabelpos… · plotly/plotly.js@5caa41b · GitHub
[go: up one dir, main page]

Skip to content

Commit 5caa41b

Browse files
committed
Merge remote-tracking branch 'origin-plotly/master' into ticklabelposition-category-axes
2 parents c84ae91 + b560368 commit 5caa41b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+234
-85
lines changed

.circleci/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
install-firefox: false
4545
install-geckodriver: false
4646
install-chrome: true
47-
chrome-version: "127.0.6533.119"
47+
chrome-version: "132.0.6834.110"
4848
- attach_workspace:
4949
at: ~/
5050
- run:
@@ -83,7 +83,7 @@ jobs:
8383
install-firefox: false
8484
install-geckodriver: false
8585
install-chrome: true
86-
chrome-version: "127.0.6533.119"
86+
chrome-version: "132.0.6834.110"
8787
- attach_workspace:
8888
at: ~/
8989
- run:
@@ -105,7 +105,7 @@ jobs:
105105
install-firefox: false
106106
install-geckodriver: false
107107
install-chrome: true
108-
chrome-version: "127.0.6533.119"
108+
chrome-version: "132.0.6834.110"
109109
- attach_workspace:
110110
at: ~/
111111
- run:
@@ -127,7 +127,7 @@ jobs:
127127
install-firefox: false
128128
install-geckodriver: false
129129
install-chrome: true
130-
chrome-version: "127.0.6533.119"
130+
chrome-version: "132.0.6834.110"
131131
- attach_workspace:
132132
at: ~/
133133
- run:
@@ -168,7 +168,7 @@ jobs:
168168
install-firefox: false
169169
install-geckodriver: false
170170
install-chrome: true
171-
chrome-version: "127.0.6533.119"
171+
chrome-version: "132.0.6834.110"
172172
- attach_workspace:
173173
at: ~/
174174
- run:
@@ -189,7 +189,7 @@ jobs:
189189
install-firefox: false
190190
install-geckodriver: false
191191
install-chrome: true
192-
chrome-version: "127.0.6533.119"
192+
chrome-version: "132.0.6834.110"
193193
- attach_workspace:
194194
at: ~/
195195
- run:

.circleci/download_google_fonts.py

Lines changed: 49 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,82 @@
1+
import os
2+
13
import requests
24

3-
dirOut = '.circleci/fonts/truetype/googleFonts/'
5+
dir_out = ".circleci/fonts/truetype/googleFonts/"
6+
47

5 1C6A -
def download(repo, family, types):
6-
for t in types :
7-
name = family + t + '.ttf'
8-
url = repo + name + '?raw=true'
9-
print(url)
10-
req = requests.get(url, allow_redirects=True)
8+
def download(repo, family, types, overwrite=True):
9+
for t in types:
10+
name = family + t + ".ttf"
11+
url = repo + name + "?raw=true"
12+
out_file = dir_out + name
13+
print("Getting: ", url)
14+
if os.path.exists(out_file) and not overwrite:
15+
print(" => Already exists: ", out_file)
16+
continue
17+
req = requests.get(url, allow_redirects=False)
1118
if req.status_code != 200:
19+
# If we get a redirect, print an error so that we know to update the URL
20+
if req.status_code == 302 or req.status_code == 301:
21+
new_url = req.headers.get("Location")
22+
print(f" => Redirected -- please update URL to: {new_url}")
1223
raise RuntimeError(f"""
1324
Download failed.
1425
Status code: {req.status_code}
1526
Message: {req.reason}
16-
"""
17-
)
18-
open(dirOut + name, 'wb').write(req.content)
27+
""")
28+
open(out_file, "wb").write(req.content)
29+
1930

2031
download(
21-
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSansMono/',
22-
'NotoSansMono',
23-
[
24-
'-Regular',
25-
'-Bold'
26-
]
32+
"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSansMono/hinted/ttf/",
33+
"NotoSansMono",
34+
["-Regular", "-Bold"],
2735
)
2836

2937
download(
30-
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSans/',
31-
'NotoSans',
32-
[
33-
'-Regular',
34-
'-Italic',
35-
'-Bold'
36-
]
38+
"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSans/hinted/ttf/",
39+
"NotoSans",
40+
["-Regular", "-Italic", "-Bold"],
3741
)
3842

3943
download(
40-
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSerif/',
41-
'NotoSerif',
44+
"https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSerif/hinted/ttf/",
45+
"NotoSerif",
4246
[
43-
'-Regular',
44-
'-Italic',
45-
'-Bold',
46-
'-BoldItalic',
47-
]
47+
"-Regular",
48+
"-Italic",
49+
"-Bold",
50+
"-BoldItalic",
51+
],
4852
)
4953

5054
download(
51-
'https://github.com/google/fonts/blob/main/ofl/oldstandardtt/',
52-
'OldStandard',
53-
[
54-
'-Regular',
55-
'-Italic',
56-
'-Bold'
57-
]
55+
"https://raw.githubusercontent.com/google/fonts/refs/heads/main/ofl/oldstandardtt/",
56+
"OldStandard",
57+
["-Regular", "-Italic", "-Bold"],
5858
)
5959

6060
download(
61-
'https://github.com/google/fonts/blob/main/ofl/ptsansnarrow/',
62-
'PT_Sans-Narrow-Web',
63-
[
64-
'-Regular',
65-
'-Bold'
66-
]
61+
"https://raw.githubusercontent.com/google/fonts/refs/heads/main/ofl/ptsansnarrow/",
62+
"PT_Sans-Narrow-Web",
63+
["-Regular", "-Bold"],
6764
)
6865

6966
download(
70-
'https://github.com/impallari/Raleway/blob/master/fonts/v3.000%20Fontlab/TTF/',
71-
'Raleway',
72-
[
73-
'-Regular',
74-
'-Regular-Italic',
75-
'-Bold',
76-
'-Bold-Italic'
77-
]
67+
"https://raw.githubusercontent.com/impallari/Raleway/refs/heads/master/fonts/v3.000%20Fontlab/TTF/",
68+
"Raleway",
69+
["-Regular", "-Regular-Italic", "-Bold", "-Bold-Italic"],
7870
)
7971

8072
download(
81-
'https://github.com/googlefonts/roboto/blob/main/src/hinted/',
82-
'Roboto',
83-
[
84-
'-Regular',
85-
'-Italic',
86-
'-Bold',
87-
'-BoldItalic'
88-
]
73+
"https://raw.githubusercontent.com/googlefonts/roboto-2/refs/heads/main/src/hinted/",
74+
"Roboto",
75+
["-Regular", "-Italic", "-Bold", "-BoldItalic"],
8976
)
9077

9178
download(
92-
'https://github.com/expo/google-fonts/blob/main/font-packages/gravitas-one/400Regular/',
93-
'GravitasOne',
94-
[
95-
'_400Regular'
96-
]
79+
"https://raw.githubusercontent.com/expo/google-fonts/refs/heads/main/font-packages/gravitas-one/400Regular/",
80+
"GravitasOne",
81+
["_400Regular"],
9782
)

.circleci/env_image.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
2+
set -e
23
# install required fonts
3-
sudo apt-get install fonts-liberation2 fonts-open-sans fonts-noto-cjk fonts-noto-color-emoji && \
4-
sudo python3 .circleci/download_google_fonts.py && \
5-
sudo cp -r .circleci/fonts/ /usr/share/ && \
6-
sudo fc-cache -f && \
4+
sudo apt-get install fonts-liberation2 fonts-open-sans fonts-noto-cjk fonts-noto-color-emoji
5+
sudo python3 .circleci/download_google_fonts.py
6+
sudo cp -r .circleci/fonts/ /usr/share/
7+
sudo fc-cache -f
78
# install kaleido & plotly
89
sudo python3 -m pip install kaleido==0.2.1 plotly==5.5.0 --progress-bar off
910
# install numpy i.e. to convert arrays to typed arrays

.circleci/fonts/truetype/googleFonts/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

draftlogs/7269_add.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add property `zerolinelayer` to cartesian axes to allow drawing zeroline above traces [[#7269](https://github.com/plotly/plotly.js/pull/7269)]

src/plots/cartesian/axes.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,6 +2365,7 @@ axes.draw = function(gd, arg, opts) {
23652365
if(plotinfo.minorGridlayer) plotinfo.minorGridlayer.selectAll('path').remove();
23662366
if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove();
23672367
if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove();
2368+
if(plotinfo.zerolinelayerAbove) plotinfo.zerolinelayerAbove.selectAll('path').remove();
23682369

23692370
fullLayout._infolayer.select('.g-' + xa._id + 'title').remove();
23702371
fullLayout._infolayer.select('.g-' + ya._id + 'title').remove();
@@ -2462,6 +2463,7 @@ axes.drawOne = function(gd, ax, opts) {
24622463
var axLetter = axId.charAt(0);
24632464
var counterLetter = axes.counterLetter(axId);
24642465
var mainPlotinfo = fullLayout._plots[ax._mainSubplot];
2466+
var zerolineIsAbove = ax.zerolinelayer === 'above traces';
24652467

24662468
// this happens when updating matched group with 'missing' axes
24672469
if(!mainPlotinfo) return;
@@ -2576,7 +2578,7 @@ axes.drawOne = function(gd, ax, opts) {
25762578
});
25772579
axes.drawZeroLine(gd, ax, {
25782580
counterAxis: counterAxis,
2579-
layer: plotinfo.zerolinelayer,
2581+
layer: zerolineIsAbove ? plotinfo.zerolinelayerAbove : plotinfo.zerolinelayer,
25802582
path: gridPath,
25812583
transFn: transTickFn
25822584
});
@@ -3558,6 +3560,7 @@ axes.drawLabels = function(gd, ax, opts) {
35583560

35593561
var fullLayout = gd._fullLayout;
35603562
var axId = ax._id;
3563+
var zerolineIsAbove = ax.zerolinelayer === 'above traces';
35613564
var cls = opts.cls || axId + 'tick';
35623565

35633566
var vals = opts.vals.filter(function(d) { return d.text; });
@@ -3766,8 +3769,10 @@ axes.drawLabels = function(gd, ax, opts) {
37663769
var mainPlotinfo = fullLayout._plots[ax._mainSubplot];
37673770

37683771
var sel;
3769-
if(e.K === ZERO_PATH.K) sel = mainPlotinfo.zerolinelayer.selectAll('.' + ax._id + 'zl');
3770-
else if(e.K === MINORGRID_PATH.K) sel = mainPlotinfo.minorGridlayer.selectAll('.' + ax._id);
3772+
if(e.K === ZERO_PATH.K) {
3773+
var zerolineLayer = zerolineIsAbove ? mainPlotinfo.zerolinelayerAbove : mainPlotinfo.zerolinelayer;
3774+
sel = zerolineLayer.selectAll('.' + ax._id + 'zl');
3775+
} else if(e.K === MINORGRID_PATH.K) sel = mainPlotinfo.minorGridlayer.selectAll('.' + ax._id);
37713776
else if(e.K === GRID_PATH.K) sel = mainPlotinfo.gridlayer.selectAll('.' + ax._id);
37723777
else sel = mainPlotinfo[ax._id.charAt(0) + 'axislayer'];
37733778

src/plots/cartesian/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ function makeSubplotLayer(gd, plotinfo) {
614614
plotinfo.overplot = ensureSingle(plotgroup, 'g', 'overplot');
615615
plotinfo.plot = ensureSingle(plotinfo.overplot, 'g', id);
616616

617+
if(mainplotinfo && hasMultipleZ) {
618+
plotinfo.zerolinelayerAbove = mainplotinfo.zerolinelayerAbove;
619+
} else {
620+
plotinfo.zerolinelayerAbove = ensureSingle(plotgroup, 'g', 'zerolinelayer-above');
621+
}
622+
617623
if(!hasZ) {
618624
plotinfo.xlines = ensureSingle(plotgroup, 'path', 'xlines-above');
619625
plotinfo.ylines = ensureSingle(plotgroup, 'path', 'ylines-above');
@@ -643,6 +649,7 @@ function makeSubplotLayer(gd, plotinfo) {
643649
plotinfo.minorGridlayer = mainplotinfo.minorGridlayer;
644650
plotinfo.gridlayer = mainplotinfo.gridlayer;
645651
plotinfo.zerolinelayer = mainplotinfo.zerolinelayer;
652+
plotinfo.zerolinelayerAbove = mainplotinfo.zerolinelayerAbove;
646653

647654
ensureSingle(mainplotinfo.overlinesBelow, 'path', xId);
648655
ensureSingle(mainplotinfo.overlinesBelow, 'path', yId);

src/plots/cartesian/layout_attributes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,19 @@ module.exports = {
10171017
editType: 'ticks',
10181018
description: 'Sets the line color of the zero line.'
10191019
},
1020+
zerolinelayer: {
1021+
valType: 'enumerated',
1022+
values: ['above traces', 'below traces'],
1023+
dflt: 'below traces',
1024+
editType: 'plot',
1025+
description: [
1026+
'Sets the layer on which this zeroline is displayed.',
1027+
'If *above traces*, this zeroline is displayed above all the subplot\'s traces',
1028+
'If *below traces*, this zeroline is displayed below all the subplot\'s traces,',
1029+
'but above the grid lines. Limitation: *zerolinelayer* currently has no effect',
1030+
'if the *zorder* property is set on any trace.'
1031+
].join(' ')
1032+
},
10201033
zerolinewidth: {
10211034
valType: 'number',
10221035
dflt: 1,

src/plots/cartesian/line_grid_defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer
6767
}
6868

6969
if(!opts.noZeroLine) {
70+
var zeroLineLayer = coerce2('zerolinelayer');
7071
var zeroLineColor = coerce2('zerolinecolor', dfltColor);
7172
var zeroLineWidth = coerce2('zerolinewidth');
7273
var showZeroLine = coerce('zeroline', opts.showGrid || !!zeroLineColor || !!zeroLineWidth);
7374

7475
if(!showZeroLine) {
76+
delete containerOut.zerolinelayer;
7577
delete containerOut.zerolinecolor;
7678
delete containerOut.zerolinewidth;
7779
}

src/plots/map/layout_attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ var attrs = module.exports = overrideAll({
284284
dflt: 'marker',
285285
description: [
286286
'Sets the symbol icon image (map.layer.layout.icon-image).',
287-
'Full list: https://www.map.com/maki-icons/'
287+
'Full list: https://www.mapbox.com/maki-icons/'
288288
].join(' ')
289289
},
290290
iconsize: {

src/traces/scattermap/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ module.exports = overrideAll({
119119
arrayOk: true,
120120
description: [
121121
'Sets the marker symbol.',
122-
'Full list: https://www.map.com/maki-icons/',
122+
'Full list: https://www.mapbox.com/maki-icons/',
123123
'Note that the array `marker.color` and `marker.size`',
124124
'are only available for *circle* symbols.'
125125
].join(' ')

test/image/baselines/fonts.png

-38 Bytes
Loading

test/image/baselines/gl2d_fonts.png

-38 Bytes
Loading
1.84 KB
Loading
27.1 KB
Loading
27.7 KB
Loading
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"data": [
3+
{
4+
"type": "bar",
5+
"x": [-1, 0, 2, 3],
6+
"y": [-1, 2, -3, 4],
7+
"name": "xy"
8+
},
9+
{
10+
"line": {
11+
"width": 10
12+
},
13+
"mode": "lines",
14+
"x": [-1, 0, 2, 3],
15+
"y": [-3, 1, -1, 2],
16+
"xaxis": "x2",
17+
"yaxis": "y2",
18+
"name": "x2y2"
19+
}
20+
],
21+
"layout": {
22+
"title": {
23+
"text": "All zerolines above traces (x/x2: pink, y/y2: black)"
24+
},
25+
"width": 600,
26+
"height": 400,
27+
"xaxis": {
28+
"zeroline": true,
29+
"zerolinewidth": 5,
30+
"zerolinecolor": "pink",
31+
"zerolinelayer": "above traces"
32+
},
33+
"xaxis2": {
34+
"overlaying": "x",
35+
"zeroline": true,
36+
"zerolinewidth": 5,
37+
"zerolinecolor": "pink",
38+
"zerolinelayer": "above traces",
39+
"side": "top"
40+
},
41+
"yaxis": {
42+
"zeroline": true,
43+
"zerolinewidth": 5,
44+
"zerolinecolor": "black",
45+
"zerolinelayer": "above traces",
46+
"range": [-1, 4]
47+
},
48+
"yaxis2": {
49+
"zeroline": true,
50+
"zerolinewidth": 5,
51+
"zerolinecolor": "black",
52+
"zerolinelayer": "above traces",
53+
"range": [-3, 2],
54+
"overlaying": "y",
55+
"side": "right"
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)
0