Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
b025d93e
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,发现更多精彩内容 >>
提交
b025d93e
编写于
6月 03, 2014
作者:
K
kener
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dataRange支持formatter
上级
14bea2ba
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
56 deletion
+65
-56
doc/asset/js/echartsExample.js
doc/asset/js/echartsExample.js
+2
-1
doc/example/dataRange.html
doc/example/dataRange.html
+14
-3
doc/example/map15.html
doc/example/map15.html
+1
-9
src/component/dataRange.js
src/component/dataRange.js
+47
-43
src/config.js
src/config.js
+1
-0
未找到文件。
doc/asset/js/echartsExample.js
浏览文件 @
b025d93e
...
...
@@ -61,7 +61,8 @@ function needMap() {
var
href
=
location
.
href
;
return
href
.
indexOf
(
'
map
'
)
!=
-
1
||
href
.
indexOf
(
'
mix3
'
)
!=
-
1
||
href
.
indexOf
(
'
mix5
'
)
!=
-
1
;
||
href
.
indexOf
(
'
mix5
'
)
!=
-
1
||
href
.
indexOf
(
'
dataRange
'
)
!=
-
1
;
}
...
...
doc/example/dataRange.html
浏览文件 @
b025d93e
...
...
@@ -75,13 +75,19 @@ dataRangeStyle = [
// 0
{
min: 0,
max: 2000
max: 2000,
formatter : function(v, v2){
if (v2
<
1000)
{
return
'
低于
'
+
v2
}
else
if
(
v
>
1000) { return '高于' + v}
else { return '中' }
}
},
// 1
{
orient: 'horizontal', // 'vertical'
min: 0,
max: 2000
max: 2000,
formatter : '{value} 到 {value2}'
},
// 2
{
...
...
@@ -128,7 +134,12 @@ dataRangeStyle = [
{
calculable : true,
min: 0,
max: 2000
max: 2000,
formatter : function(v) {
if (v > 1500) {return v + ' (高)'}
else if (v
<
500)
{
return
v
+
'
(
低
)'}
else
{
return
v
+
'
(
中
)'};
}
},
//
9
{
...
...
doc/example/map15.html
浏览文件 @
b025d93e
...
...
@@ -286,14 +286,6 @@ option = {
color: '#fff'
}
},
dataRangde: {
min : 0,
max : 100,
color: ['#fff','#1e90ff'],
textStyle : {
color: '#fff'
}
},
toolbox: {
show : true,
orient : 'vertical',
...
...
@@ -335,7 +327,7 @@ option = {
geoCoord = placeList[len % placeList.length].geoCoord;
data.push({
name : placeList[len % placeList.length].name + len,
value :
5
0,
value :
1
0,
geoCoord : [
geoCoord[0] + Math.random() * 5 * -1,
geoCoord[1] + Math.random() * 3 * -1
...
...
src/component/dataRange.js
浏览文件 @
b025d93e
...
...
@@ -42,6 +42,9 @@ define(function (require) {
self
.
_ondragend
=
function
()
{
return
self
.
__ondragend
();
};
self
.
_dataRangeSelected
=
function
(
param
)
{
return
self
.
__dataRangeSelected
(
param
);
}
this
.
_selectedMap
=
{};
this
.
_range
=
{};
...
...
@@ -334,17 +337,8 @@ define(function (require) {
var
font
=
this
.
getFont
(
this
.
dataRangeOption
.
textStyle
);
var
textHeight
=
zrArea
.
getTextHeight
(
'
国
'
,
font
);
var
textWidth
=
Math
.
max
(
zrArea
.
getTextWidth
(
this
.
dataRangeOption
.
max
.
toFixed
(
this
.
dataRangeOption
.
precision
),
font
),
zrArea
.
getTextWidth
(
this
.
dataRangeOption
.
min
.
toFixed
(
this
.
dataRangeOption
.
precision
),
font
)
zrArea
.
getTextWidth
(
this
.
_textFormat
(
this
.
dataRangeOption
.
max
),
font
),
zrArea
.
getTextWidth
(
this
.
_textFormat
(
this
.
dataRangeOption
.
min
),
font
)
)
+
2
;
var
pointListStart
;
...
...
@@ -504,9 +498,7 @@ define(function (require) {
this
.
_startShape
=
{
style
:
{
pointList
:
pointListStart
,
text
:
this
.
dataRangeOption
.
max
.
toFixed
(
this
.
dataRangeOption
.
precision
),
text
:
this
.
_textFormat
(
this
.
dataRangeOption
.
max
),
textX
:
textXStart
,
textY
:
textYStart
,
color
:
this
.
getColor
(
this
.
dataRangeOption
.
max
),
...
...
@@ -525,9 +517,7 @@ define(function (require) {
this
.
_endShape
=
{
style
:
{
pointList
:
pointListEnd
,
text
:
this
.
dataRangeOption
.
min
.
toFixed
(
this
.
dataRangeOption
.
precision
),
text
:
this
.
_textFormat
(
this
.
dataRangeOption
.
min
),
textX
:
textXEnd
,
textY
:
textYEnd
,
color
:
this
.
getColor
(
this
.
dataRangeOption
.
min
),
...
...
@@ -1083,39 +1073,31 @@ define(function (require) {
this
.
_startShape
.
style
.
y
-
this
.
_startShape
.
style
.
_y
];
if
(
this
.
dataRangeOption
.
precision
===
0
)
{
this
.
_startShape
.
style
.
text
=
Math
.
round
(
this
.
_gap
*
this
.
_range
.
start
+
this
.
dataRangeOption
.
min
)
+
''
;
}
else
{
this
.
_startShape
.
style
.
text
=
(
this
.
_gap
*
this
.
_range
.
start
+
this
.
dataRangeOption
.
min
).
toFixed
(
this
.
dataRangeOption
.
precision
);
}
this
.
_startShape
.
style
.
color
=
this
.
_startShape
.
highlightStyle
.
strokeColor
=
this
.
getColor
(
this
.
_startShape
.
style
.
text
=
this
.
_textFormat
(
this
.
_gap
*
this
.
_range
.
start
+
this
.
dataRangeOption
.
min
);
this
.
_startShape
.
style
.
color
=
this
.
_startShape
.
highlightStyle
.
strokeColor
=
this
.
getColor
(
this
.
_gap
*
this
.
_range
.
start
+
this
.
dataRangeOption
.
min
);
this
.
_endShape
.
position
=
[
this
.
_endShape
.
style
.
x
-
this
.
_endShape
.
style
.
_x
,
this
.
_endShape
.
style
.
y
-
this
.
_endShape
.
style
.
_y
];
if
(
this
.
dataRangeOption
.
precision
===
0
)
{
this
.
_endShape
.
style
.
text
=
Math
.
round
(
this
.
_gap
*
this
.
_range
.
end
+
this
.
dataRangeOption
.
min
)
+
''
;
}
else
{
this
.
_endShape
.
style
.
text
=
(
this
.
_gap
*
this
.
_range
.
end
+
this
.
dataRangeOption
.
min
).
toFixed
(
this
.
dataRangeOption
.
precision
);
}
this
.
_endShape
.
style
.
color
=
this
.
_endShape
.
highlightStyle
.
strokeColor
=
this
.
getColor
(
this
.
_endShape
.
style
.
text
=
this
.
_textFormat
(
this
.
_gap
*
this
.
_range
.
end
+
this
.
dataRangeOption
.
min
);
this
.
_endShape
.
style
.
color
=
this
.
_endShape
.
highlightStyle
.
strokeColor
=
this
.
getColor
(
this
.
_gap
*
this
.
_range
.
end
+
this
.
dataRangeOption
.
min
);
this
.
zr
.
modShape
(
this
.
_startShape
.
id
);
this
.
zr
.
modShape
(
this
.
_endShape
.
id
);
this
.
zr
.
modShape
(
this
.
_startMask
.
id
);
...
...
@@ -1140,12 +1122,33 @@ define(function (require) {
},
_dataRangeSelected
:
function
(
param
)
{
_
_
dataRangeSelected
:
function
(
param
)
{
var
idx
=
param
.
target
.
_idx
;
this
.
_selectedMap
[
idx
]
=
!
this
.
_selectedMap
[
idx
];
this
.
messageCenter
.
dispatch
(
ecConfig
.
EVENT
.
REFRESH
);
},
_textFormat
:
function
(
valueStart
,
valueEnd
)
{
valueStart
=
valueStart
.
toFixed
(
this
.
dataRangeOption
.
precision
);
valueEnd
=
typeof
valueEnd
!=
'
undefined
'
?
valueEnd
.
toFixed
(
this
.
dataRangeOption
.
precision
)
:
''
if
(
this
.
dataRangeOption
.
formatter
)
{
if
(
typeof
this
.
dataRangeOption
.
formatter
==
'
string
'
)
{
return
this
.
dataRangeOption
.
formatter
.
replace
(
'
{value}
'
,
valueStart
)
.
replace
(
'
{value2}
'
,
valueEnd
);
}
else
if
(
typeof
this
.
dataRangeOption
.
formatter
==
'
function
'
)
{
return
this
.
dataRangeOption
.
formatter
(
valueStart
,
valueEnd
);
}
}
if
(
valueEnd
!=
''
)
{
return
valueStart
+
'
-
'
+
valueEnd
;
}
return
valueStart
;
},
/**
* 刷新
*/
...
...
@@ -1200,9 +1203,10 @@ define(function (require) {
for
(
var
i
=
0
;
i
<
splitNumber
;
i
++
)
{
this
.
_selectedMap
[
i
]
=
true
;
this
.
_valueTextList
.
unshift
(
(
i
*
this
.
_gap
+
this
.
dataRangeOption
.
min
).
toFixed
(
precision
)
+
'
-
'
+
((
i
+
1
)
*
this
.
_gap
+
this
.
dataRangeOption
.
min
).
toFixed
(
precision
)
this
.
_textFormat
(
i
*
this
.
_gap
+
this
.
dataRangeOption
.
min
,
(
i
+
1
)
*
this
.
_gap
+
this
.
dataRangeOption
.
min
)
);
}
}
...
...
src/config.js
浏览文件 @
b025d93e
...
...
@@ -130,6 +130,7 @@ define(function() {
calculable
:
false
,
// 是否值域漫游,启用后无视splitNumber,线性渐变
realtime
:
true
,
color
:[
'
#006edd
'
,
'
#e0ffff
'
],
//颜色
//formatter: null,
//text:['高','低'], // 文本,默认为数值文本
textStyle
:
{
color
:
'
#333
'
// 值域文字颜色
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录