xAxisとして自分のシリーズ名を使用したいと思います。私は以下のコードのように試してみました。このコードは複数の系列を作成していますが、x軸の値は1つのみです。私のコードで、すべてのファンドのシリーズを作成し、xAxisのファンド値をプロットしたいとしましょう。ハイチャートのxAxisとしてシリーズ名を使用
function draw(fund, zreturn) {
zreturn = [12.75, 11.77, 13.76];
fund = ['abc', 'xyz', 'pqr'];
var options = {};
options = {
chart: {
renderTo: 'graphDiv',
type: 'line',
Height: '400px'
},
credits: {
enabled: false
},
title: {
text: 'Fund Performance Graph',
x: -20
},
subtitle: {
text: '',
x: -20
},
xAxis: {
categories: fund
}
},
yAxis: {
labels: {
enabled: true,
format: function() {
return (this.value + '%')
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0,
},
series: zreturn.filter(function (zreturn, i) {
return fund[i]
}).map(function (zreturn, i) {
/* Then return as series */
return {
//type: 'line',
name: fund[i],
data: zreturn,
dataLabels: {
align: 'center',
enabled: true,
format: "{y:.2f}" + '%',
style: {
fontSize: "8px",
fontFamily: 'Arial',
},
}
}
})
}
var chart = new Highcharts.Chart(options);
};
を:http://jsfiddle.net/worg6jLz/26/ –
@GrzegorzBlachliński完璧に動作します。あなたがしたことを説明していただけますか? – MaazKhan47
私は変更の説明と回答を掲載しました –