Home > front end >  Ajax request back data assignment to amcharts, image display
Ajax request back data assignment to amcharts, image display

Time:04-20

Var chartData=https://bbs.csdn.net/topics/[];
The function initChart (chartData) {
The console. The 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" : {
1
"fillAlphas" :},
"Rotate" : true,
"CategoryField" : "category",
"SegmentsField" : "segments,"
"ColorField" : "color",
"StartDate" : "2017-01-01,"
"StartField" : "start",
"EndField" : "the end",
"DurationField" : "duration",
"DataProvider" : [],
"ValueScrollbar" : {
"AutoGridCount" : true
},
"ChartCursor" : {
"CursorColor" : "# 55 bb76,"
"ValueBalloonsEnabled" : false,
"CursorAlpha" : 0,
"ValueLineAlpha" : 0.5,
"ValueLineBalloonEnabled" : true,
"ValueLineEnabled" : true,
"Zoomable" : false,
"ValueZoomable" : true
},
"Export" : {
"Enabled" : true
}
});
Chart. DataProvider=chartData;
}
This is what I call the plug-in inside the gantt chart method
Below is my ajax request
The 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" : the netType,
"StartTime" : start_time,
"EndTime" : end_time
},
Success: the function (data) {
for(var i=0; iChartData. Push ({
"Category" : data [I] the category,
"Segments" : data [I] segments
})
}
InitChart (chartData);
//the console. The log (chartData);
Window. The parent. HideLoad ();
},
Error: function () {
Alert (" Response failure!" );
Window. The parent. HideLoad ();
}
});
}
Data has been coming, but does not display the image on a page, still beg god to help us solve, little sister here appreciate

CodePudding user response:

Have a great god help me reply the ah, is in a hurry

CodePudding user response:

I also encountered the same problem today? May I have your this problem solved? How to solve the
  • Related