Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
a4aad8ca
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a4aad8ca
编写于
4月 02, 2021
作者:
Y
yufeng04
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pointer can not display when icon is image
上级
397a253b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
3 deletion
+75
-3
src/chart/gauge/GaugeView.ts
src/chart/gauge/GaugeView.ts
+36
-3
test/gauge-pointer.html
test/gauge-pointer.html
+39
-0
未找到文件。
src/chart/gauge/GaugeView.ts
浏览文件 @
a4aad8ca
...
...
@@ -30,7 +30,10 @@ 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
'
;
import
ZRImage
from
'
zrender/src/graphic/Image
'
;
import
{
extend
}
from
'
zrender/src/core/util
'
;
type
ECSymbol
=
ReturnType
<
typeof
createSymbol
>
;
interface
PosInfo
{
cx
:
number
...
...
@@ -477,9 +480,39 @@ class GaugeView extends ChartView {
const
itemModel
=
data
.
getItemModel
<
GaugeDataItemOption
>
(
idx
);
const
emphasisModel
=
itemModel
.
getModel
(
'
emphasis
'
);
if
(
showPointer
)
{
const
pointer
=
data
.
getItemGraphicEl
(
idx
)
as
Displayable
;
pointer
.
type
!==
'
image
'
&&
pointer
.
useStyle
(
data
.
getItemVisual
(
idx
,
'
style
'
));
const
pointer
=
data
.
getItemGraphicEl
(
idx
)
as
ECSymbol
;
const
symbolStyle
=
data
.
getItemVisual
(
idx
,
'
style
'
);
const
visualColor
=
symbolStyle
.
fill
;
if
(
pointer
instanceof
ZRImage
)
{
const
pathStyle
=
pointer
.
style
;
pointer
.
useStyle
(
extend
({
// TODO other properties like x, y ?
image
:
pathStyle
.
image
,
x
:
pathStyle
.
x
,
y
:
pathStyle
.
y
,
width
:
pathStyle
.
width
,
height
:
pathStyle
.
height
},
symbolStyle
));
}
else
{
if
(
pointer
.
__isEmptyBrush
)
{
// fill and stroke will be swapped if it's empty.
// So we cloned a new style to avoid it affecting the original style in visual storage.
// TODO Better implementation. No empty logic!
pointer
.
useStyle
(
extend
({},
symbolStyle
));
}
else
{
pointer
.
useStyle
(
symbolStyle
);
}
if
(
pointer
.
type
!==
'
pointer
'
)
{
// Disable decal because symbol scale will been applied on the decal.
pointer
.
style
.
decal
=
null
;
pointer
.
setColor
(
visualColor
);
pointer
.
style
.
strokeNoScale
=
true
;
}
}
pointer
.
setStyle
(
itemModel
.
getModel
([
'
pointer
'
,
'
itemStyle
'
]).
getItemStyle
());
if
(
pointer
.
style
.
fill
===
'
auto
'
)
{
pointer
.
setStyle
(
'
fill
'
,
getColor
(
linearMap
(
data
.
get
(
valueDim
,
idx
)
as
number
,
valueExtent
,
[
0
,
1
],
true
)
...
...
test/gauge-pointer.html
浏览文件 @
a4aad8ca
...
...
@@ -46,6 +46,7 @@ under the License.
<div
id=
"main6"
></div>
<div
id=
"main7"
></div>
<div
id=
"main8"
></div>
<div
id=
"main9"
></div>
...
...
@@ -590,6 +591,44 @@ under the License.
// recordCanvas: true,
});
var
option9
=
{
tooltip
:
{
formatter
:
'
{a} <br/>{b} : {c}%
'
},
toolbox
:
{
feature
:
{
restore
:
{},
saveAsImage
:
{}
}
},
series
:
[
{
name
:
'
业务指标
'
,
type
:
'
gauge
'
,
pointer
:
{
icon
:
'
emptyCircle
'
,
itemStyle
:
{
borderWidth
:
10
,
borderColor
:
'
#f00
'
},
},
anchor
:
{
// show: true
},
detail
:
{
formatter
:
'
{value}%
'
},
data
:
[{
value
:
58.46
,
name
:
'
完成率
'
}]
}
]
};
var
chart9
=
testHelper
.
create
(
echarts
,
'
main9
'
,
{
title
:
[
'
pointer.icon: emptyCircle
'
,
'
anchor.show: false
'
],
option
:
option9
});
});
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录