0
変数 "temp"のデータで円グラフを作成しようとしています。データはコンソールの画像に表示されます。どうすればこれを始めるべきですか?JavaScriptを使用してデータを動的にする方法
$(function() {
var temp = <?php echo $branch_emp; ?>;
console.log(temp);
$('#pie_chart').highcharts({
chart: {
type: 'pie',
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Incident Report'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: true,
format: '{point.name}'
}
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
//this is where i want the data
// temp.foreach(function(){
['a', 50.0],
['b', 25.0],
['c', 25.0],
// })
]
}]
});
});
にプロパティ
branch_name
とtotalemp
を持つオブジェクトのあなたの配列をオンにするmap
を使用したいあなたはjQueryとjsの他の参照を追加している – Ajay2707