var chartData = [];
function initChart(chartData){
console.log(JSON.stringify(chartData))
var chart = AmCharts.makeChart( "chartdiv", {
"type": "gantt",
"theme": "none",
"marginRight": 70,
"period": "hh",
"dataDateFormat":"YYYY-MM-DD",
"balloonDateFormat": "JJ:NN",
"columnWidth": 0.3,
"valueAxis": {
"type": "date"
},
"brightnessStep": 10,
"graph": {
"fillAlphas": 1
},
"rotate": true,
"categoryField": "category",
"segmentsField": "segments",
"colorField": "color",
"startDate": "2017-01-01",
"startField": "start",
"endField": "end",
"durationField": "duration",
"dataProvider": [],
"valueScrollbar": {
"autoGridCount":true
},
"chartCursor": {
"cursorColor":"#55bb76",
"valueBalloonsEnabled": false,
"cursorAlpha": 0,
"valueLineAlpha":0.5,
"valueLineBalloonEnabled": true,
"valueLineEnabled": true,
"zoomable":false,
"valueZoomable":true
},
"export": {
"enabled": true
}
});
chart.dataProvider = chartData;
}
這上面是我呼叫這個插件里面的甘特圖方法
下面是我ajax請求
function gantt_chart(imsi,netType){
var start_time = $("#start_time").val();
var end_time = $("#end_time").val();
$.ajax({
url : "${request.contextPath}/analyze/ganttChart.do",
type : "post",
dataType : "json",
async:true,
data : {
"imsi" : imsi,
"netType" : netType,
"startTime" : start_time,
"endTime" : end_time
},
success : function(data) {
for(var i=0;i<data.length;i++){
chartData.push({
"category":data[i].category,
"segments":data[i].segments
})
}
initChart(chartData);
//console.log(chartData);
window.parent.hideLoad();
},
error : function() {
alert("Response failure!");
window.parent.hideLoad();
}
});
}
資料已經傳過來了,但是頁面上不顯示影像,還求大神幫忙解答一下,小妹在這里感激不盡
uj5u.com熱心網友回復:
有沒有大神幫忙回復一下啊,比較著急uj5u.com熱心網友回復:
我今天也遇到同樣的問題?請問你這問題解決了嗎?怎么解決的轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/277951.html
標籤:JavaScript
上一篇:想要把陣列外層的selected和chlidren里面的selected屬性都改為false 這個遞回改怎么寫呀?代碼在下面
下一篇:使用vue-admin-template模版參考自己的后臺get報錯Request failed with status code 404
