-
Notifications
You must be signed in to change notification settings - Fork 19.8k
请问时间数据支持堆叠吗? #8955
Copy link
Copy link
Closed
Labels
Description
One-line summary [问题简述]
在做甘特图,需要时间数据进行堆叠,但好像现在不支持时间数据的堆叠展示?
因为要用 dataZoom,如果把数据转换为数值的话,堆叠是正常的,但 dataZoom 就不能用了。
如果设置 barGap 为 '-100%',可以使柱子重叠,在此基础上,增加了一个坐标系为隐藏,但 barGap 对 series 中所有柱子生效,还是不能实现甘特图。barGap 能否设置为只针对某一坐标系下的 series 柱子重叠?
Version & Environment [版本及环境]
- ECharts version [ECharts 版本]:
- Browser version [浏览器类型和版本]:
- OS Version [操作系统类型和版本]:
在官网运行下面的例子
Expected behaviour [期望结果]
希望时间数据可以堆叠,或者有什么方法将时间数据转换然后展示正常,并且 dataZoom 可用。
ECharts option [ECharts配置项]
function FormatTime(oldTime){
let newTime = [];
oldTime.forEach((time)=>{
newTime.push( new Date(time) );
})
return newTime ;
}
option = {
tooltip: {
trigger: 'axis'
},
xAxis: [
{
type: 'time'
}
],
yAxis: [
{
type: 'category',
data: ['task1','task2','task3','task4','task5' ]
}
],
dataZoom: [ {
type: 'slider'
}],
series: [
{
name:'计划开始时间',
type: 'bar',
stack: '计划',
itemStyle: {
normal: {
borderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
},
emphasis: {
borderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
}
},
data: FormatTime ([
"2018/01/01",
"2018/02/01",
"2018/03/01",
"2018/04/01",
"2018/05/01"
])
},
{
name:'计划结束时间',
type: 'bar',
stack: '计划',
data: FormatTime ([
"2018/02/01",
"2018/03/01",
"2018/04/01",
"2018/05/01",
"2018/06/01"
])
},
{
name:'实际开始时间',
type: 'bar',
stack: '实际',
itemStyle: {
normal: {
borderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
},
emphasis: {
borderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
}
},
data: FormatTime ([
"2018/01/01",
"2018/03/01",
"2018/04/01",
"2018/05/01",
"2018/06/01"
])
},
{
name:'实际结束时间',
type: 'bar',
stack: '实际',
data: FormatTime ([
"2018/03/01",
"2018/04/01",
"2018/05/01",
"2018/06/01",
"2018/07/01"
])
}
]
};
Other comments [其他信息]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.