我使用的是HighCharts,我有这个数组,
我想创建一个这样的图表:
据我所知,系列的格式是这样的:
series:[{
name: 'Production',
data: [0.074, 0.040,0.034,0.036,0.068]
}, {
name: 'Reprise',
data: [0.024,0.022,0.029, 0.055, 0.052]
}]
with categories array:
['Mario', 'Andre', 'Jean Jacques', 'Fidy', 'Judith']
如果我想将列Volumes的每个值粘贴到每个Production Stacked Bar值,如上图所示,该怎么办?
谢谢!
答案 0 :(得分:0)
series: [{
name: 'Volume', data: [1, 0.16, 0.46, 0.37, 0.24] }, { name: 'Reprise', data: [0.024, 0.0.....] }, { name: 'Production', data: [....] }]
稍后编辑:要将音量显示为数据标签,您可以使用格式化程序功能:
column: {
stacking: 'normal',
dataLabels: {
formatter: function () {
return this.x;//you can have a little logic here if (thix.x == 'Production) return myVariable[y];myVariable will contains values from volume or something similar
}
}
}
答案 1 :(得分:0)
在数据数组中定义卷:
data: [{y:0.074,volume:1}, {y:0.040,volume:0.15}]
在datalabels选项中使用formatter获取自定义值:
formatter: function () {
return this.point.volume + ' km';
}