-1
안녕 나는 아약스로 내 데이터를 받고 있어요, 그들은 JSON으로 오는 내 코드 데이터는 I가 그 데이터를 사용하는 것을 시도하고 그런 다음이여기서 for 루프를 어떻게 사용할 수 있습니까?
[{
"id_buy_report":"1",
"month":"1",
"year":"2016",
"total":"10"
},{
"id_buy_report":"2",
"month":"1",
"year":"2017",
"total":"20"
}]
처럼 보이는이
$.ajax({
async:true,
type: "POST",
dataType: "html",
contentType: "application/x-www-form-urlencoded",
url:"http://sosacelulares.com/index.php/chart/buygeneralreport",
success: function(response) {
var returnedData = JSON.parse(response);
그래서 원형 차트를 작성하고 전체 코드는 이것이다 :
문제는 내 데이터 내가 원형 차트 I를 작성하려는 경우 데이터베이스에서 볼 수있는 방법 오는 것입니다$.ajax({
async:true,
type: "POST",
dataType: "html",
contentType: "application/x-www-form-urlencoded",
url:"http://sosacelulares.com/index.php/chart/buygeneralreport",
success: function(response) {
var returnedData = JSON.parse(response);
var donutData = [
{label: "Series2", data: 10},
{label: "Series3", data: 40},
{label: "Series4", data: 50}
];
$.plot("#donut-chart", donutData, {
series: {
pie: {
show: true,
radius: 1,
innerRadius: 0.5,
label: {
show: true,
radius: 2/3,
formatter: labelFormatter,
threshold: 0.1
}
}
},
legend: {
show: false
}
});
.. 나 데이터를 automaticly 만들 수 있도록하기 위해 (루프) 넣어야
var donutData = [
{label: "Series2", data: 10},
{label: "Series3", data: 40},
{label: "Series4", data: 50}
];
그것은 세 부분으로 원형 차트를 작성한다 .. 여기서 데이터를 배치 할 필요가 있지만, 정적
어떻게 donutData 코드에서 for 루프를 만들 수 있습니까? 모든 루프 그것은 루프에 대한 필요가 없습니다 .. 나는 그것이 자동으로 도넛 데이터를 채울 수있는 루프가 필요합니다. 감사합니다
'dataType와 "HTML을" '<- 뭐? – Phil