You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/10/27 14:25:52 UTC

[incubator-echarts-examples] branch next updated: add title, legend, toolbox padding on screenshot.

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git


The following commit(s) were added to refs/heads/next by this push:
     new 04a7507  add title, legend, toolbox padding on screenshot.
04a7507 is described below

commit 04a7507098667be635323f6393970f55a14810cd
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Oct 27 22:25:35 2020 +0800

    add title, legend, toolbox padding on screenshot.
---
 public/data/pictorialBar-forest.js |  1 +
 public/data/pie-borderRadius.js    |  2 +-
 public/screenshot.html             | 17 +++++++++++++++++
 tool/build-example.js              |  3 +--
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/public/data/pictorialBar-forest.js b/public/data/pictorialBar-forest.js
index 2f2f632..8b001a6 100644
--- a/public/data/pictorialBar-forest.js
+++ b/public/data/pictorialBar-forest.js
@@ -2,6 +2,7 @@
 title: Expansion of forest
 category: pictorialBar
 titleCN: 森林的增长
+shotDelay: 5000
 */
 
 var treeDataURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAA2CAYAAADUOvnEAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA5tJREFUeNrcWE1oE0EUnp0kbWyUpCiNYEpCFSpIMdpLRTD15s2ePHixnj00N4/GoyfTg2fbiwdvvagHC1UQ66GQUIQKKgn1UAqSSFua38b3prPJZDs7s5ufKn0w7CaZ2W/fe9/73kyMRqNB3Nrj1zdn4RJ6du9T2u1a2iHYSxjP4d41oOHGQwAIwSUHIyh8/RA8XeiXh0kLGFoaXiTecw/hoTG4ZCSAaFkY0+BpsZceLtiAoV2FkepZSDk5EpppczBvpuuQCqx0YnkYcVVoqQYMyeCG+lFdaGkXeVOFNu4aEBalOBk6sbQrQF7gSdK5JXjuHXu [...]
diff --git a/public/data/pie-borderRadius.js b/public/data/pie-borderRadius.js
index 1218b5a..f16a25c 100644
--- a/public/data/pie-borderRadius.js
+++ b/public/data/pie-borderRadius.js
@@ -21,7 +21,7 @@ option = {
             radius: ['40%', '70%'],
             avoidLabelOverlap: false,
             itemStyle: {
-                borderRadius: 5,
+                borderRadius: 10,
                 borderColor: '#fff',
                 borderWidth: 2
             },
diff --git a/public/screenshot.html b/public/screenshot.html
index 27dc406..23aa3cb 100644
--- a/public/screenshot.html
+++ b/public/screenshot.html
@@ -72,6 +72,20 @@
         return deferred;
     }
 
+    function addComponentPadding(componentOpt) {
+        if (!componentOpt) {
+            return;
+        }
+        if (!(componentOpt instanceof Array)) {
+            componentOpt = [componentOpt];
+        }
+        componentOpt.forEach(function (opt) {
+            if (!opt.padding) {
+                opt.padding = 15;
+            }
+        });
+    }
+
     echarts.registerPreprocessor(function (option) {
         option.animation = false;
         // option.textStyle = {
@@ -90,6 +104,9 @@
                 seriesOpt.animation = false;
             });
         }
+        addComponentPadding(option.title);
+        addComponentPadding(option.legend);
+        addComponentPadding(option.toolbox);
     });
 
     if (params.c) {
diff --git a/tool/build-example.js b/tool/build-example.js
index c37da32..f548824 100644
--- a/tool/build-example.js
+++ b/tool/build-example.js
@@ -122,8 +122,7 @@ async function takeScreenshot(
         console.log(filePath);
         await page.screenshot({
             path: filePathTmp,
-            type: 'png',
-            // quality: 80
+            type: 'png'
         });
         await sharp(filePathTmp).resize(OUTPUT_IMAGE_WIDTH, OUTPUT_IMAGE_WIDTH * DEFAULT_PAGE_RATIO)
             .toFile(filePath);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org