// 显示图形
function showChart2(yset,currentTime,crewName) {
var container1 = document.getElementById('container1');
var option = {
title : {
text: crewName+currentTime+'成本要素组占比分析饼图',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient : 'vertical',
x : 'left',
data:yset
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {
show: true,
type: ['pie', 'funnel'],
option: {
funnel: {
x: '25%',
width: '50%',
funnelAlign: 'left'
}
}
},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
series : [
{
name:'要素组消耗成本',
type:'pie',
radius : '55%',
center: ['50%', '60%'],
data:yset
}
]
};
echartImport(option,container1);
}
//数据填充图表
function echartImport(option,container){
/*
* echarts按照AMD规范书写
*/
require.config({
paths: {
echarts: 'frame/echarts/' // echarts主路径
}
});
require(
[
'echarts', // 加载在主路径(frame/echarts/)下面的echarts.js文件
'echarts/chart/bar',
'echarts/chart/pie'
],
function (ec) {
// 基于准备好的dom,初始化echarts图表
var echart = ec.init(container1);
// 为echarts对象加载数据
echart.setOption(option);
}
);
}
// 请求图形数据数据
function getCurrentDataByCrewName(currentTime, crewName) {
$.post("crewaccountController/getCurrentDataByCrewName.do", {
currentTime : currentTime,
crewName : crewName
}, function(result) {
if (result) {
var yset = [];
var jsonobj = eval("(" + result + ")");
jsonobj = jsonobj.rows;
for(var i = 0;i<jsonobj.length;i++){
var obj = {};
obj.name = jsonobj[i].elmtGroupName;
obj.value = jsonobj[i].proportion;
yset.push(obj);
}
showChart2(yset,currentTime,crewName);
}
});
}
function showChart2(yset,currentTime,crewName) {
var container1 = document.getElementById('container1');
var option = {
title : {
text: crewName+currentTime+'成本要素组占比分析饼图',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient : 'vertical',
x : 'left',
data:yset
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {
show: true,
type: ['pie', 'funnel'],
option: {
funnel: {
x: '25%',
width: '50%',
funnelAlign: 'left'
}
}
},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
series : [
{
name:'要素组消耗成本',
type:'pie',
radius : '55%',
center: ['50%', '60%'],
data:yset
}
]
};
echartImport(option,container1);
}
//数据填充图表
function echartImport(option,container){
/*
* echarts按照AMD规范书写
*/
require.config({
paths: {
echarts: 'frame/echarts/' // echarts主路径
}
});
require(
[
'echarts', // 加载在主路径(frame/echarts/)下面的echarts.js文件
'echarts/chart/bar',
'echarts/chart/pie'
],
function (ec) {
// 基于准备好的dom,初始化echarts图表
var echart = ec.init(container1);
// 为echarts对象加载数据
echart.setOption(option);
}
);
}
// 请求图形数据数据
function getCurrentDataByCrewName(currentTime, crewName) {
$.post("crewaccountController/getCurrentDataByCrewName.do", {
currentTime : currentTime,
crewName : crewName
}, function(result) {
if (result) {
var yset = [];
var jsonobj = eval("(" + result + ")");
jsonobj = jsonobj.rows;
for(var i = 0;i<jsonobj.length;i++){
var obj = {};
obj.name = jsonobj[i].elmtGroupName;
obj.value = jsonobj[i].proportion;
yset.push(obj);
}
showChart2(yset,currentTime,crewName);
}
});
}