Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
cffa57bb
I
incubator-echarts
项目概览
missman
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
cffa57bb
编写于
1月 20, 2016
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize line smooth in themeRiver
上级
b04ed735
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
35 deletion
+36
-35
src/chart/line/poly.js
src/chart/line/poly.js
+34
-32
src/chart/themeRiver/ThemeRiverView.js
src/chart/themeRiver/ThemeRiverView.js
+2
-1
src/chart/themeRiver/themeRiverVisual.js
src/chart/themeRiver/themeRiverVisual.js
+0
-2
未找到文件。
src/chart/line/poly.js
浏览文件 @
cffa57bb
...
@@ -36,25 +36,24 @@ define(function (require) {
...
@@ -36,25 +36,24 @@ define(function (require) {
if
(
smooth
>
0
)
{
if
(
smooth
>
0
)
{
var
prevIdx
=
idx
-
dir
;
var
prevIdx
=
idx
-
dir
;
var
nextIdx
=
idx
+
dir
;
var
nextIdx
=
idx
+
dir
;
if
(
dir
>
0
)
{
// Last point
prevIdx
=
mathMax
(
prevIdx
,
start
);
if
((
dir
>
0
&&
idx
===
allLen
-
1
)
nextIdx
=
mathMin
(
nextIdx
,
allLen
-
1
);
||
(
dir
<=
0
&&
idx
===
0
)
)
{
v2Copy
(
cp1
,
p
);
}
}
else
{
else
{
nextIdx
=
mathMax
(
nextIdx
,
0
);
var
prevP
=
points
[
prevIdx
];
prevIdx
=
mathMin
(
prevIdx
,
start
);
var
nextP
=
points
[
nextIdx
];
}
// If next data is null
var
prevP
=
points
[
prevIdx
];
if
(
isNaN
(
nextP
[
0
])
||
isNaN
(
nextP
[
1
]))
{
var
nextP
=
points
[
nextIdx
];
nextP
=
p
;
// If next data is null
}
if
(
isNaN
(
nextP
[
0
])
||
isNaN
(
nextP
[
1
]))
{
nextP
=
p
;
}
vec2
.
sub
(
v
,
nextP
,
prevP
);
vec2
.
sub
(
v
,
nextP
,
prevP
);
scaleAndAdd
(
cp1
,
p
,
v
,
-
smooth
/
2
);
scaleAndAdd
(
cp1
,
p
,
v
,
-
smooth
/
2
);
}
// Smooth constraint
// Smooth constraint
vec2Min
(
cp0
,
cp0
,
smoothMax
);
vec2Min
(
cp0
,
cp0
,
smoothMax
);
vec2Max
(
cp0
,
cp0
,
smoothMin
);
vec2Max
(
cp0
,
cp0
,
smoothMin
);
...
@@ -80,19 +79,21 @@ define(function (require) {
...
@@ -80,19 +79,21 @@ define(function (require) {
return
k
;
return
k
;
}
}
function
getBoundingBox
(
points
)
{
function
getBoundingBox
(
points
,
smoothConstraint
)
{
var
ptMin
=
[
Infinity
,
Infinity
];
var
ptMin
=
[
Infinity
,
Infinity
];
var
ptMax
=
[
-
Infinity
,
-
Infinity
];
var
ptMax
=
[
-
Infinity
,
-
Infinity
];
for
(
var
i
=
0
;
i
<
points
.
length
;
i
++
)
{
if
(
smoothConstraint
)
{
var
pt
=
points
[
i
];
for
(
var
i
=
0
;
i
<
points
.
length
;
i
++
)
{
if
(
pt
[
0
]
<
ptMin
[
0
])
{
ptMin
[
0
]
=
pt
[
0
];
}
var
pt
=
points
[
i
];
if
(
pt
[
1
]
<
ptMin
[
1
])
{
ptMin
[
1
]
=
pt
[
1
];
}
if
(
pt
[
0
]
<
ptMin
[
0
])
{
ptMin
[
0
]
=
pt
[
0
];
}
if
(
pt
[
0
]
>
ptMax
[
0
])
{
ptMax
[
0
]
=
pt
[
0
];
}
if
(
pt
[
1
]
<
ptMin
[
1
])
{
ptMin
[
1
]
=
pt
[
1
];
}
if
(
pt
[
1
]
>
ptMax
[
1
])
{
ptMax
[
1
]
=
pt
[
1
];
}
if
(
pt
[
0
]
>
ptMax
[
0
])
{
ptMax
[
0
]
=
pt
[
0
];
}
if
(
pt
[
1
]
>
ptMax
[
1
])
{
ptMax
[
1
]
=
pt
[
1
];
}
}
}
}
return
{
return
{
min
:
ptMin
,
min
:
smoothConstraint
?
ptMin
:
ptMax
,
max
:
ptMax
max
:
smoothConstraint
?
ptMax
:
ptMin
};
};
}
}
...
@@ -105,15 +106,15 @@ define(function (require) {
...
@@ -105,15 +106,15 @@ define(function (require) {
shape
:
{
shape
:
{
points
:
[],
points
:
[],
smooth
:
0
smooth
:
0
,
smoothConstraint
:
true
},
},
style
:
{
style
:
{
fill
:
null
,
fill
:
null
,
stroke
:
'
#000
'
,
stroke
:
'
#000
'
smooth
:
0
},
},
buildPath
:
function
(
ctx
,
shape
)
{
buildPath
:
function
(
ctx
,
shape
)
{
...
@@ -122,7 +123,7 @@ define(function (require) {
...
@@ -122,7 +123,7 @@ define(function (require) {
var
i
=
0
;
var
i
=
0
;
var
len
=
points
.
length
;
var
len
=
points
.
length
;
var
result
=
getBoundingBox
(
points
);
var
result
=
getBoundingBox
(
points
,
shape
.
smoothConstraint
);
while
(
i
<
len
)
{
while
(
i
<
len
)
{
i
+=
drawSegment
(
i
+=
drawSegment
(
...
@@ -142,7 +143,8 @@ define(function (require) {
...
@@ -142,7 +143,8 @@ define(function (require) {
// Offset between stacked base points and points
// Offset between stacked base points and points
stackedOnPoints
:
[],
stackedOnPoints
:
[],
smooth
:
0
,
smooth
:
0
,
stackedOnSmooth
:
0
stackedOnSmooth
:
0
,
smoothConstraint
:
true
},
},
buildPath
:
function
(
ctx
,
shape
)
{
buildPath
:
function
(
ctx
,
shape
)
{
...
@@ -151,8 +153,8 @@ define(function (require) {
...
@@ -151,8 +153,8 @@ define(function (require) {
var
i
=
0
;
var
i
=
0
;
var
len
=
points
.
length
;
var
len
=
points
.
length
;
var
bbox
=
getBoundingBox
(
points
);
var
bbox
=
getBoundingBox
(
points
,
shape
.
smoothConstraint
);
var
stackedOnBBox
=
getBoundingBox
(
stackedOnPoints
);
var
stackedOnBBox
=
getBoundingBox
(
stackedOnPoints
,
shape
.
smoothConstraint
);
while
(
i
<
len
)
{
while
(
i
<
len
)
{
var
k
=
drawSegment
(
var
k
=
drawSegment
(
ctx
,
points
,
i
,
len
,
len
,
ctx
,
points
,
i
,
len
,
len
,
...
...
src/chart/themeRiver/ThemeRiverView.js
浏览文件 @
cffa57bb
...
@@ -56,7 +56,8 @@ define(function (require) {
...
@@ -56,7 +56,8 @@ define(function (require) {
points
:
points0
,
points
:
points0
,
stackedOnPoints
:
points1
,
stackedOnPoints
:
points1
,
smooth
:
0.4
,
smooth
:
0.4
,
stackedOnSmooth
:
0.4
stackedOnSmooth
:
0.4
,
smoothConstraint
:
false
});
});
var
itemModel
=
data
.
getItemModel
(
layerSeries
[
i
][
j
-
1
]);
var
itemModel
=
data
.
getItemModel
(
layerSeries
[
i
][
j
-
1
]);
...
...
src/chart/themeRiver/themeRiverVisual.js
浏览文件 @
cffa57bb
...
@@ -7,10 +7,8 @@ define(function (require) {
...
@@ -7,10 +7,8 @@ define(function (require) {
var
colorList
=
seriesModel
.
get
(
'
color
'
);
var
colorList
=
seriesModel
.
get
(
'
color
'
);
data
.
each
(
function
(
index
)
{
data
.
each
(
function
(
index
)
{
var
layoutInfo
=
data
.
getItemLayout
(
index
);
var
name
=
data
.
getName
(
index
);
var
name
=
data
.
getName
(
index
);
var
rawIndex
=
data
.
getRawIndex
(
index
);
var
rawIndex
=
data
.
getRawIndex
(
index
);
// use rawData just for drawing legend
// use rawData just for drawing legend
rawData
.
setItemVisual
(
rawData
.
setItemVisual
(
rawIndex
,
rawIndex
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录