You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/09/28 06:08:58 UTC

[incubator-echarts] branch custom-morph2 updated: enhance: tweak transform name.

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

sushuang pushed a commit to branch custom-morph2
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/custom-morph2 by this push:
     new 24a22eb  enhance: tweak transform name.
24a22eb is described below

commit 24a22eb1c21818c865402af910723bb5857dc20e
Author: 100pah <su...@gmail.com>
AuthorDate: Mon Sep 28 14:05:58 2020 +0800

    enhance: tweak transform name.
---
 src/component/transform/filterTransform.ts    |  2 +-
 src/component/transform/sortTransform.ts      |  2 +-
 test/custom-shape-morphing2.html              | 43 +++++++++++++++++++++++----
 test/custom-shape-morphing3.html              | 31 ++++++++++++-------
 test/lib/myTransform/{identifier.js => id.js} |  6 ++--
 5 files changed, 62 insertions(+), 22 deletions(-)

diff --git a/src/component/transform/filterTransform.ts b/src/component/transform/filterTransform.ts
index cb47cc6..d674f54 100644
--- a/src/component/transform/filterTransform.ts
+++ b/src/component/transform/filterTransform.ts
@@ -34,7 +34,7 @@ export const filterTransform: ExternalDataTransform<FilterTransformOption> = {
     type: 'echarts:filter',
 
     // PEDING: enhance to filter by index rather than create new data
-    transform: function transform(params) {
+    transform: function (params) {
         // [Caveat] Fail-Fast:
         // Do not return the whole dataset unless user config indicate it explicitly.
         // For example, if no condition specified by mistake, return an empty result
diff --git a/src/component/transform/sortTransform.ts b/src/component/transform/sortTransform.ts
index 9d26944..a97382b 100644
--- a/src/component/transform/sortTransform.ts
+++ b/src/component/transform/sortTransform.ts
@@ -76,7 +76,7 @@ export const sortTransform: ExternalDataTransform<SortTransformOption> = {
 
     type: 'echarts:sort',
 
-    transform: function transform(params) {
+    transform: function (params) {
         const upstream = params.upstream;
         const config = params.config;
         let errMsg = '';
diff --git a/test/custom-shape-morphing2.html b/test/custom-shape-morphing2.html
index 5600088..aea1ebf 100644
--- a/test/custom-shape-morphing2.html
+++ b/test/custom-shape-morphing2.html
@@ -165,18 +165,41 @@ under the License.
                     tooltip: {}
                 };
 
+
+                var AXIS_STYLE = {
+                    splitLine: {
+                        lineStyle: {
+                            color: '#333'
+                        }
+                    },
+                    axisLine: {
+                        lineStyle: {
+                            color: '#777'
+                        }
+                    },
+                    axisLabel: {
+                        color: '#999',
+                        fontSize: 20,
+                        fontFamily: 'Lato'
+                    }
+                };
+                var BG_COLOR = '#000';
+
                 var optionCreators = {
 
                     'Scatter_ATA_STE': function (datasetId) {
                         return {
+                            backgroundColor: BG_COLOR,
                             grid: {
                                 containLabel: true
                             },
                             xAxis: {
-                                name: 'STE'
+                                name: 'STE',
+                                ...AXIS_STYLE
                             },
                             yAxis: {
-                                name: 'ATA'
+                                name: 'ATA',
+                                ...AXIS_STYLE
                             },
                             dataZoom: [{
                                 type: 'slider',
@@ -212,7 +235,8 @@ under the License.
                                             fill: CONTENT_COLOR,
                                             // fill: PIE_COLORS[clusterIndex],
                                             stroke: '#555',
-                                            lineWidth: 1
+                                            // lineWidth: 1
+                                            lineWidth: 0
                                         },
                                         transition: ['shape', 'style']
                                     };
@@ -223,13 +247,16 @@ under the License.
 
                     'Bar_mSum_ATA': function (datasetId) {
                         return {
+                            backgroundColor: BG_COLOR,
                             grid: {
                                 containLabel: true
                             },
                             xAxis: {
-                                type: 'category'
+                                type: 'category',
+                                ...AXIS_STYLE
                             },
                             yAxis: {
+                                ...AXIS_STYLE
                             },
                             dataZoom: [{
                                 type: 'slider',
@@ -276,6 +303,7 @@ under the License.
 
                     'Pie_mSum_ATA': function (datasetId) {
                         return {
+                            backgroundColor: BG_COLOR,
                             series: {
                                 type: 'custom',
                                 coordinateSystem: 'none',
@@ -337,14 +365,17 @@ under the License.
 
                     'Scatter_ATA_STE_Cluster_Center': function (datasetId) {
                         return {
+                            backgroundColor: BG_COLOR,
                             grid: {
                                 containLabel: true
                             },
                             xAxis: {
-                                name: 'STE'
+                                name: 'STE',
+                                ...AXIS_STYLE
                             },
                             yAxis: {
-                                name: 'ATA'
+                                name: 'ATA',
+                                ...AXIS_STYLE
                             },
                             dataZoom: [{
                                 type: 'slider',
diff --git a/test/custom-shape-morphing3.html b/test/custom-shape-morphing3.html
index b416ae3..1e0cc75 100644
--- a/test/custom-shape-morphing3.html
+++ b/test/custom-shape-morphing3.html
@@ -28,7 +28,7 @@ under the License.
         <script src="../dist/echarts.js"></script>
         <script src="lib/testHelper.js"></script>
         <script src="lib/myTransform/aggregate.js"></script>
-        <script src="lib/myTransform/identifier.js"></script>
+        <script src="lib/myTransform/id.js"></script>
         <script src="lib/transitionPlayer.js"></script>
         <link rel="stylesheet" href="lib/reset.css" />
     </head>
@@ -46,7 +46,7 @@ under the License.
             $.get('data/life-expectancy-table.json', function (rawData) {
 
                 echarts.registerTransform(window.myTransform.aggregate);
-                echarts.registerTransform(window.myTransform.identifier);
+                echarts.registerTransform(window.myTransform.id);
 
                 const COLORS = [
                     '#37A2DA', '#e06343', '#37a354', '#b55dba', '#b5bd48', '#8378EA', '#96BFFF'
@@ -69,13 +69,19 @@ under the License.
                         source: rawData
                     }, {
                         id: 'IdRawData',
-                        transform: {
-                            type: 'myTransform:identifier',
+                        fromDatasetId: 'RawData',
+                        transform: [{
+                            type: 'filter',
+                            config: {
+                                dimension: 'Year', gte: 1950
+                            }
+                        }, {
+                            type: 'myTransform:id',
                             config: {
                                 dimensionIndex: ID_RAW_DATA_DIMENSIONS.indexOf('Id'),
                                 dimensionName: 'Id'
                             }
-                        }
+                        }]
                     }, {
                         id: 'GermanyData',
                         fromDatasetId: 'IdRawData',
@@ -117,12 +123,12 @@ under the License.
                                     var width = api.size([1, 0])[0] * 0.9;
                                     return {
                                         type: 'rect',
+                                        transition: ['shape', 'style'],
                                         shape: {
                                             x: basePos[0],
                                             y: basePos[1],
                                             width: width,
-                                            height: valPos[1] - basePos[1],
-                                            transition: ['x', 'y', 'width', 'height']
+                                            height: valPos[1] - basePos[1]
                                         },
                                         style: {
                                             fill: CONTENT_COLOR
@@ -139,7 +145,7 @@ under the License.
                                 type: 'category'
                             },
                             yAxis: {
-                                name: 'Income',
+                                name: 'Population',
                                 nameGap: 25,
                                 nameTextStyle: {
                                     fontSize: 25
@@ -159,12 +165,12 @@ under the License.
                                     var width = api.size([1, 0])[0] * 0.9;
                                     return {
                                         type: 'rect',
+                                        transition: ['shape', 'style'],
                                         shape: {
                                             x: basePos[0],
                                             y: basePos[1],
                                             width: width,
-                                            height: valPos[1] - basePos[1],
-                                            transition: ['x', 'y', 'width', 'height']
+                                            height: valPos[1] - basePos[1]
                                         },
                                         style: {
                                             fill: CONTENT_COLOR
@@ -173,7 +179,10 @@ under the License.
                                 }
                             }
                         };
-                    }
+                    },
+
+                    // 'Country_A_Year_Population_Bar': function (datasetId) {
+                    // }
 
                 };
 
diff --git a/test/lib/myTransform/identifier.js b/test/lib/myTransform/id.js
similarity index 95%
rename from test/lib/myTransform/identifier.js
rename to test/lib/myTransform/id.js
index 8ff2590..4352e08 100644
--- a/test/lib/myTransform/identifier.js
+++ b/test/lib/myTransform/id.js
@@ -32,7 +32,7 @@
      *     ]
      * }, {
      *     transform: {
-     *         type: 'my:identifier',
+     *         type: 'my:id',
      *         config: {
      *             dimensionIndex: 4,
      *             dimensionName: 'ID'
@@ -50,7 +50,7 @@
      */
     var transform = {
 
-        type: 'myTransform:identifier',
+        type: 'myTransform:id',
 
         /**
          * @param params.config.dimensionIndex DimensionIndex
@@ -80,7 +80,7 @@
     };
 
     var myTransform = exports.myTransform = exports.myTransform || {};
-    myTransform.identifier = transform;
+    myTransform.id = transform;
 
 })(this);
 


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