Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
ab4aa4c0
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,发现更多精彩内容 >>
提交
ab4aa4c0
编写于
5月 30, 2014
作者:
K
kener
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
axisPointer支持十字准星
上级
e34b8247
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
343 addition
and
144 deletion
+343
-144
doc/example/scatter1.html
doc/example/scatter1.html
+9
-1
doc/example/scatter2.html
doc/example/scatter2.html
+32
-27
doc/example/scatter3.html
doc/example/scatter3.html
+9
-1
src/component/categoryAxis.js
src/component/categoryAxis.js
+5
-0
src/component/tooltip.js
src/component/tooltip.js
+154
-106
src/component/valueAxis.js
src/component/valueAxis.js
+33
-6
src/config.js
src/config.js
+12
-3
src/util/shape/Cross.js
src/util/shape/Cross.js
+89
-0
未找到文件。
doc/example/scatter1.html
浏览文件 @
ab4aa4c0
...
...
@@ -73,7 +73,15 @@ option = {
subtext: '抽样调查来自: Heinz 2003'
},
tooltip : {
trigger: 'item',
trigger: 'axis',
showDelay : 0,
axisPointer:{
type : 'cross',
lineStyle: {
type : 'dashed',
width : 1
}
},
formatter : function (value) {
if (value[2].length > 1) {
return value[0] + ' :
<br/>
'
...
...
doc/example/scatter2.html
浏览文件 @
ab4aa4c0
...
...
@@ -67,9 +67,35 @@
<div
class=
"well sidebar-nav"
>
<div
class=
"nav-header"
><a
href=
"#"
onclick=
"autoResize()"
class=
"icon-resize-full"
id =
"icon-resize"
></a>
option
</div>
<textarea
id=
"code"
name=
"code"
>
function random(){
var r = Math.round(Math.random() * 100);
return (r * (r % 2 == 0 ? 1 : -1));
}
function randomDataArray() {
var d = [];
var len = 100;
while (len--) {
d.push([
random(),
random(),
Math.abs(random()),
]);
}
return d;
}
option = {
tooltip : {
trigger: 'item'
trigger: 'axis',
showDelay : 0,
axisPointer:{
type : 'cross',
lineStyle: {
type : 'dashed',
width : 1
}
}
},
legend: {
data:['scatter1','scatter2']
...
...
@@ -88,6 +114,7 @@ option = {
{
type : 'value',
power: 1,
splitNumber: 4,
scale: true
}
],
...
...
@@ -95,8 +122,8 @@ option = {
{
type : 'value',
power: 1,
s
cale: true
,
s
plitArea : {show : true}
s
plitNumber: 4
,
s
cale: true
}
],
series : [
...
...
@@ -106,18 +133,7 @@ option = {
symbolSize: function (value){
return Math.round(value[2] / 5);
},
data: (function () {
var d = [];
var len = 100;
while (len--) {
d.push([
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0
]);
}
return d;
})()
data: randomDataArray()
},
{
name:'scatter2',
...
...
@@ -125,18 +141,7 @@ option = {
symbolSize: function (value){
return Math.round(value[2] / 5);
},
data: (function () {
var d = [];
var len = 100;
while (len--) {
d.push([
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0
]);
}
return d;
})()
data: randomDataArray()
}
]
};
...
...
doc/example/scatter3.html
浏览文件 @
ab4aa4c0
...
...
@@ -69,7 +69,15 @@
<textarea
id=
"code"
name=
"code"
>
option = {
tooltip : {
trigger: 'item'
trigger: 'axis',
showDelay : 0,
axisPointer:{
type : 'cross',
lineStyle: {
type : 'dashed',
width : 1
}
}
},
legend: {
data:['sin','cos']
...
...
src/component/categoryAxis.js
浏览文件 @
ab4aa4c0
...
...
@@ -671,6 +671,11 @@ define(function (require) {
return
-
1
;
},
// 根据位置换算值
getValueFromCoord
:
function
(
coord
)
{
return
''
},
/**
* 根据类目轴数据索引返回是否为主轴线
...
...
src/component/tooltip.js
浏览文件 @
ab4aa4c0
此差异已折叠。
点击以展开。
src/component/valueAxis.js
浏览文件 @
ab4aa4c0
...
...
@@ -783,18 +783,20 @@ define(function (require) {
value
=
value
<
this
.
_min
?
this
.
_min
:
value
;
value
=
value
>
this
.
_max
?
this
.
_max
:
value
;
var
valueRange
=
this
.
_max
-
this
.
_min
;
var
total
;
var
result
;
if
(
!
this
.
isHorizontal
())
{
// 纵向
total
=
this
.
grid
.
getHeight
();
result
=
this
.
grid
.
getYend
()
-
(
value
-
this
.
_min
)
/
valueRange
*
total
;
result
=
this
.
grid
.
getYend
()
-
(
value
-
this
.
_min
)
/
(
this
.
_max
-
this
.
_min
)
*
this
.
grid
.
getHeight
();
}
else
{
// 横向
total
=
this
.
grid
.
getWidth
();
result
=
(
value
-
this
.
_min
)
/
valueRange
*
total
+
this
.
grid
.
getX
();
result
=
this
.
grid
.
getX
()
+
(
value
-
this
.
_min
)
/
(
this
.
_max
-
this
.
_min
)
*
this
.
grid
.
getWidth
();
}
return
result
;
...
...
@@ -816,6 +818,31 @@ define(function (require) {
// 横向
return
Math
.
abs
(
value
/
(
this
.
_max
-
this
.
_min
)
*
this
.
grid
.
getWidth
());
}
},
// 根据位置换算值
getValueFromCoord
:
function
(
coord
)
{
var
result
;
if
(
!
this
.
isHorizontal
())
{
// 纵向
coord
=
coord
<
this
.
grid
.
getY
()
?
this
.
grid
.
getY
()
:
coord
;
coord
=
coord
>
this
.
grid
.
getYend
()
?
this
.
grid
.
getYend
()
:
coord
;
result
=
this
.
_max
-
(
coord
-
this
.
grid
.
getY
())
/
this
.
grid
.
getHeight
()
*
(
this
.
_max
-
this
.
_min
);
}
else
{
// 横向
coord
=
coord
<
this
.
grid
.
getX
()
?
this
.
grid
.
getX
()
:
coord
;
coord
=
coord
>
this
.
grid
.
getXend
()
?
this
.
grid
.
getXend
()
:
coord
;
result
=
this
.
_min
+
(
coord
-
this
.
grid
.
getX
())
/
this
.
grid
.
getWidth
()
*
(
this
.
_max
-
this
.
_min
);
}
return
result
.
toFixed
(
2
)
-
0
;
}
};
...
...
src/config.js
浏览文件 @
ab4aa4c0
...
...
@@ -228,9 +228,15 @@ define(function() {
width
:
2
,
type
:
'
solid
'
},
areaStyle
:
{
// 阴影指示器样式设置
size
:
'
auto
'
,
// 阴影大小
color
:
'
rgba(150,150,150,0.3)
'
// 阴影颜色
crossStyle
:
{
color
:
'
#1e90ff
'
,
width
:
1
,
type
:
'
dashed
'
},
shadowStyle
:
{
// 阴影指示器样式设置
color
:
'
rgba(150,150,150,0.3)
'
,
// 阴影颜色
width
:
'
auto
'
,
// 阴影大小
type
:
'
default
'
}
},
textStyle
:
{
...
...
@@ -283,6 +289,7 @@ define(function() {
boundaryGap
:
true
,
// 类目起始和结束两端空白策略
axisLine
:
{
// 坐标轴线
show
:
true
,
// 默认显示,属性show控制显示与否
onZero
:
true
,
lineStyle
:
{
// 属性lineStyle控制线条样式
color
:
'
#48b
'
,
width
:
2
,
...
...
@@ -343,6 +350,7 @@ define(function() {
splitNumber
:
5
,
// 分割段数,默认为5
axisLine
:
{
// 坐标轴线
show
:
true
,
// 默认显示,属性show控制显示与否
onZero
:
true
,
lineStyle
:
{
// 属性lineStyle控制线条样式
color
:
'
#48b
'
,
width
:
2
,
...
...
@@ -730,6 +738,7 @@ define(function() {
// selectedMode: false, // 选择模式,默认关闭,可选single,multiple
hoverable
:
true
,
// roam : false, // 是否开启缩放及漫游模式
// scaleLimit : null,
itemStyle
:
{
normal
:
{
// color: 各异,
...
...
src/util/shape/Cross.js
0 → 100644
浏览文件 @
ab4aa4c0
/**
* zrender
*
* @author Kener (@Kener-林峰, linzhifeng@baidu.com)
*
* shape类:十字准星
* 可配图形属性:
{
// 基础属性
shape : 'cross', // 必须,shape类标识,需要显式指定
id : {string}, // 必须,图形唯一标识,可通过'zrender/tool/guid'方法生成
zlevel : {number}, // 默认为0,z层level,决定绘画在哪层canvas中
invisible : {boolean}, // 默认为false,是否可见
// 样式属性,默认状态样式样式属性
style : {
rect : {Object}, // 必须,对角框
x : {number}, // 必须,横坐标
y : {number}, // 必须,纵坐标
},
// 样式属性,高亮样式属性,当不存在highlightStyle时使用基于默认样式扩展显示
highlightStyle : {
// 同style
}
// 交互属性,详见shape.Base
// 事件属性,详见shape.Base
}
*/
define
(
function
(
require
)
{
var
Base
=
require
(
'
zrender/shape/Base
'
);
var
LineShape
=
require
(
'
zrender/shape/Line
'
);
var
zrUtil
=
require
(
'
zrender/tool/util
'
);
function
Cross
(
options
)
{
Base
.
call
(
this
,
options
);
}
Cross
.
prototype
=
{
type
:
'
cross
'
,
/**
* 创建矩形路径
* @param {Context2D} ctx Canvas 2D上下文
* @param {Object} style 样式
*/
buildPath
:
function
(
ctx
,
style
)
{
var
rect
=
style
.
rect
style
.
xStart
=
rect
.
x
;
style
.
xEnd
=
rect
.
x
+
rect
.
width
;
style
.
yStart
=
style
.
yEnd
=
style
.
y
;
LineShape
.
prototype
.
buildPath
(
ctx
,
style
);
style
.
xStart
=
style
.
xEnd
=
style
.
x
;
style
.
yStart
=
rect
.
y
;
style
.
yEnd
=
rect
.
y
+
rect
.
height
;
LineShape
.
prototype
.
buildPath
(
ctx
,
style
);
return
;
},
/**
* 返回矩形区域,用于局部刷新和文字定位
* @param {Object} style
*/
getRect
:
function
(
style
)
{
return
style
.
rect
;
},
isCover
:
function
(
x
,
y
)
{
// 快速预判并保留判断矩形
var
rect
=
this
.
style
.
__rect
=
this
.
style
.
__rect
||
this
.
getRect
(
this
.
style
);
if
(
x
>=
rect
.
x
&&
x
<=
(
rect
.
x
+
rect
.
width
)
&&
y
>=
rect
.
y
&&
y
<=
(
rect
.
y
+
rect
.
height
)
)
{
// 矩形内
return
true
;
}
return
false
;
}
};
zrUtil
.
inherits
(
Cross
,
Base
);
return
Cross
;
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录