チャートが実行されているこのコードでデータを取得しています。X軸に最大値と最小値のフラグを追加しました。フラグ内に評価を表示したいのですが、ここにカテゴリデータが表示されますが、評価はフラグに表示されません。ここで私のデータと評価は動的に静的ではなくデータです。私はすでにスタックオーバーフローの提案を試しましたが、highstock.jsファイルとhighcharts.jsファイルを含めましたが、それでも機能しません。縦棒グラフの適切な解決策を教えてください。
$(document). ready(function() {
var options = {
chart: {
renderTo: 'container',
type: 'column',
marginRight: 130,
marginBottom: 50
},
title: {
text: 'Top 15 Projects Facilities Rating',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'Facilities Rating'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': '+ this.y;
}
},
plotOptions:{
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color:'white'
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
borderWidth: 0
},
series: [{
name:'RATING',
data:[],
id:'dataseries'
},
{
type: 'flags',
onSeries: 'dataseries',
data: [{
x: 0,
text: 'Minimum Facilites Rating',
title: 'Min'
}, {
x: 15,
text: 'Maximum Facilites Rating',
title: 'max'
}],
width: 30,
showInLegend: false
}]
}
$.getJSON("bargraph_data.php", function(json) {
options.xAxis.categories = json[0]['data'];
// options.series.splice(0,0, json[1]);
options.series[0].data = json[1]['data'];
chart = new Highcharts.Chart(options);
});
});
[リンク] http://jsfiddle.net/sunitasingh/n3U77/3/でも確認できます。静的ではなく動的なフラグシリーズポイントにy値を追加する方法の解決策を教えてください。
デフォルトのシリーズでフラグを上書きしています。次の行を確認してください。
options.series[0] = json[1];
フラグを新しいシリーズに置き換えます。次のようなオプションを追加する必要があると思います。
options.series.splice(0, 0, json[1]);
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加