提交 e8852b0f authored 作者: lihuihui's avatar lihuihui

update:分数区间开发

上级 3fcfd94f
......@@ -71,18 +71,22 @@ export default {
}
},
mounted() {
const myChart = echarts.init(document.getElementById('score'))
myChart.setOption(this.option)
this.scoreRangeChange([{ a: 0, b: 100 }])
},
methods: {
scoreRangeChange(data) {
// [
// { value: 1048, name: 'Search Engine', itemStyle: { color: '#6F85CC' } },
// { value: 735, name: 'Direct', itemStyle: { color: '#96C080' } },
// { value: 580, name: 'Email', itemStyle: { color: '#EAC370' } },
// { value: 484, name: 'Union Ads', itemStyle: { color: '#D96685' } },
// { value: 300, name: 'Video Ads', itemStyle: { color: '#B170CE' } }
// ]
const arr = [0, 10, 11, 12, 13, 20, 22, 24, 50, 50, 50, 21, 54, 100]
const colors = ['#6F85CC', '#96C080', '#EAC370', '#D96685', '#B170CE']
this.option.series[0].data = data.reduce((prev, cur, index) => {
let count = 0
arr.forEach(i => {
if (i >= (i === 0 ? cur.a : cur.a + 1) && i <= cur.b) count++
})
prev.push({ value: count, name: `${cur.a}-${cur.b}`, itemStyle: colors[index] })
return prev
}, [])
const myChart = echarts.init(document.getElementById('score'))
myChart.setOption(this.option)
this.isSetScoreRange = false
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论