This commit is contained in:
罗松柏 2021-07-24 00:12:34 +08:00
parent 2a5387fba6
commit ad569eb8d4
2 changed files with 112 additions and 98 deletions

105
web/src/x.min.js vendored
View File

@ -3219,6 +3219,7 @@ var X = window.X || {
X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){ X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){
var eventdata=[]; var eventdata=[];
var index = d.length;
for(let i in d){ for(let i in d){
X.api("ck/"+d[i]['model']+"_model","post",{report_id:d[i]['report_id']},function(val){ X.api("ck/"+d[i]['model']+"_model","post",{report_id:d[i]['report_id']},function(val){
// console.log(val); // console.log(val);
@ -3242,57 +3243,63 @@ var X = window.X || {
}) })
} }
} }
index --;
}) console.log(eventdata);
} if(index <= 0){
console.log(eventdata); X.template("modeltable","chart-box",eventdata,function(){
X.template("modeltable","chart-box",eventdata,function(){ for(let i in eventdata){
for(let i in eventdata){ if(eventdata[i]['modeltype'] == 'echarts'){
if(eventdata[i]['modeltype'] == 'echarts'){ var myChart = echarts.init(document.getElementById(eventdata[i]['id']));
var myChart = echarts.init(document.getElementById(eventdata[i]['id'])); var option = {
var option = { title: {
title: { text: ''
text: '' },
}, color: X.DATA.echartscolor,
color: X.DATA.echartscolor, tooltip: {
tooltip: { trigger: 'axis',
trigger: 'axis', axisPointer: {
axisPointer: { type: 'cross',
type: 'cross', label: {
label: { backgroundColor: '#6a7985'
backgroundColor: '#6a7985' }
} }
},
legend: {
type:'scroll',
data: eventdata[i]['legenddata']
},
grid: {
left: '2%',
right: '2%',
bottom: '2%',
top: '10%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: eventdata[i]['xAxisData']
}
],
yAxis: [
{
type: 'value'
}
],
series: eventdata[i]['seriesData']
};
myChart.setOption(option,true);
} }
}, }
legend: { });
type:'scroll',
data: eventdata[i]['legenddata']
},
grid: {
left: '2%',
right: '2%',
bottom: '2%',
top: '10%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: eventdata[i]['xAxisData']
}
],
yAxis: [
{
type: 'value'
}
],
series: eventdata[i]['seriesData']
};
myChart.setOption(option,true);
} }
} })
});
}

View File

@ -241,6 +241,7 @@
X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){ X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){
var eventdata=[]; var eventdata=[];
var index = d.length;
for(let i in d){ for(let i in d){
X.api("ck/"+d[i]['model']+"_model","post",{report_id:d[i]['report_id']},function(val){ X.api("ck/"+d[i]['model']+"_model","post",{report_id:d[i]['report_id']},function(val){
// console.log(val); // console.log(val);
@ -264,57 +265,63 @@
}) })
} }
} }
index --;
}) console.log(eventdata);
} if(index <= 0){
console.log(eventdata); X.template("modeltable","chart-box",eventdata,function(){
X.template("modeltable","chart-box",eventdata,function(){ for(let i in eventdata){
for(let i in eventdata){ if(eventdata[i]['modeltype'] == 'echarts'){
if(eventdata[i]['modeltype'] == 'echarts'){ var myChart = echarts.init(document.getElementById(eventdata[i]['id']));
var myChart = echarts.init(document.getElementById(eventdata[i]['id'])); var option = {
var option = { title: {
title: { text: ''
text: '' },
}, color: X.DATA.echartscolor,
color: X.DATA.echartscolor, tooltip: {
tooltip: { trigger: 'axis',
trigger: 'axis', axisPointer: {
axisPointer: { type: 'cross',
type: 'cross', label: {
label: { backgroundColor: '#6a7985'
backgroundColor: '#6a7985' }
} }
},
legend: {
type:'scroll',
data: eventdata[i]['legenddata']
},
grid: {
left: '2%',
right: '2%',
bottom: '2%',
top: '10%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: eventdata[i]['xAxisData']
}
],
yAxis: [
{
type: 'value'
}
],
series: eventdata[i]['seriesData']
};
myChart.setOption(option,true);
} }
}, }
legend: { });
type:'scroll',
data: eventdata[i]['legenddata']
},
grid: {
left: '2%',
right: '2%',
bottom: '2%',
top: '10%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: eventdata[i]['xAxisData']
}
],
yAxis: [
{
type: 'value'
}
],
series: eventdata[i]['seriesData']
};
myChart.setOption(option,true);
} }
} })
});
}