방금 하이 차트를 사용하기 시작했습니다. 여기에 붙어 있습니다. -하이 차트에 배열을 전달하는 방법 ??
데이터베이스에서 가져 오는 js_platform, js_totalTest
이라는 배열이 2 개 있습니다.
차트를 생성하는 코드는 - 내가 js_totalTest의 배열 값을 보낼 시리즈 이제
<!DOCTYPE html>
<body>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"> </script>
<script>
$(function() {
js_platform = <?php echo json_encode($platform); ?>;
js_totalTest = <?php echo json_encode($totalTest); ?>;
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Overall avalibility of testcases on each platform'
},
xAxis: {
categories: js_platform
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: -70,
verticalAlign: 'top',
y: 20,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.series.name +': '+ this.y +'<br/>'+
'Total: '+ this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
style: {
textShadow: '0 0 3px black, 0 0 3px black'
}
}
}
},
series: [{
name: 'John',
data: [5, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
});
});
</script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
</html>
.
여기 내가 **series: [{data: [js_totalTest]}]**
같은 것을하면 아무 것도 표시되지 않습니다.
어떻게 할 수 있습니까? 안내하십시오.
을 참조하십시오. json 형식으로 시리즈 데이터를 전달해야합니다. – Gowri
MM ... 네, 저는 단지 js_Toaltest의 모든 값을 직렬로 원합니다. 이 코드는 피곤하지만 작동하지 않습니다. - 'var mySeries = []; for (var i = 0; i
user3496418