|
|
@ -59,103 +59,103 @@ export default { |
|
|
|
let data = res.data.warningSourceList; |
|
|
|
let total = res.data.total; |
|
|
|
|
|
|
|
if (data.length > 0) { |
|
|
|
let chartData = [ |
|
|
|
{ |
|
|
|
average: 0, |
|
|
|
name: '视频AI ', |
|
|
|
percent: 0.3 |
|
|
|
}, |
|
|
|
{ |
|
|
|
average: 0, |
|
|
|
name: '雷达识别', |
|
|
|
percent: 0.2 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '锥桶', |
|
|
|
percent: 0.1 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '护栏碰撞', |
|
|
|
percent: 0.2 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '扫码报警', |
|
|
|
percent: 0.1 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '非机预警', |
|
|
|
percent: 0.1 |
|
|
|
}, |
|
|
|
] |
|
|
|
data.forEach(it => { |
|
|
|
if (it.warningSource == 1) { |
|
|
|
chartData[0].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 2) { |
|
|
|
chartData[1].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 3) { |
|
|
|
chartData[2].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 4) { |
|
|
|
chartData[3].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 5) { |
|
|
|
chartData[4].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 6) { |
|
|
|
chartData[5].average += it.number; |
|
|
|
} |
|
|
|
// total ++; |
|
|
|
// drawRoundRect(context, 231, 37 + (index * 27), 138, 20, 12, gr); |
|
|
|
// if (data.length > 0) { |
|
|
|
let chartData = [ |
|
|
|
{ |
|
|
|
average: 0, |
|
|
|
name: '视频AI', |
|
|
|
percent: 0.3 |
|
|
|
}, |
|
|
|
{ |
|
|
|
average: 0, |
|
|
|
name: '雷达识别', |
|
|
|
percent: 0.2 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '锥桶', |
|
|
|
percent: 0.1 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '护栏碰撞', |
|
|
|
percent: 0.2 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '扫码报警', |
|
|
|
percent: 0.1 |
|
|
|
}, { |
|
|
|
average: 0, |
|
|
|
name: '非机预警', |
|
|
|
percent: 0.1 |
|
|
|
}, |
|
|
|
] |
|
|
|
data.forEach(it => { |
|
|
|
if (it.warningSource == 1) { |
|
|
|
chartData[0].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 2) { |
|
|
|
chartData[1].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 3) { |
|
|
|
chartData[2].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 4) { |
|
|
|
chartData[3].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 5) { |
|
|
|
chartData[4].average += it.number; |
|
|
|
} |
|
|
|
if (it.warningSource == 6) { |
|
|
|
chartData[5].average += it.number; |
|
|
|
} |
|
|
|
// total ++; |
|
|
|
// drawRoundRect(context, 231, 37 + (index * 27), 138, 20, 12, gr); |
|
|
|
}) |
|
|
|
// console.log('data',chartData) |
|
|
|
let colorList = ['#006EDF', '#00FF00', '#FFC30D', '#FF8400', '#1DA7FF', '#2967EA']; |
|
|
|
let lengData = []; |
|
|
|
let mainData = []; |
|
|
|
|
|
|
|
for (let i = 0; i < chartData.length; i++) { |
|
|
|
let it = chartData[i]; |
|
|
|
lengData.push({ |
|
|
|
name: it.name, |
|
|
|
color: colorList[i], |
|
|
|
value: it.average, |
|
|
|
}); |
|
|
|
mainData.push({ |
|
|
|
name: it.name, |
|
|
|
color: colorList[i], |
|
|
|
value: it.average, |
|
|
|
percent: (it.average / total) || 0 |
|
|
|
}) |
|
|
|
// console.log('data',chartData) |
|
|
|
let colorList = ['#006EDF', '#00FF00', '#FFC30D', '#FF8400', '#1DA7FF', '#2967EA']; |
|
|
|
let lengData = []; |
|
|
|
let mainData = []; |
|
|
|
|
|
|
|
for (let i = 0; i < chartData.length; i++) { |
|
|
|
let it = chartData[i]; |
|
|
|
lengData.push({ |
|
|
|
name: it.name, |
|
|
|
color: colorList[i], |
|
|
|
value: it.average, |
|
|
|
}); |
|
|
|
mainData.push({ |
|
|
|
name: it.name, |
|
|
|
color: colorList[i], |
|
|
|
value: it.average, |
|
|
|
percent: it.average / total |
|
|
|
}) |
|
|
|
} |
|
|
|
window.mainData = mainData; |
|
|
|
// console.log('mainData', mainData) |
|
|
|
chartsStatistics.title.text = `{tb|${total}}`; |
|
|
|
chartsStatistics.title.subtext = "{zb|总数}"; |
|
|
|
|
|
|
|
chartsStatistics.legend.data = lengData; |
|
|
|
chartsStatistics.series[0].data = mainData; |
|
|
|
|
|
|
|
myChart.on('mouseover', (params) => { |
|
|
|
// console.log('params',params) |
|
|
|
if (params.componentType == 'graphic') { |
|
|
|
return |
|
|
|
} |
|
|
|
window.mainData = mainData; |
|
|
|
// console.log('mainData', mainData) |
|
|
|
chartsStatistics.title.text = `{tb|${params.percent}%}`; |
|
|
|
chartsStatistics.title.subtext = `{zb|${params.data.name}}`; |
|
|
|
// chartsStatistics.title.left = "22%"; |
|
|
|
myChart.setOption(chartsStatistics); |
|
|
|
}) |
|
|
|
|
|
|
|
// 用户鼠标移出时,重新开始自动切换 |
|
|
|
myChart.on('mouseout', (params) => { |
|
|
|
chartsStatistics.title.text = `{tb|${total}}`; |
|
|
|
chartsStatistics.title.subtext = "{zb|总数}"; |
|
|
|
|
|
|
|
chartsStatistics.legend.data = lengData; |
|
|
|
chartsStatistics.series[0].data = mainData; |
|
|
|
|
|
|
|
myChart.on('mouseover', (params) => { |
|
|
|
// console.log('params',params) |
|
|
|
if (params.componentType == 'graphic') { |
|
|
|
return |
|
|
|
} |
|
|
|
chartsStatistics.title.text = `{tb|${params.percent}%}`; |
|
|
|
chartsStatistics.title.subtext = `{zb|${params.data.name}}`; |
|
|
|
// chartsStatistics.title.left = "22%"; |
|
|
|
myChart.setOption(chartsStatistics); |
|
|
|
}) |
|
|
|
|
|
|
|
// 用户鼠标移出时,重新开始自动切换 |
|
|
|
myChart.on('mouseout', (params) => { |
|
|
|
chartsStatistics.title.text = `{tb|${total}}`; |
|
|
|
chartsStatistics.title.subtext = "{zb|总数}"; |
|
|
|
// chartsStatistics.title.left = "25%"; |
|
|
|
myChart.setOption(chartsStatistics); |
|
|
|
}) |
|
|
|
} |
|
|
|
// chartsStatistics.title.left = "25%"; |
|
|
|
myChart.setOption(chartsStatistics); |
|
|
|
}) |
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|