我有来自外部数据源的 CSV 数据,但我不想显示其中的所有列。尽管如此,所有列都映射到系列。我可以仅将某些列显示为系列而不更改 CSV 数据吗?Jsfiddle: https: //jsfiddle.net/martindfurrer/qt7hwko5/CSV 数据:"Year";"total (unused)";"Sector 1";"Sector 2";"Sector 3""2011";4380;522;1154;2704"2012";4768;497;1172;3099"2013";4824;488;1162;3174"2014";4891;486;1162;3243"2015";4948;479;1177;3292"2016";4901;476;1112;3313"2017";4858;448;1074;3336"2018";4856;453;1068;3335JavaScript:data: { csv: document.getElementById('csvdata').innerHTML, itemDelimiter: ';', firstRowAsNames: false, startRow: 1, seriesMapping: [{ x: 0, y: 2, },{ x: 0, y: 3, },{ x: 0, y: 4, }],},series: [{ name: 'Sector 1', },{ name: 'Sector 2', },{ name: 'Sector 3',}],
1 回答
ABOUTYOU
TA贡献1812条经验 获得超5个赞
您可以将空对象添加到seriesMapping:
data: {
...,
seriesMapping: [
{
x: 0,
y: 2,
},
...,
{}
],
}
现场演示: https: //jsfiddle.net/BlackLabel/rewfq8v7/
API 参考: https: //api.highcharts.com/highcharts/data.seriesMapping
或者修改数据,例如在parsed
函数中:
data: {
...,
parsed: function(data) {
data.splice(1, 2);
},
}
现场演示: https: //jsfiddle.net/BlackLabel/jtL6e1xz/
API 参考: https: //api.highcharts.com/highcharts/data.parsed
添加回答
举报
0/150
提交
取消