为漏斗高图设置相等的高度
Set equal height for funnel highcharts
我是 HighCharts 的新手。我用下面的脚本创建了一个漏斗
Highcharts.chart('container', {
chart: {
type: 'funnel'
},
title: {
text: 'Sales funnel'
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
format: '<b>{point.name}</b> ({point.y:,.0f})',
softConnector: true,
inside: true,
},
neckHeight: "0%",
neckWidth: "80%",
width: '15%',
reversed: true,
}
},
legend: {
enabled: false
},
series: [{
name: 'Unique users',
data: [
['Website visits', 15654],
['Downloads', 4064],
['Requested price list', 1987],
['Invoice sent', 976],
['Finalized', 846]
]
}]
});
jsfiddle: https://jsfiddle.net/kiranuk/bavLxzrp/
如何为所有部分设置相同的高度?
感谢您的帮助。
根据数据计算截面高度。如果你想有相等的部分,你可以提供模拟相等的数据并在工具提示和 data-labels 中显示真实数据。例如:
plotOptions: {
series: {
dataLabels: {
format: '<b>{point.name}</b> ({point.realY:,.0f})',
...
},
...
}
},
tooltip: {
formatter: function() {
return this.series.name + '<br><span style="color:' + this.color + '">●</span> ' + this.point.name + ': <b>' + this.point.realY + '</b>';
}
},
series: [{
name: 'Unique users',
keys: ['name', 'y', 'realY'],
data: [
['Website visits', 1, 15654],
['Downloads', 1, 4064],
['Requested price list', 1, 1987],
['Invoice sent', 1, 976],
['Finalized', 1, 846]
]
}]
现场演示: https://jsfiddle.net/BlackLabel/e4b5o16d/
API参考:https://api.highcharts.com/highcharts/series.funnel.data
我是 HighCharts 的新手。我用下面的脚本创建了一个漏斗
Highcharts.chart('container', {
chart: {
type: 'funnel'
},
title: {
text: 'Sales funnel'
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
format: '<b>{point.name}</b> ({point.y:,.0f})',
softConnector: true,
inside: true,
},
neckHeight: "0%",
neckWidth: "80%",
width: '15%',
reversed: true,
}
},
legend: {
enabled: false
},
series: [{
name: 'Unique users',
data: [
['Website visits', 15654],
['Downloads', 4064],
['Requested price list', 1987],
['Invoice sent', 976],
['Finalized', 846]
]
}]
});
jsfiddle: https://jsfiddle.net/kiranuk/bavLxzrp/
如何为所有部分设置相同的高度?
感谢您的帮助。
根据数据计算截面高度。如果你想有相等的部分,你可以提供模拟相等的数据并在工具提示和 data-labels 中显示真实数据。例如:
plotOptions: {
series: {
dataLabels: {
format: '<b>{point.name}</b> ({point.realY:,.0f})',
...
},
...
}
},
tooltip: {
formatter: function() {
return this.series.name + '<br><span style="color:' + this.color + '">●</span> ' + this.point.name + ': <b>' + this.point.realY + '</b>';
}
},
series: [{
name: 'Unique users',
keys: ['name', 'y', 'realY'],
data: [
['Website visits', 1, 15654],
['Downloads', 1, 4064],
['Requested price list', 1, 1987],
['Invoice sent', 1, 976],
['Finalized', 1, 846]
]
}]
现场演示: https://jsfiddle.net/BlackLabel/e4b5o16d/
API参考:https://api.highcharts.com/highcharts/series.funnel.data