Highcharts使用jsonp格式数据demo

阅读更多

 

 





Highcharts Example

 











var ShowAjaxDate = {

init: function(begin, end) {

this.begin = begin;

this.end = end;

this.getNewBuy();

},

getNewBuy: function() {

var _this = this;

var param = {

begin: this.begin,

end: _this.end,

callback:'ShowAjaxDate.setAjaxDate'

};

$.ajax({

url: '/manage/newcustomflowquery.jsonp',

data: param,

dataType: 'script',

success: function(r) {

}

});

},

setAjaxDate: function(r) {

var allVisits = [];

var showitem1="下单量";

 

var pvVisitors = [];

var showitem2="pv";

 

var uvVisitors = [];

var showitem3="uv";

 

var datetime = [];

for(i=0;i< r.listCustomFlowQuery.length;i++)

{

allVisits.push(r.listCustomFlowQuery[i].onlProNum);

pvVisitors.push(r.listCustomFlowQuery[i].pv);

uvVisitors.push(r.listCustomFlowQuery[i].uv);

datetime.push(r.listCustomFlowQuery[i].dateTime);

}

var options = {

chart: {

renderTo: 'container',

type: 'line'

},

title: {

text: 'Monthly AverageTemperature'

},

subtitle: {

text: 'Source: WorldClimate.com'

},

exporting:{

enabled:false //用来设置是否显示‘打印’,'导出'等功能按钮,不设置时默认为显示

},

credits: {

enabled: false

},

xAxis: {

categories: []

},

yAxis: {

title: {

text: '次数'

}

},

legend: {

align: 'left',

verticalAlign: 'top',

x: 60,

y: 10,

floating: true,

borderWidth: 0

},

tooltip: {

shared: true,

crosshairs: true

},

plotOptions: {

series: {

cursor: 'pointer',

point: {

events: {

click: function(){

hs.htmlExpand(null, {

pageOrigin: {

x:this.pageX,

y:this.pageY

},

headingText: this.series.name,

maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x)+':
'+ this.y +' visits', width:200 }); } } }, marker: { lineWidth: 1 } } }, series: [{ }, { },{ }] }; options.xAxis.categories=datetime; options.series[0].name = showitem1; options.series[1].name = showitem2; options.series[2].name = showitem3; options.series[0].data = allVisits; options.series[1].data = pvVisitors; options.series[2].data = uvVisitors; var chart = new Highcharts.Chart(options); } };
选择查询日期:
 

 

欢迎大家指正。

你可能感兴趣的:(Highcharts使用jsonp格式数据demo)