This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/next by this push:
new 398f619 feat: enable label to be silent.
398f619 is described below
commit 398f6190c1ee10ad332cfb13e106bac2877703ca
Author: 100pah <[email protected]>
AuthorDate: Tue Apr 28 01:27:36 2020 +0800
feat: enable label to be silent.
---
src/util/graphic.ts | 5 +++++
src/util/types.ts | 1 +
test/hoverStyle.html | 15 ++++++++++-----
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/util/graphic.ts b/src/util/graphic.ts
index 57ec7a4..01b9b3f 100644
--- a/src/util/graphic.ts
+++ b/src/util/graphic.ts
@@ -715,6 +715,11 @@ export function setLabelStyle<LDI>(
);
}
+ // PENDING: if there is many requirements that emphasis position
+ // need to be different from normal position, we might consider
+ // auto slient is those cases.
+ richText.silent = !!normalModel.getShallow('silent');
+
normalStyle.text = normalStyleText;
emphasisState.style.text = emphasisStyleText;
diff --git a/src/util/types.ts b/src/util/types.ts
index 0503ec8..07f773e 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -759,6 +759,7 @@ export interface LabelOption extends TextCommonOption {
offset?: number[]
overflow?: TextStyleProps['overflow']
+ silent?: boolean
// TODO: TYPE not all label support formatter
// formatter?: string | ((params: CallbackDataParams) => string)
diff --git a/test/hoverStyle.html b/test/hoverStyle.html
index 91d6262..4fd2b48 100644
--- a/test/hoverStyle.html
+++ b/test/hoverStyle.html
@@ -392,7 +392,8 @@ under the License.
symbolSize: 40,
label: {
show: true,
- formatter: 'label inside\n{c}'
+ formatter: 'label inside\n{c}',
+ silent: true
},
emphasis: {
label: {
@@ -667,8 +668,10 @@ under the License.
series: [{
type: 'scatter',
symbolSize: 30,
+ // silent: true,
label: {
- show: true
+ show: true,
+ silent: true,
},
itemStyle: {
color: 'green',
@@ -679,7 +682,7 @@ under the License.
position: 'top'
}
},
- data: [[12, 331221], [20, 331221], [55, 331221]]
+ data: [[12, 3312212121], [20, 3311212221], [55,
3311212221]]
}]
};
@@ -715,7 +718,8 @@ under the License.
type: 'scatter',
symbolSize: 30,
label: {
- show: true
+ show: true,
+ silent: true
},
itemStyle: {
color: 'green',
@@ -788,7 +792,8 @@ under the License.
id: 's',
symbolSize: 30,
label: {
- show: true
+ show: true,
+ silent: true
},
itemStyle: {
color: 'green',
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]