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

Commitc624d3d

Browse files
authored
Merge pull request#7563 from plotly/fix-missing-json-font-attrs
Fix issue causing empty ScatterGL plots when using text elements
2 parentse2abf6e +33c46a4 commitc624d3d

File tree

8 files changed

+40
-49
lines changed

8 files changed

+40
-49
lines changed

‎draftlogs/7563_fix.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix issue causing empty ScatterGL plots when using text elements[#7563](https://github.com/plotly/plotly.js/pull/7563)

‎package-lock.json‎

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
"deep-equal":"^2.2.3",
134134
"ecstatic":"^4.1.4",
135135
"esbuild":"^0.25.5",
136-
"esbuild-plugin-browserify-adapter":"^0.1.4",
137136
"esbuild-plugin-environment":"^0.4.0",
138137
"esbuild-plugin-glsl":"^1.2.2",
139138
"esbuild-plugin-inline-css":"^0.0.1",
@@ -182,4 +181,4 @@
182181
"acorn":"^8.1.1"
183182
}
184183
}
185-
}
184+
}

‎tasks/cibundle.mjs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ var tasks = [];
1919
// Bundle plotly.js
2020
tasks.push(function(done){
2121
_bundle(constants.pathToPlotlyIndex,constants.pathToPlotlyBuild,{
22-
noCompressAttributes:true,
2322
},done)
2423
});
2524

2625
// Bundle plotly.min.js
2726
tasks.push(function(done){
2827
_bundle(constants.pathToPlotlyIndex,constants.pathToPlotlyBuildMin,{
2928
minify:true,
30-
noCompressAttributes:true,
3129
},done)
3230
});
3331

‎tasks/compress_attributes.js‎

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
varthrough=require('through2');
1+
constfs=require('fs');
22

33
/**
4-
*Browserify transform that strips meta attributes out
4+
*ESBuild plugin that stripsoutmeta attributes
55
* of the plotly.js bundles
66
*/
77

@@ -10,47 +10,46 @@ var OPTIONAL_COMMA = ',?';
1010

1111
// one line string with or without trailing comma
1212
functionmakeStringRegex(attr){
13-
returnmakeRegex(
14-
WHITESPACE_BEFORE+attr+': \'.*\''+OPTIONAL_COMMA
15-
);
13+
returnmakeRegex(WHITESPACE_BEFORE+attr+": '.*'"+OPTIONAL_COMMA);
1614
}
1715

1816
// joined array of strings with or without trailing comma
1917
functionmakeJoinedArrayRegex(attr){
20-
returnmakeRegex(
21-
WHITESPACE_BEFORE+attr+': \\[[\\s\\S]*?\\]'+'\\.join\\(.*'+OPTIONAL_COMMA
22-
);
18+
returnmakeRegex(WHITESPACE_BEFORE+attr+': \\[[\\s\\S]*?\\]'+'\\.join\\(.*'+OPTIONAL_COMMA);
2319
}
2420

2521
// array with or without trailing comma
2622
functionmakeArrayRegex(attr){
27-
returnmakeRegex(
28-
WHITESPACE_BEFORE+attr+': \\[[\\s\\S]*?\\]'+OPTIONAL_COMMA
29-
);
23+
returnmakeRegex(WHITESPACE_BEFORE+attr+': \\[[\\s\\S]*?\\]'+OPTIONAL_COMMA);
3024
}
3125

3226
functionmakeRegex(regexStr){
33-
return(
34-
newRegExp(regexStr,'g')
35-
);
27+
returnnewRegExp(regexStr,'g');
3628
}
3729

38-
module.exports=function(){
39-
varallChunks=[];
40-
returnthrough(function(chunk,enc,next){
41-
allChunks.push(chunk);
42-
next();
43-
},function(done){
44-
varstr=Buffer.concat(allChunks).toString('utf-8');
45-
this.push(
46-
str
47-
.replace(makeStringRegex('description'),'')
48-
.replace(makeJoinedArrayRegex('description'),'')
49-
.replace(makeArrayRegex('requiredOpts'),'')
50-
.replace(makeArrayRegex('otherOpts'),'')
51-
.replace(makeStringRegex('role'),'')
52-
.replace(makeStringRegex('hrName'),'')
53-
);
54-
done();
55-
});
30+
constallRegexes=[
31+
makeStringRegex('description'),
32+
makeJoinedArrayRegex('description'),
33+
makeArrayRegex('requiredOpts'),
34+
makeArrayRegex('otherOpts'),
35+
makeStringRegex('role'),
36+
makeStringRegex('hrName')
37+
];
38+
39+
constesbuildPluginStripMeta={
40+
name:'strip-meta-attributes',
41+
setup(build){
42+
constloader='js';
43+
build.onLoad({filter:/\.js$/},async(file)=>({
44+
contents:awaitfs.promises.readFile(file.path,'utf-8').then((c)=>{
45+
allRegexes.forEach((r)=>{
46+
c=c.replace(r,'');
47+
});
48+
returnc;
49+
}),
50+
loader
51+
}));
52+
}
5653
};
54+
55+
module.exports=esbuildPluginStripMeta;

‎tasks/util/bundle_wrapper.mjs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import prependFile from 'prepend-file';
55
import{build}from'esbuild';
66

77
importesbuildConfigfrom'../../esbuild-config.js';
8-
importbrowserifyAdapterfrom'esbuild-plugin-browserify-adapter';
8+
importesbuildPluginStripMetafrom'../../tasks/compress_attributes.js';
99

10-
importtransformfrom'../../tasks/compress_attributes.js';
1110
importcommonfrom'./common.js';
1211

1312
varbasePlugins=esbuildConfig.plugins;
@@ -30,14 +29,14 @@ var basePlugins = esbuildConfig.plugins;
3029
exportdefaultasyncfunction_bundle(pathToIndex,pathToBundle,opts,cb){
3130
opts=opts||{};
3231

33-
varconfig={...esbuildConfig};
32+
varconfig={...esbuildConfig};
3433

3534
config.entryPoints=[pathToIndex];
3635
config.outfile=pathToBundle;
3736
config.minify=!!opts.minify;
3837

3938
if(!opts.noCompressAttributes){
40-
config.plugins=basePlugins.concat([browserifyAdapter(transform)]);
39+
config.plugins=basePlugins.concat([esbuildPluginStripMeta]);
4140
}
4241

4342
if(opts.noPlugins)config.plugins=[];
@@ -51,7 +50,7 @@ export default async function _bundle(pathToIndex, pathToBundle, opts, cb) {
5150

5251
// Until https://github.com/evanw/esbuild/pull/513 is merged
5352
// Thanks to https://github.com/prantlf and https://github.com/birkskyum
54-
functionaddWrapper(path){
53+
functionaddWrapper(path){
5554
prependFile.sync(
5655
path,
5756
[
560 Bytes
Loading

‎test/image/mocks/gl2d_scatter-colorscale-colorbar.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
"marker": {
3737
"size":20
3838
},
39+
"text": ["orange"],
40+
"textposition":"top center",
3941
"type":"scattergl",
40-
"mode":"markers"
42+
"mode":"text+markers"
4143
}
4244
],
4345
"layout": {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp