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 2018/04/21 17:51:13 UTC
[incubator-echarts] branch master updated: Make brushed elements
higher than normal elements on z,
avoiding them be overlapped by normal elements.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/master by this push:
new 39e7ad1 Make brushed elements higher than normal elements on z, avoiding them be overlapped by normal elements.
39e7ad1 is described below
commit 39e7ad1ac583ea4918087bc758c3632f6a8af1b3
Author: sushuang <su...@gmail.com>
AuthorDate: Sun Apr 22 01:50:52 2018 +0800
Make brushed elements higher than normal elements on z, avoiding them be overlapped by normal elements.
---
src/chart/helper/Symbol.js | 13 ++++++
src/component/brush/BrushModel.js | 8 +++-
src/visual/VisualMapping.js | 10 +++++
test/brush3.html | 92 +++++++++++++++++++++++++++++++++++++++
4 files changed, 122 insertions(+), 1 deletion(-)
diff --git a/src/chart/helper/Symbol.js b/src/chart/helper/Symbol.js
index eccae51..8ec0ba3 100644
--- a/src/chart/helper/Symbol.js
+++ b/src/chart/helper/Symbol.js
@@ -271,6 +271,19 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
elStyle.opacity = opacity;
}
+ var liftZ = data.getItemVisual(idx, 'liftZ');
+ var z2Origin = symbolPath.__z2Origin;
+ if (liftZ != null) {
+ if (z2Origin == null) {
+ symbolPath.__z2Origin = symbolPath.z2;
+ symbolPath.z2 += liftZ;
+ }
+ }
+ else if (z2Origin != null) {
+ symbolPath.z2 = z2Origin;
+ symbolPath.__z2Origin = null;
+ }
+
var useNameLabel = seriesScope && seriesScope.useNameLabel;
graphic.setLabelStyle(
diff --git a/src/component/brush/BrushModel.js b/src/component/brush/BrushModel.js
index 273e1a4..faf64b8 100644
--- a/src/component/brush/BrushModel.js
+++ b/src/component/brush/BrushModel.js
@@ -82,9 +82,15 @@ var BrushModel = echarts.extendComponentModel({
thisOption, newOption, ['inBrush', 'outOfBrush']
);
- thisOption.inBrush = thisOption.inBrush || {};
+ var inBrush = thisOption.inBrush = thisOption.inBrush || {};
// Always give default visual, consider setOption at the second time.
thisOption.outOfBrush = thisOption.outOfBrush || {color: DEFAULT_OUT_OF_BRUSH_COLOR};
+
+ if (!inBrush.hasOwnProperty('liftZ')) {
+ // Bigger than the highlight z lift, otherwise it will
+ // be effected by the highlight z when brush.
+ inBrush.liftZ = 5;
+ }
},
/**
diff --git a/src/visual/VisualMapping.js b/src/visual/VisualMapping.js
index 56f7652..c25a455 100644
--- a/src/visual/VisualMapping.js
+++ b/src/visual/VisualMapping.js
@@ -188,6 +188,16 @@ var visualHandlers = VisualMapping.visualHandlers = {
_doMap: makeDoMap([0, 1])
},
+ liftZ: {
+ applyVisual: makeApplyVisual('liftZ'),
+ _doMap: {
+ linear: doMapFixed,
+ category: doMapFixed,
+ piecewise: doMapFixed,
+ fixed: doMapFixed
+ }
+ },
+
symbol: {
applyVisual: function (value, getter, setter) {
var symbolCfg = this.mapValueToVisual(value);
diff --git a/test/brush3.html b/test/brush3.html
new file mode 100644
index 0000000..da59f65
--- /dev/null
+++ b/test/brush3.html
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <script src="lib/esl.js"></script>
+ <script src="lib/config.js"></script>
+ <script src="lib/jquery.min.js"></script>
+ <script src="lib/facePrint.js"></script>
+ <script src="lib/testHelper.js"></script>
+ <link rel="stylesheet" href="lib/reset.css" />
+ </head>
+ <body>
+ <style>
+ .test-title {
+ background: #146402;
+ color: #fff;
+ }
+ </style>
+
+
+ <div id="main0"></div>
+
+
+ <script>
+
+ require([
+ 'echarts'
+ ], function (echarts) {
+
+ var data = [];
+ for (var i = 0; i < 500; i++) {
+ data.push([
+ Math.random() * 10,
+ Math.random() * 10
+ ]);
+ }
+
+ var option = {
+ toolbox: {
+ feature: {
+ brush: {
+ type: ['polygon', 'rect', 'lineX', 'lineY', 'keep', 'clear']
+ }
+ }
+ },
+ brush: {
+ xAxisIndex: 'all',
+ brushLink: 'all'
+ },
+ grid: {
+ width: 300,
+ height: 200
+ },
+ xAxis: {
+ min: 0,
+ max: 10
+ },
+ yAxis: {
+ min: 0,
+ max: 10
+ },
+ series: {
+ type: 'scatter',
+ symbolSize: 20,
+ data: data
+ }
+ };
+
+ var chart = testHelper.create(echarts, 'main0', {
+ title: 'The highlight symbol should on the top (not be overlapped)',
+ option: option,
+ info: {
+ brush: option.brush
+ }
+ });
+
+ chart && chart.dispatchAction({
+ type: 'brush',
+ areas: [
+ {
+ gridIndex: 0,
+ brushType: 'polygon',
+ coordRange: [[3, 2], [7, 2], [7, 6], [4, 3]]
+ }
+ ]
+ });
+ });
+
+ </script>
+ </body>
+</html>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
sushuang@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org