Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
f27f50eb
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,发现更多精彩内容 >>
提交
f27f50eb
编写于
2月 10, 2018
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #7733 (has value defect)
上级
e7e3cfe2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
155 addition
and
27 deletion
+155
-27
src/chart/line/LineView.js
src/chart/line/LineView.js
+1
-1
src/data/helper/dimensionHelper.js
src/data/helper/dimensionHelper.js
+23
-24
test/dataset-category.html
test/dataset-category.html
+131
-2
未找到文件。
src/chart/line/LineView.js
浏览文件 @
f27f50eb
...
...
@@ -56,7 +56,7 @@ function getStackedOnPoints(coordSys, data, dataCoordInfo) {
for
(
var
idx
=
0
,
len
=
data
.
count
();
idx
<
len
;
idx
++
)
{
points
.
push
(
getStackedOnPoint
(
dataCoordInfo
,
coordSys
,
data
,
idx
));
}
console
.
log
(
JSON
.
stringify
(
points
));
return
points
;
}
...
...
src/data/helper/dimensionHelper.js
浏览文件 @
f27f50eb
...
...
@@ -8,7 +8,7 @@ export var OTHER_DIMENSIONS = createHashMap([
export
function
summarizeDimensions
(
data
)
{
var
summary
=
{};
var
encode
=
summary
.
encode
=
{};
var
coordDimMap
=
summary
.
c
oordDimMap
=
createHashMap
();
var
notExtraC
oordDimMap
=
createHashMap
();
var
defaultedLabel
=
[];
each
(
data
.
dimensions
,
function
(
dimName
)
{
...
...
@@ -25,14 +25,16 @@ export function summarizeDimensions(data) {
}
coordDimArr
[
dimItem
.
coordDimIndex
]
=
dimName
;
if
(
!
dimItem
.
isExtraCoord
&&
mayLabelDimType
(
dimItem
.
type
))
{
// Use the last coord dim (and label friendly) as default label,
// because both show x, y on label is not look good, and usually
// y axis is more focusd conventionally.
defaultedLabel
[
0
]
=
dimName
;
}
if
(
!
dimItem
.
isExtraCoord
)
{
notExtraCoordDimMap
.
set
(
coordDim
,
1
);
coordDimMap
.
set
(
coordDim
,
1
);
if
(
mayLabelDimType
(
dimItem
.
type
))
{
// Use the last coord dim (and label friendly) as default label,
// because both show x, y on label is not look good, and usually
// y axis is more focusd conventionally.
defaultedLabel
[
0
]
=
dimName
;
}
}
}
OTHER_DIMENSIONS
.
each
(
function
(
v
,
otherDim
)
{
...
...
@@ -49,12 +51,21 @@ export function summarizeDimensions(data) {
});
var
dataDimsOnCoord
=
[];
// ??? FIXME extra coord should not be set in dataDimsOnCoord.
// Fix the case that radar axes.
coordDimMap
.
each
(
function
(
v
,
coordDim
)
{
dataDimsOnCoord
=
dataDimsOnCoord
.
concat
(
encode
[
coordDim
]);
var
encodeFirstDimNotExtra
=
{};
notExtraCoordDimMap
.
each
(
function
(
v
,
coordDim
)
{
var
dimArr
=
encode
[
coordDim
];
// ??? FIXME extra coord should not be set in dataDimsOnCoord.
// But should fix the case that radar axes: simplify the logic
// of `completeDimension`, remove `extraPrefix`.
encodeFirstDimNotExtra
[
coordDim
]
=
dimArr
[
0
];
// Not necessary to remove duplicate, because a data
// dim canot on more than one coordDim.
dataDimsOnCoord
=
dataDimsOnCoord
.
concat
(
dimArr
);
});
summary
.
dataDimsOnCoord
=
dataDimsOnCoord
;
summary
.
encodeFirstDimNotExtra
=
encodeFirstDimNotExtra
;
var
encodeLabel
=
encode
.
label
;
// FIXME `encode.label` is not recommanded, because formatter can not be set
...
...
@@ -72,18 +83,6 @@ export function summarizeDimensions(data) {
encode
.
defaultedLabel
=
defaultedLabel
;
encode
.
defaultedTooltip
=
defaultedTooltip
;
var
encodeFirstDimNotExtra
=
summary
.
encodeFirstDimNotExtra
=
{};
each
(
encode
,
function
(
coordDimArr
,
coordDim
)
{
for
(
var
i
=
0
;
i
<
(
coordDimArr
||
[]).
length
;
i
++
)
{
var
dim
=
coordDimArr
[
i
];
var
dimInfo
=
data
.
getDimensionInfo
(
dim
);
if
(
dimInfo
&&
!
dimInfo
.
isExtraCoord
)
{
encodeFirstDimNotExtra
[
coordDim
]
=
dim
;
break
;
}
}
});
return
summary
;
}
...
...
test/dataset-category.html
浏览文件 @
f27f50eb
...
...
@@ -30,6 +30,10 @@
<div
id=
"empty-data"
></div>
<div
id=
"dynamic-category"
></div>
<div
id=
"dynamic-time"
></div>
<div
id=
"dimension-but-no-column1"
></div>
<div
id=
"dimension-but-no-column2"
></div>
<div
id=
"dimension-but-no-column3"
></div>
...
...
@@ -753,8 +757,6 @@
<script>
require
([
'
echarts
'
...
...
@@ -819,5 +821,132 @@
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
var
option
=
{
legend
:
{},
tooltip
:
{},
dataset
:
{
dimensions
:
[
'
product
'
,
'
2015
'
,
'
2016
'
,
'
2017
'
],
source
:
[
{
product
:
'
Matcha Latte
'
,
'
2015
'
:
43.3
,
'
2016
'
:
85.8
},
{
product
:
'
Milk Tea
'
,
'
2015
'
:
83.1
,
'
2016
'
:
73.4
},
{
product
:
'
Cheese Cocoa
'
,
'
2015
'
:
86.4
,
'
2016
'
:
65.2
},
{
product
:
'
Walnut Brownie
'
,
'
2015
'
:
72.4
,
'
2016
'
:
53.9
}
]
},
xAxis
:
{
type
:
'
category
'
},
yAxis
:
{},
series
:
[
{
type
:
'
bar
'
},
{
type
:
'
bar
'
}
]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
dimension-but-no-column1
'
,
{
title
:
'
[obejct array] No 2017, but chart should be rendered
'
,
dataTable
:
option
.
dataset
.
source
,
option
:
option
,
info
:
option
.
dataset
.
dimensions
,
infoKey
:
'
dimensions
'
});
});
</script>
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
var
option
=
{
legend
:
{},
tooltip
:
{},
dataset
:
{
dimensions
:
[
'
product
'
,
'
2015
'
,
'
2016
'
,
'
2017
'
],
source
:
[
[
'
Matcha Latte
'
,
43.3
,
85.8
],
[
'
Milk Tea
'
,
83.1
,
73.4
],
[
'
Cheese Cocoa
'
,
86.4
,
65.2
],
[
'
Walnut Brownie
'
,
72.4
,
53.9
]
]
},
xAxis
:
{
type
:
'
category
'
},
yAxis
:
{},
series
:
[
{
type
:
'
bar
'
},
{
type
:
'
bar
'
}
]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
dimension-but-no-column2
'
,
{
title
:
'
[2d-array] No 2017, but chart should be rendered
'
,
dataTable
:
option
.
dataset
.
source
,
option
:
option
,
info
:
option
.
dataset
.
dimensions
,
infoKey
:
'
dimensions
'
});
});
</script>
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
var
option
=
{
legend
:
{},
tooltip
:
{},
dataset
:
{
dimensions
:
[
'
product
'
,
'
2015
'
,
'
2016
'
,
'
2017
'
],
source
:
{
'
product
'
:
[
'
Matcha Latte
'
,
'
Milk Tea
'
,
'
Cheese Cocoa
'
,
'
Walnut Brownie
'
],
'
2015
'
:
[
43.3
,
83.1
,
86.4
,
72.4
],
'
2016
'
:
[
85.8
,
73.4
,
65.2
,
53.9
]
}
},
xAxis
:
{
type
:
'
category
'
},
yAxis
:
{},
series
:
[
{
type
:
'
bar
'
},
{
type
:
'
bar
'
}
]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
dimension-but-no-column3
'
,
{
title
:
'
[key columns] No 2017, but chart should be rendered
'
,
dataTable
:
option
.
dataset
.
source
,
option
:
option
,
info
:
option
.
dataset
.
dimensions
,
infoKey
:
'
dimensions
'
});
});
</script>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录