You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by yu...@apache.org on 2021/02/01 04:54:37 UTC
[echarts] 01/01: fix(gauge) #14131 Pointer can not display when
icon is image
This is an automated email from the ASF dual-hosted git repository.
yufeng04 pushed a commit to branch fix-14131
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit d56c496b6f4f39469a245c808367248b7dda869d
Author: yufeng04 <74...@qq.com>
AuthorDate: Mon Feb 1 12:50:13 2021 +0800
fix(gauge) #14131 Pointer can not display when icon is image
---
src/chart/gauge/GaugeView.ts | 5 +++--
test/gauge-pointer.html | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/src/chart/gauge/GaugeView.ts b/src/chart/gauge/GaugeView.ts
index f155447..09b3c18 100644
--- a/src/chart/gauge/GaugeView.ts
+++ b/src/chart/gauge/GaugeView.ts
@@ -30,6 +30,7 @@ import { ColorString, ECElement } from '../../util/types';
import List from '../../data/List';
import Sausage from '../../util/shape/sausage';
import {createSymbol} from '../../util/symbol';
+import type Displayable from 'zrender/src/graphic/Displayable';
interface PosInfo {
cx: number
@@ -476,8 +477,8 @@ class GaugeView extends ChartView {
const itemModel = data.getItemModel<GaugeDataItemOption>(idx);
const emphasisModel = itemModel.getModel('emphasis');
if (showPointer) {
- const pointer = data.getItemGraphicEl(idx) as PointerPath;
- pointer.useStyle(data.getItemVisual(idx, 'style'));
+ const pointer = data.getItemGraphicEl(idx) as Displayable;
+ pointer.type !== 'image' && pointer.useStyle(data.getItemVisual(idx, 'style'));
pointer.setStyle(itemModel.getModel(['pointer', 'itemStyle']).getItemStyle());
if (pointer.style.fill === 'auto') {
pointer.setStyle('fill', getColor(
diff --git a/test/gauge-pointer.html b/test/gauge-pointer.html
index 4656d98..079f01e 100644
--- a/test/gauge-pointer.html
+++ b/test/gauge-pointer.html
@@ -45,6 +45,7 @@ under the License.
<div id="main5"></div>
<div id="main6"></div>
<div id="main7"></div>
+ <div id="main8"></div>
@@ -547,6 +548,48 @@ under the License.
date = null;
}, 1000);
+
+ var option8 = {
+ tooltip: {
+ formatter: '{a} <br/>{b} : {c}%'
+ },
+ toolbox: {
+ feature: {
+ restore: {},
+ saveAsImage: {}
+ }
+ },
+ series: [
+ {
+ name: '业务指标',
+ type: 'gauge',
+ anchor: {
+ show: true,
+ icon: "image://https://www.apache.org/img/support-apache.jpg",
+ size: 50,
+ showAbove: true
+ },
+ pointer: {
+ icon: "image://https://www.apache.org/img/support-apache.jpg",
+ length: "70%"
+ },
+ detail: {formatter: '{value}%'},
+ data: [{value: 58.46, name: '完成率'}]
+ }
+ ]
+ };
+
+ var chart8 = testHelper.create(echarts, 'main8', {
+ title: [
+ 'pointer.icon: "image://url"',
+ 'anchor.icon: "image://url"'
+ ],
+ option: option8
+ // height: 1200,
+ // buttons: [{text: 'btn-txt', onclick: function () {}}],
+ // recordCanvas: true,
+ });
+
});
</script>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org