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 2019/05/22 09:06:50 UTC
[incubator-echarts] branch master updated (244d0b9 -> 6602b1d)
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.
from 244d0b9 修复4.2.1之前版本都不可以使用symbol: Function的bug
new 0afe271 Label color support function
new 6602b1d Add test case for label color
The 2 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:
src/util/graphic.js | 4 +
test/scatter-label-color.html | 184 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 188 insertions(+)
create mode 100644 test/scatter-label-color.html
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[incubator-echarts] 01/02: Label color support function
Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 0afe271b83ea93c2314198b2a4ef29db5af5a822
Author: susiwen <su...@gmail.com>
AuthorDate: Thu May 16 20:13:03 2019 +0800
Label color support function
---
src/util/graphic.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/util/graphic.js b/src/util/graphic.js
index b8c2373..c17192a 100644
--- a/src/util/graphic.js
+++ b/src/util/graphic.js
@@ -653,6 +653,10 @@ export function setLabelStyle(
setTextStyle(emphasisStyle, emphasisModel, emphasisSpecified, opt, true);
}
+ if (typeof normalModel.get('color') === 'function') {
+ normalStyle.textFill = normalModel.get('color')(labelDataIndex);
+ }
+
normalStyle.text = normalStyleText;
emphasisStyle.text = emphasisStyleText;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[incubator-echarts] 02/02: Add test case for label color
Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 6602b1dd8b8f99cd1406779b782b35c21ee74afb
Author: susiwen <su...@gmail.com>
AuthorDate: Sat May 18 09:57:26 2019 +0800
Add test case for label color
---
test/scatter-label-color.html | 184 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 184 insertions(+)
diff --git a/test/scatter-label-color.html b/test/scatter-label-color.html
new file mode 100644
index 0000000..d251055
--- /dev/null
+++ b/test/scatter-label-color.html
@@ -0,0 +1,184 @@
+<!doctype html>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+<html>
+
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+ <script src="lib/testHelper.js"></script>
+ <script src="../dist/echarts.js"></script>
+</head>
+
+<body>
+ <style>
+ html,
+ body {
+ background: #111;
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ }
+ </style>
+ <div id="main0"></div>
+ <div id="main1"></div>
+ <div id="main2"></div>
+ <script>
+ require(['echarts'], function (echarts) {
+ var option = {
+ xAxis: {},
+ yAxis: {},
+ series: [{
+ symbolSize: 20,
+ data: [
+ [10.0, 8.04],
+ [8.0, 6.95],
+ [13.0, 7.58],
+ [9.0, 8.81],
+ [11.0, 8.33],
+ [14.0, 9.96],
+ [6.0, 7.24],
+ [4.0, 4.26],
+ [12.0, 10.84],
+ [7.0, 4.82],
+ [5.0, 5.68]
+ ],
+ type: 'scatter',
+ label: {
+ show: true,
+ position: 'top',
+ formatter(params) {
+ return params.value[1];
+ },
+ color: function (index) {
+ return index === 0 ?
+ 'black' :
+ index === 1 ?
+ 'red' :
+ index === 2 ?
+ 'yellow' :
+ index === 3 ?
+ 'green' :
+ index === 4 ?
+ 'orange' :
+ index === 5 ?
+ 'pink' :
+ index === 6 ?
+ 'red' :
+ 'gray'
+ }
+ }
+ }]
+ };
+
+ var chart = testHelper.create(echarts, 'main0', {
+ title: [
+ 'Label color should set as user designated'
+ ],
+ option: option
+ });
+ });
+
+ </script>
+ <script>
+ require(['echarts'], function (echarts) {
+ var option = {
+ xAxis: {},
+ yAxis: {},
+ series: [{
+ symbolSize: 20,
+ data: [
+ [10.0, 8.04],
+ [8.0, 6.95],
+ [13.0, 7.58],
+ [9.0, 8.81],
+ [11.0, 8.33],
+ [14.0, 9.96],
+ [6.0, 7.24],
+ [4.0, 4.26],
+ [12.0, 10.84],
+ [7.0, 4.82],
+ [5.0, 5.68]
+ ],
+ type: 'scatter',
+ label: {
+ show: true,
+ position: 'top',
+ formatter(params) {
+ return params.value[1];
+ },
+ color: 'black'
+ }
+ }]
+ };
+
+ var chart = testHelper.create(echarts, 'main1', {
+ title: [
+ 'Label color should be black'
+ ],
+ option: option
+ });
+ });
+
+ </script>
+ <script>
+ require(['echarts'], function (echarts) {
+ var option = {
+ xAxis: {},
+ yAxis: {},
+ series: [{
+ symbolSize: 20,
+ data: [
+ [10.0, 8.04],
+ [8.0, 6.95],
+ [13.0, 7.58],
+ [9.0, 8.81],
+ [11.0, 8.33],
+ [14.0, 9.96],
+ [6.0, 7.24],
+ [4.0, 4.26],
+ [12.0, 10.84],
+ [7.0, 4.82],
+ [5.0, 5.68]
+ ],
+ type: 'scatter',
+ label: {
+ show: true,
+ position: 'top',
+ formatter(params) {
+ return params.value[1];
+ }
+ }
+ }]
+ };
+
+ var chart = testHelper.create(echarts, 'main2', {
+ title: [
+ 'Label color should be same as point color'
+ ],
+ option: option
+ });
+ });
+
+ </script>
+</body>
+
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org