You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2020/11/06 11:19:02 UTC

[incubator-echarts] branch feat-decal updated (5d6fd87 -> 183d961)

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

ovilia pushed a change to branch feat-decal
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.


    from 5d6fd87  feat(decal): support "none" to disable decal
     add 23a809d  ts: add type to graphic component.
     add 98d4e7b  fix: [graphic component] support textContent.
     add 2f5febe  test: fix test of graphic component.
     add ec5bcf4  fix: [graphic component] compat legacy style.
     add a0fd0b7  Merge branch 'next' of github.com:apache/incubator-echarts into next
     add cb5cfdc  chore: add esm bundle #11855
     add bba8146  ts: fix incorrect locale params and fix type check of scales.
     add af508e8  fix: [dataZoom] fix auto axis detection bug brought by 5.0 refactor.
     add 02b39f2  Merge pull request #13497 from apache/next
     add 08c2ff5  fix(line): only bolder when line width in normal state is larger than 0.
     add afc994e  Merge pull request #13501 from apache/fix-line-bold
     add a195480  Merge pull request #13490 from apache/feat-decal
     add 3668e0a  fix(state): fix focus may not be able to reset bug.
     add c2211f0  fix(line): fix symbol still has animation when disabled bug.
     add 21d0a3a  test: fix some outdated recorded interaction
     add f995676  Merge pull request #13506 from apache/fix-test
     add 9ddb182  Merge branch 'release' into timeline-scale
     add 81f9e93  Merge pull request #13507 from apache/timeline-scale
     add 484f9ae  test: fix nth child query in recorder
     add fa71a37  test: add more recorded interactions.
     add a172154  Merge pull request #13510 from apache/add-test-interactions
     add 5cce192  fix(theme): fix deprecated usage.
     add 90e6426  Merge pull request #13523 from apache/fix-theme
     add b4667c8  ts: remove @ts-nocheck for some of the treemap files.
     add f62945c  fix: fix done/aborted in treemap. The bug case is: when click treemap to "drill down", and hover another rect to start state-changeing-animation before the drill down animation finished, some of the done/abort callback may not be called and then all of the "click" disabled (by the implementation of `src/util/animation.ts`.
     add f6e0dec  fix: Make `util/graphic` `updateProps` and `initProps` param `cb` listen "aborted". Because, at present, all of the cb usage are about "remove el", which are needed in both "done" and "aborted". Currently the usage of `cb`: initProps     ParallelView     SankeyView     ThemeRiverView updateProps     TreeView     custom
     add 7d09672  revert the cb on abort.
     add 8d6a3e8  Merge pull request #13522 from apache/fix/treemap-click
     add 4e1e8fc  fix: [decal] (1) move option.decals to option.area.decal.decals. (2) disable series.decals (3) fix decals default option merge.
     add affc391  fix: fix decal visual assignment
     add fd3f74b  fix: [decal] (1) fix sankey decal and enable itemStyle.decal in sankey. (2) add test case for sankey, treemap, sunburst.
     add 59e0ad3  feature: [decal] support decal to custom series.
     add 23d617a  Merge branch 'release' into decal-custom
     add 63fefa0  lint: fix lint.
     add 27061f2  Merge pull request #13521 from apache/decal-custom
     add ca6c742  fix(test): fix some issues in `pie-cornerRadius` test case.
     add 1ea68de  Merge pull request #13525 from apache/fix-test
     add bc56aa6  fix: [graph] circular layout should be able to base on symbolSize.
     add eb157be  Merge pull request #13553 from apache/circular-layout
     add b1e6da5  fix: [parallel] fix that the second category parallel axis can not be selectable.
     add 1f6c7d7  Merge pull request #13554 from apache/fix/parallel-last-category
     new 183d961  feat(decal): symbol support array

The 1 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:
 build/build.js                                   |     28 +-
 build/config.js                                  |      5 +-
 build/release.js                                 |     25 +-
 dist/echarts.js                                  | 142239 +++++++++-----------
 dist/echarts.js.map                              |      2 +-
 package-lock.json                                |   5153 +-
 package.json                                     |      5 +-
 src/chart/custom.ts                              |    111 +-
 src/chart/helper/enableAriaDecalForTree.ts       |      4 +-
 src/chart/line/LineView.ts                       |      5 +-
 src/chart/sankey/SankeySeries.ts                 |     12 -
 src/chart/treemap/TreemapView.ts                 |     24 +-
 src/component/aria.ts                            |      4 +-
 src/component/dataZoom/DataZoomModel.ts          |     11 +-
 src/component/graphic.ts                         |    543 +-
 src/component/timeline/SliderTimelineView.ts     |      2 +-
 src/coord/parallel/AxisModel.ts                  |      5 +-
 src/data/List.ts                                 |      3 +-
 src/echarts.ts                                   |      9 +-
 src/model/Global.ts                              |      7 +
 src/model/Series.ts                              |      9 -
 src/model/globalDefault.ts                       |     72 +-
 src/model/mixin/areaStyle.ts                     |      5 +-
 src/model/mixin/itemStyle.ts                     |      5 +-
 src/model/mixin/lineStyle.ts                     |      5 +-
 src/model/mixin/palette.ts                       |     28 +-
 src/model/referHelper.ts                         |     23 +-
 src/option.ts                                    |      2 +
 src/scale/Interval.ts                            |      4 +-
 src/scale/Ordinal.ts                             |     25 +-
 src/scale/Scale.ts                               |     10 +-
 src/scale/Time.ts                                |     17 +-
 src/theme/dark.ts                                |      6 +-
 src/util/animation.ts                            |    157 +-
 src/util/decal.ts                                |     60 +-
 src/util/layout.ts                               |      2 +-
 src/util/model.ts                                |      4 +-
 src/util/states.ts                               |      5 +-
 src/util/types.ts                                |     15 +-
 src/visual/aria.ts                               |     44 +-
 src/visual/style.ts                              |      3 +
 test/{dataSelect.html => browser-esm.html}       |     65 +-
 test/custom-hexbin.html                          |      8 +-
 test/decal.html                                  |    453 +-
 test/graph.html                                  |     12 +-
 test/graphic-cases.html                          |    202 +
 test/hoverStyle.html                             |      4 +-
 test/parallel-feature.html                       |     54 +-
 test/pie-cornerRadius.html                       |     30 +-
 test/runTest/actions/__meta__.json               |     27 +-
 test/runTest/actions/appendData.json             |      2 +-
 test/runTest/actions/axis-interval2.json         |      2 +-
 test/runTest/actions/brush.json                  |      2 +-
 test/runTest/actions/calendar-month.json         |      2 +-
 test/runTest/actions/clip.json                   |      2 +-
 test/runTest/actions/color-mix-aqi.json          |      2 +-
 test/runTest/actions/connect-dynamic.json        |      2 +-
 test/runTest/actions/connect.json                |      2 +-
 test/runTest/actions/connect2.json               |      2 +-
 test/runTest/actions/custom-hexbin.json          |      2 +-
 test/runTest/actions/dataSelect.json             |      1 +
 test/runTest/actions/dataZoom-action.json        |      2 +-
 test/runTest/actions/dataZoom-axes.json          |      2 +-
 test/runTest/actions/dataZoom-rainfall.json      |      2 +-
 test/runTest/actions/dataZoom-scatter-hv.json    |      2 +-
 test/runTest/actions/dataZoom-toolbox.json       |      2 +-
 test/runTest/actions/decal.json                  |      1 +
 test/runTest/actions/funnel.json                 |      2 +-
 test/runTest/actions/geo-map.json                |      2 +-
 test/runTest/actions/getOption.json              |      2 +-
 test/runTest/actions/heatmap.json                |      2 +-
 test/runTest/actions/homepage3.json              |      2 +-
 test/runTest/actions/hoverFocus.json             |      1 +
 test/runTest/actions/hoverFocus2.json            |      1 +
 test/runTest/actions/hoverStyle.json             |      2 +-
 test/runTest/actions/label-layout.json           |      1 +
 test/runTest/actions/legend.json                 |      2 +-
 test/runTest/actions/line-boldWhenHover.json     |      1 +
 test/runTest/actions/mapWorld.json               |      2 +-
 test/runTest/actions/markArea.json               |      2 +-
 test/runTest/actions/pie-calculable.json         |      2 +-
 test/runTest/actions/pie-label-extreme.json      |      1 +
 test/runTest/actions/scatter-single-axis.json    |      2 +-
 test/runTest/client/client.js                    |      4 +-
 test/runTest/recorder/recorder.js                |     12 +-
 test/runTest/server.js                           |      4 +-
 test/treemap-option.html                         |      5 +-
 test/ut/jest.config.js                           |      4 +-
 test/ut/spec/component/graphic/setOption.test.ts |    535 +-
 test/ut/spec/series/custom.test.ts               |     72 +
 test/visualMap-continuous.html                   |      7 +-
 theme/dark-blue.js                               |      8 +-
 theme/dark-bold.js                               |      8 +-
 theme/dark-digerati.js                           |      8 +-
 theme/dark-fresh-cut.js                          |      8 +-
 theme/dark-mushroom.js                           |      8 +-
 theme/dark.js                                    |      8 +-
 theme/infographic.js                             |      4 +-
 theme/macarons2.js                               |     36 +-
 theme/shine.js                                   |     12 +-
 100 files changed, 68907 insertions(+), 81448 deletions(-)
 copy test/{dataSelect.html => browser-esm.html} (62%)
 create mode 100644 test/graphic-cases.html
 create mode 100644 test/runTest/actions/dataSelect.json
 create mode 100644 test/runTest/actions/decal.json
 create mode 100644 test/runTest/actions/hoverFocus.json
 create mode 100644 test/runTest/actions/hoverFocus2.json
 create mode 100644 test/runTest/actions/label-layout.json
 create mode 100644 test/runTest/actions/line-boldWhenHover.json
 create mode 100644 test/runTest/actions/pie-label-extreme.json
 create mode 100644 test/ut/spec/series/custom.test.ts


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


[incubator-echarts] 01/01: feat(decal): symbol support array

Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch feat-decal
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 183d961b80bbefe6fe488ed6eb75158a9d2bb8d6
Author: Ovilia <zw...@gmail.com>
AuthorDate: Fri Nov 6 19:04:15 2020 +0800

    feat(decal): symbol support array
---
 src/util/decal.ts | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 src/util/types.ts |  2 +-
 test/decal.html   |  3 ++-
 3 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/src/util/decal.ts b/src/util/decal.ts
index b23795a..44091b7 100644
--- a/src/util/decal.ts
+++ b/src/util/decal.ts
@@ -105,6 +105,7 @@ export function createOrUpdatePatternFromDecal(
 
         const dashArrayX = normalizeDashArrayX(decalOpt.dashArrayX);
         const dashArrayY = normalizeDashArrayY(decalOpt.dashArrayY);
+        const symbolArray = normalizeSymbolArray(decalOpt.symbol);
         const lineBlockLengthsX = getLineBlockLengthX(dashArrayX);
         const lineBlockLengthY = getLineBlockLengthY(dashArrayY);
 
@@ -152,7 +153,14 @@ export function createOrUpdatePatternFromDecal(
             for (let i = 0, xlen = lineBlockLengthsX.length; i < xlen; ++i) {
                 width = getLeastCommonMultiple(width, lineBlockLengthsX[i]);
             }
-            const height = lineBlockLengthY * lineBlockLengthsX.length;
+
+            let symbolRepeats = 1;
+            for (let i = 0, xlen = symbolArray.length; i < xlen; ++i) {
+                symbolRepeats = getLeastCommonMultiple(symbolRepeats, symbolArray[i].length);
+            }
+            width *= symbolRepeats;
+
+            const height = lineBlockLengthY * lineBlockLengthsX.length * symbolArray.length;
 
             if (__DEV__) {
                 const warn = (attrName: string) => {
@@ -193,11 +201,14 @@ export function createOrUpdatePatternFromDecal(
 
             let y = -lineBlockLengthY;
             let yId = 0;
+            let yIdTotal = 0;
             let xId0 = 0;
             while (y < pSize.height) {
                 if (yId % 2 === 0) {
+                    const symbolYId = (yIdTotal / 2) % symbolArray.length;
                     let x = 0;
                     let xId1 = 0;
+                    let xId1Total = 0;
                     while (x < pSize.width * 2) {
                         let xSum = 0;
                         for (let i = 0; i < dashArrayX[xId0].length; ++i) {
@@ -215,10 +226,13 @@ export function createOrUpdatePatternFromDecal(
                             const top = y + dashArrayY[yId] * size;
                             const width = dashArrayX[xId0][xId1] * decalOpt.symbolSize;
                             const height = dashArrayY[yId] * decalOpt.symbolSize;
-                            brushSymbol(left, top, width, height);
+                            const symbolXId = (xId1Total / 2) % symbolArray[symbolYId].length;
+
+                            brushSymbol(left, top, width, height, symbolArray[symbolYId][symbolXId]);
                         }
 
                         x += dashArrayX[xId0][xId1];
+                        ++xId1Total;
                         ++xId1;
                         if (xId1 === dashArrayX[xId0].length) {
                             xId1 = 0;
@@ -232,16 +246,17 @@ export function createOrUpdatePatternFromDecal(
                 }
                 y += dashArrayY[yId];
 
+                ++yIdTotal;
                 ++yId;
                 if (yId === dashArrayY.length) {
                     yId = 0;
                 }
             }
 
-            function brushSymbol(x: number, y: number, width: number, height: number) {
+            function brushSymbol(x: number, y: number, width: number, height: number, symbolType: string) {
                 const scale = isSVG ? 1 : dpr;
                 const symbol = createSymbol(
-                    decalOpt.symbol,
+                    symbolType,
                     x * scale,
                     y * scale,
                     width * scale,
@@ -262,6 +277,43 @@ export function createOrUpdatePatternFromDecal(
 }
 
 /**
+ * Convert symbol array into normalized array
+ *
+ * @param {string | (string | string[])[]} symbol symbol input
+ * @return {string[][]} normolized symbol array
+ */
+function normalizeSymbolArray(symbol: string | (string | string[])[]): string[][] {
+    if (!symbol || (symbol as string[]).length === 0) {
+        return [['rect']];
+    }
+    if (typeof symbol === 'string') {
+        return [[symbol]];
+    }
+
+    let isAllString = true;
+    for (let i = 0; i < symbol.length; ++i) {
+        if (typeof symbol[i] !== 'string') {
+            isAllString = false;
+            break;
+        }
+    }
+    if (isAllString) {
+        return normalizeSymbolArray([symbol as string[]]);
+    }
+
+    const result: string[][] = [];
+    for (let i = 0; i < symbol.length; ++i) {
+        if (typeof symbol[i] === 'string') {
+            result.push([symbol[i] as string]);
+        }
+        else {
+            result.push(symbol[i] as string[]);
+        }
+    }
+    return result;
+}
+
+/**
  * Convert dash input into dashArray
  *
  * @param {DecalDashArrayX} dash dash input
diff --git a/src/util/types.ts b/src/util/types.ts
index 47fa493..892cde2 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -662,7 +662,7 @@ export type DecalDashArrayX = number | (number | number[])[];
 export type DecalDashArrayY = number | number[];
 export interface DecalObject {
     // 'image', 'triangle', 'diamond', 'pin', 'arrow', 'line', 'rect', 'roundRect', 'square', 'circle'
-    symbol?: string
+    symbol?: string | (string | string[])
 
     // size relative to the dash bounding box; valued from 0 to 1
     symbolSize?: number
diff --git a/test/decal.html b/test/decal.html
index efa248a..0c7ab5b 100644
--- a/test/decal.html
+++ b/test/decal.html
@@ -210,7 +210,8 @@ under the License.
             var pieData = [];
             var itemStyle = {
                 decal: {
-                    color: 'blue'
+                    color: 'blue',
+                    symbol: [['rect', 'circle', 'triangle'], ['circle', 'none']]
                 }
             };
             for (var i = 0; i < 6; ++i) {


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