coolchenc opened a new issue #16234: URL: https://github.com/apache/echarts/issues/16234
### What problem does this feature solve?
option = {
backgroundColor: "#fff",
title: {
text: "项目甘特图",
padding: 20,
textStyle: {
fontSize: 17,
fontWeight: "bolder",
color: "#333"
},
subtextStyle: {
fontSize: 13,
fontWeight: "bolder"
}
},
legend: {
data: ["Total", "BD1", "TG1", "BD2", "TG2", "TG4"],
align: "right",
right: 80,
top: 50
},
grid: {
containLabel: true,
show: false,
right: 130,
left: 40,
bottom: 40,
top: 90
},
xAxis: {
type: "time",
axisLabel: {
"show": true,
"interval": 0
}
},
dataZoom: [{
type: 'inside',
}, {
handleIcon:
'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z
M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}],
//下面的啦线
yAxis: {
axisLabel: {
show: true,
interval: 0,
formatter: function(value, index) {
var last = ""
var max = 5;
var len = value.length;
var hang = Math.ceil(len / max);
if (hang > 1) {
for (var i = 0; i < hang; i++) {
var start = i * max;
var end = start + max;
var temp = value.substring(start, end) + "\n";
last += temp; //拼接最终的字符串
}
return last;
} else {
return value;
}
}
},
//项目名字
data: ["XXXXXX"]
},
tooltip: {
trigger: "axis",
formatter: function(params) {
var res = "";
var name = "";
var start0 = "";
var start = "";
var end0 = "";
var end = "";
for (var i in params) {
var k = i % 2;
if (!k) { //奇数
name = params[i].seriesName;
end0 = params[i].data;
end = end0.getFullYear() + "-" + (end0.getMonth() + 1) +
"-" + end0.getDate();
}
if (k) { //偶数
start0 = params[i].data;
start = start0.getFullYear() + "-" + (start0.getMonth()
+ 1) + "-" + start0.getDate();
res += name + " : " + start + "~" + end + "</br>";
}
}
return res;
}
},
series: [
{
name: "Total",
type: "bar",
stack: "总量6",
label: {
normal: {
show: true,
color: "#000",
position: "right",
formatter: function(params) {
return params.seriesName
}
}
},
itemStyle: {
normal: {
color: "skyblue",
borderColor: "#fff",
borderWidth: 2
}
},
zlevel: -1,
data: [new Date("2022-1-28")]
},
{
name: "Total",
type: "bar",
stack: "总量6",
itemStyle: {
normal: {
color: "white",
}
},
zlevel: -1,
z: 3,
data: [new Date("2021-6-14")]
},
{
name: "BD1",
type: "bar",
stack: "总量0",
label: {
normal: {
show: true,
color: "#000",
position: "right",
formatter: function(params) {
return params.seriesName
}
}
},
itemStyle: {
normal: {
color: "green",
borderColor: "#fff",
borderWidth: 2
}
},
zlevel: -1,
data: [new Date("2021-6-15")]
},
{
name: "BD1",
type: "bar",
stack: "总量0",
itemStyle: {
normal: {
color: "white",
}
},
zlevel: -1,
z: 3,
data: [new Date("2021-6-14")]
},
{
name: "TG1",
type: "bar",
stack: "总量2",
label: {
normal: {
show: true,
color: "#000",
position: "right",
formatter: function(params) {
return params.seriesName
}
}
},
itemStyle: {
normal: {
color: "green",
borderColor: "#fff",
borderWidth: 2
}
},
zlevel: -1,
data: [new Date("2021-10-20")]
},
{
name: "TG1",
type: "bar",
stack: "总量2",
itemStyle: {
normal: {
color: "white",
}
},
zlevel: -1,
z: 3,
data: [new Date("2021-10-19")]
},
{
name: "BD2",
type: "bar",
stack: "总量3",
label: {
normal: {
show: true,
color: "#000",
position: "right",
formatter: function(params) {
return params.seriesName
}
}
},
itemStyle: {
normal: {
color: "green",
borderColor: "#fff",
borderWidth: 2
}
},
zlevel: -1,
data: [new Date("2021-10-27")]
},
{
name: "BD2",
type: "bar",
stack: "总量3",
itemStyle: {
normal: {
color: "white"
}
},
zlevel: -1,
z: 3,
data: [new Date("2021-10-26")]
},
{
name: "TG2",
type: "bar",
stack: "总量4",
label: {
normal: {
show: true,
color: "#000",
position: "right",
formatter: function(params) {
return params.seriesName
}
}
},
itemStyle: {
normal: {
color: "green",
borderColor: "#fff",
borderWidth: 2
}
},
zlevel: -1,
data: [new Date("2021-11-03")]
},
{
name: "TG2",
type: "bar",
stack: "总量4",
itemStyle: {
normal: {
color: "white",
}
},
zlevel: -1,
z: 3,
data: [new Date("2021-11-02")]
},
{
name: "TG4",
type: "bar",
stack: "总量5",
label: {
normal: {
show: true,
color: "#000",
position: "right",
formatter: function(params) {
return params.seriesName
}
}
},
itemStyle: {
normal: {
color: "green",
borderColor: "#fff",
borderWidth: 2
}
},
zlevel: -1,
data: [new Date("2022-1-28")]
},
{
name: "TG4",
type: "bar",
stack: "总量5",
itemStyle: {
normal: {
color: "white",
}
},
zlevel: -1,
z: 3,
data: [new Date("2022-1-27")]
},
]
}
myChart.setOption(option);
### What does the proposed API look like?
现在是Total", "BD1", "TG1", "BD2", "TG2", "TG4 在不同的Y轴 ,怎么把他放在一条Y轴?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
