You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/07/30 15:30:34 UTC
[echarts-examples] branch gh-pages updated (22b6ba8a -> 2f1c1261)
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a change to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
from 22b6ba8a Merge pull request #50 from apache/dependabot/npm_and_yarn/sharp-0.30.5
new e795f44b fix(editor): fix z-index of the debug dirty rect.
new 4874b354 chore(editor): tweak tooltips of some buttons
new e1d190cb chore(tool): tweak bmap version in screenshot tool
new 2f1c1261 feat(editor): import extensions automatically & consider chart initial option
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
common/buildCode.js | 94 ++++++++++++++++++++++++++++++++++++++++---
package.json | 2 +-
src/common/i18n.js | 10 +++--
src/dep/showDebugDirtyRect.js | 2 +-
src/editor/Editor.vue | 5 ++-
src/editor/Preview.vue | 20 +++++++--
tool/screenshot.html | 2 +-
7 files changed, 118 insertions(+), 17 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts-examples] 02/04: chore(editor): tweak tooltips of some buttons
Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit 4874b354f6d6e8a22ee4597240641a37678b90fd
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sat Jul 30 23:05:21 2022 +0800
chore(editor): tweak tooltips of some buttons
---
package.json | 2 +-
src/common/i18n.js | 10 +++++++---
src/editor/Preview.vue | 20 ++++++++++++++++----
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/package.json b/package.json
index 1101cd3b..ffcf5e51 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,7 @@
"sassjs-loader": "^2.0.0",
"seedrandom": "^3.0.5",
"sharp": "^0.30.5",
- "shelljs": "^0.8.4",
+ "shelljs": "^0.8.5",
"style-loader": "^2.0.0",
"typescript": "^4.1.3",
"vue": "2.6.14",
diff --git a/src/common/i18n.js b/src/common/i18n.js
index 841e79b1..ec22555f 100644
--- a/src/common/i18n.js
+++ b/src/common/i18n.js
@@ -22,6 +22,7 @@ export default {
download: 'Download',
screenshot: 'Screenshot',
+ downloadSourceTip: 'THIS EXAMPLE WAS DOWNLOADED FROM',
edit: 'Edit',
@@ -46,8 +47,9 @@ export default {
share: {
title: 'Share',
success: 'Sharable URL has been copied to your clipboard',
- hint: 'Please be aware that this chart is not an official demo of Apache ECharts but is made by user-generated code.'
- },
+ hint: 'Please be aware that this chart is not an official demo of Apache ECharts but is made by user-generated code.',
+ tooltip: 'Create a sharable link for your code ✨'
+ }
},
chartTypes: {
@@ -114,6 +116,7 @@ export default {
renderer: '渲染模式',
download: '下载示例',
screenshot: '截图',
+ downloadSourceTip: '此示例下载自',
edit: '编辑',
monacoMode: '开启类型检查',
@@ -139,7 +142,8 @@ export default {
share: {
title: '分享',
success: '分享链接已复制到剪贴板',
- hint: '请注意,该图表不是 Apache ECharts 官方示例,而是由用户代码生成的。请注意鉴别其内容。'
+ hint: '请注意,该图表不是 Apache ECharts 官方示例,而是由用户代码生成的。请注意鉴别其内容。',
+ tooltip: '为当前代码创建一个可分享的链接 ✨'
}
},
diff --git a/src/editor/Preview.vue b/src/editor/Preview.vue
index 9c0601c5..fafe9b57 100644
--- a/src/editor/Preview.vue
+++ b/src/editor/Preview.vue
@@ -102,7 +102,12 @@
<div id="preview-status">
<div class="left-buttons">
<template v-if="inEditor && !shared.isMobile">
- <el-button icon="el-icon-download" size="mini" @click="download">
+ <el-button
+ icon="el-icon-download"
+ size="mini"
+ @click="download"
+ :title="$t('editor.download') + ' (HTML)'"
+ >
{{ $t('editor.download') }}
</el-button>
<el-button
@@ -112,7 +117,12 @@
>
{{ $t('editor.screenshot') }}
</el-button>
- <el-button @click="share" icon="el-icon-share" size="mini">
+ <el-button
+ @click="share"
+ icon="el-icon-share"
+ size="mini"
+ :title="$t('editor.share.tooltip')"
+ >
{{ $t('editor.share.title') }}
</el-button>
</template>
@@ -406,8 +416,10 @@ export default {
download() {
const url = this.getSharableURL(true);
const isShared = store.isSharedCode || url.searchParams.has('code');
- const headers = [`\tTHIS EXAMPLE WAS DOWNLOADED FROM ${url.toString()}`];
- isShared && headers.push('\t' + this.$t('editor.share.hint'));
+ const headers = [
+ `\t${this.$t('editor.downloadSourceTip')} ${url.toString()}`
+ ];
+ isShared && headers.push('\t⚠ ' + this.$t('editor.share.hint'));
download(headers.join('\n'));
},
screenshot() {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts-examples] 04/04: feat(editor): import extensions automatically & consider chart initial option
Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit 2f1c12618f16992c7aefc912054acea190560c15
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sat Jul 30 23:26:51 2022 +0800
feat(editor): import extensions automatically & consider chart initial option
---
common/buildCode.js | 94 +++++++++++++++++++++++++++++++++++++++++++++++----
src/editor/Editor.vue | 5 ++-
2 files changed, 92 insertions(+), 7 deletions(-)
diff --git a/common/buildCode.js b/common/buildCode.js
index f484c78c..852113bc 100644
--- a/common/buildCode.js
+++ b/common/buildCode.js
@@ -81,6 +81,12 @@ const CHARTS_GL_MAP = {
const FEATURES = ['UniversalTransition', 'LabelLayout'];
+const EXTENSIONS_MAP = {
+ bmap: 'bmap/bmap'
+ // PENDING: There seem no examples that use dataTool
+ // dataTool: 'dataTool'
+};
+
const COMPONENTS_MAP_REVERSE = {};
const CHARTS_MAP_REVERSE = {};
const CHARTS_GL_MAP_REVERSE = {};
@@ -159,6 +165,9 @@ module.exports.collectDeps = function collectDeps(option) {
if (COMPONENTS_GL_MAP[key]) {
deps.push(COMPONENTS_GL_MAP[key]);
}
+ if (EXTENSIONS_MAP[key]) {
+ deps.push(key);
+ }
});
let series = option.series;
@@ -177,6 +186,9 @@ module.exports.collectDeps = function collectDeps(option) {
// Needs geo component when using map
deps.push(COMPONENTS_MAP.geo);
}
+ if (seriesOpt.coordinateSystem === 'bmap') {
+ deps.push('bmap');
+ }
MARKERS.forEach((markerType) => {
if (seriesOpt[markerType]) {
deps.push(COMPONENTS_MAP[markerType]);
@@ -210,6 +222,7 @@ function buildMinimalBundleCode(deps, includeType) {
const componentsGLImports = [];
const featuresImports = [];
const renderersImports = [];
+ const extensionImports = [];
deps.forEach(function (dep) {
if (dep.endsWith('Renderer')) {
renderersImports.push(dep);
@@ -233,6 +246,8 @@ function buildMinimalBundleCode(deps, includeType) {
componentsGLImports.push(dep);
} else if (FEATURES.includes(dep)) {
featuresImports.push(dep);
+ } else if (EXTENSIONS_MAP[dep]) {
+ extensionImports.push(dep);
}
});
@@ -272,12 +287,15 @@ type EChartsOption = echarts.ComposeOption<
import {${getImportsPartCode(item[0])}
} from '${item[1]}';
`.trim()
- )
- .join('\n');
+ );
+
+ getExtensionDeps(extensionImports, includeType).forEach((ext) => {
+ importsCodes.push(`import '${ext}';`);
+ });
return (
`import * as echarts from 'echarts/core';
-${importsCodes}
+${importsCodes.join('\n')}
echarts.use(
[${allImports.filter((a) => !a.endsWith('Option')).join(', ')}]
@@ -305,6 +323,8 @@ function buildLegacyMinimalBundleCode(deps, isESM) {
modules.push(
`echarts-gl/lib/component/${COMPONENTS_GL_MAP_REVERSE[dep]}`
);
+ } else if (EXTENSIONS_MAP[dep]) {
+ modules.push(getExtensionDeps([dep], false)[0]);
}
});
@@ -331,6 +351,24 @@ function hasGLInDeps(deps) {
);
}
+function getExtensionDeps(deps, ts) {
+ return deps
+ .filter((dep) => EXTENSIONS_MAP[dep])
+ .map(
+ (dep) => `echarts/extension${ts ? '-src' : ''}/${EXTENSIONS_MAP[dep]}`
+ );
+}
+
+function getBMapTip(isZHLang) {
+ return `// ${
+ isZHLang
+ ? '请确保在引入百度地图扩展之前已经引入百度地图 JS API 脚本并成功加载'
+ : 'Please ensure BaiduMap script has been loaded before importing bmap extension'
+ }\n// https://api.map.baidu.com/api?v=3.0&ak=${
+ isZHLang ? '你申请的AK' : 'YOUR_APP_KEY'
+ }\n`;
+}
+
module.buildLegacyMinimalBundleCode = buildLegacyMinimalBundleCode;
module.exports.buildExampleCode = function (
@@ -350,11 +388,15 @@ module.exports.buildExampleCode = function (
ts,
// Theme
theme,
+ renderer,
+ useDirtyRect,
ROOT_PATH,
// Other imports code code string
// For example
// `import 'echarts-liquidfill'`
- extraImports
+ extraImports,
+ // language
+ isZHLang
}
) {
// if (minimal && !legacy) {
@@ -384,14 +426,27 @@ ${
: ''
}
`;
+
const IMPORT_CODE = [
!minimal
? esm
? `import * as echarts from 'echarts';${
hasGLInDeps(deps) ? `\nimport 'echarts-gl';` : ''
+ }${
+ getExtensionDeps(deps, ts).length
+ ? `\n${getExtensionDeps(deps, ts)
+ .map((dep) => `import '${dep}';`)
+ .join('\n')}`
+ : ''
}`
: `var echarts = require('echarts');${
hasGLInDeps(deps) ? `\nrequire('echarts-gl');` : ''
+ }${
+ getExtensionDeps(deps, ts).length
+ ? `\n${getExtensionDeps(deps, ts)
+ .map((dep) => `require('${dep}');`)
+ .join('\n')}`
+ : ''
}`
: legacy
? buildLegacyMinimalBundleCode(deps, esm)
@@ -414,14 +469,41 @@ ${
.filter((a) => !!a)
.join('\n');
- const PREPARE_CODE = [IMPORT_CODE.trim(), DEP_CODE.trim(), ENV_CODE.trim()]
+ const bmapExtDep = getExtensionDeps(['bmap'], ts)[0];
+ const PREPARE_CODE = [
+ IMPORT_CODE.trim().replace(
+ new RegExp(`((?:import|require)\\s*\\(?'${bmapExtDep}'\\)?;)`),
+ getBMapTip(isZHLang) + '$1'
+ ),
+ DEP_CODE.trim(),
+ ENV_CODE.trim()
+ ]
.filter((a) => !!a)
.join('\n\n');
+ const hasTheme = !!theme;
+ const hasRenderer = renderer !== 'canvas';
+ const hasUseDirtyRect = useDirtyRect && !hasRenderer;
+ const hasOption = hasRenderer || hasUseDirtyRect;
+
return `${PREPARE_CODE}
var chartDom = document.getElementById('main')${ts ? '!' : ''};
-var myChart = echarts.init(chartDom${theme ? `, '${theme}'` : ''});
+var myChart = echarts.init(chartDom${
+ hasTheme ? `, '${theme}'` : hasOption ? ', null' : ''
+ }${
+ hasOption
+ ? `, {
+${[
+ hasRenderer && `renderer: '${renderer}'`,
+ hasUseDirtyRect && 'useDirtyRect: true'
+]
+ .filter(Boolean)
+ .map((t) => ' ' + t)
+ .join(',\n')}
+}`
+ : ''
+ });
var option${ts ? ': EChartsOption' : ''};
${jsCode.trim()}
diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue
index c729dd63..7421618d 100644
--- a/src/editor/Editor.vue
+++ b/src/editor/Editor.vue
@@ -319,7 +319,10 @@ export default {
esm: this.fullCodeConfig.esm,
// legacy: true,
theme: store.darkMode ? 'dark' : '',
- ROOT_PATH: store.cdnRoot
+ renderer: store.renderer,
+ useDirtyRect: store.useDirtyRect,
+ ROOT_PATH: store.cdnRoot,
+ isZHLang: this.$i18n.locale === 'zh'
});
// Format
formatCode(this.fullCode).then((code) => {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts-examples] 01/04: fix(editor): fix z-index of the debug dirty rect.
Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit e795f44b93d5e0f84714a6a99d16b5fac0f56f6c
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sat Jul 30 22:58:30 2022 +0800
fix(editor): fix z-index of the debug dirty rect.
---
src/dep/showDebugDirtyRect.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dep/showDebugDirtyRect.js b/src/dep/showDebugDirtyRect.js
index 34ece51c..df71e224 100644
--- a/src/dep/showDebugDirtyRect.js
+++ b/src/dep/showDebugDirtyRect.js
@@ -50,7 +50,7 @@ function showDebugDirtyRect(zr, opts) {
const debugViewRoot = document.createElement('div');
debugViewRoot.className = 'ec-debug-dirty-rect-container';
debugViewRoot.style.cssText =
- 'position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;';
+ 'position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:9999999;';
const debugRects = [];
const dom = zr.dom;
dom.appendChild(debugViewRoot);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts-examples] 03/04: chore(tool): tweak bmap version in screenshot tool
Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit e1d190cb1a42ae1d96b57655d2319389f8befbd0
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sat Jul 30 23:16:07 2022 +0800
chore(tool): tweak bmap version in screenshot tool
---
tool/screenshot.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tool/screenshot.html b/tool/screenshot.html
index 271e8cc2..152ac890 100644
--- a/tool/screenshot.html
+++ b/tool/screenshot.html
@@ -40,7 +40,7 @@
></script>
<script
type="text/javascript"
- src="http://api.map.baidu.com/api?v=2.0&ak=KOmVjPVUAey1G2E8zNhPiuQ6QiEmAwZu"
+ src="http://api.map.baidu.com/api?v=3.0&ak=KOmVjPVUAey1G2E8zNhPiuQ6QiEmAwZu"
></script>
<script
type="text/javascript"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org