highcharts 怎样动态为series的name,data赋值

java得到map传给前台。 得到的map的key为 series的name,values为data。 怎样实现?

series的name不是数组,是一个固定值,用来标识曲线的,你指的是x轴的值吧,将后台返回的结果组成两个数组,分别赋值给xAxis:categories(x坐标)和series:data(y坐标)

$.ajax({
url: '/Ajaxxxxx/xxxx.cspx',
type: 'POST',
dataType: 'text',
success: function (datas) {
var json = eval(datas);
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: '账龄分析'
},
//绑定鼠标放上后显示的字段
tooltip: {
pointFormat: '{series.name}: {point.percentage:.1f}%'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
//绑定饼图外围字段
format: '{point.name}: {point.y}'
},
//显示类别标识框
showInLegend:true
}
},
series: [{
type: 'pie',
name: '金额',
//数据源
data: json
}]
});

        }
    });

不知道对你有么有帮助,name值如果存在与json内可直接获取的,如果不是就要再执行另一个ajax取值了

map.put("name",name);
map.put("data",data);
list.add(map)
ajax接收到data
之后series:[data]
前台就不拼了....

问百度呗,我也不知道,想问呢~