Commit 52cec0e5 by 王志慧

动态生成各个标度点的间距

1 parent 539c3a8f
...@@ -88,6 +88,7 @@ export default { ...@@ -88,6 +88,7 @@ export default {
chart: null, chart: null,
lineChart: null, lineChart: null,
lineChartCustomer: null, lineChartCustomer: null,
tickInterval: 5,
orderSource: { orderSource: {
1: '商城订单', 1: '商城订单',
2: '直播订单', 2: '直播订单',
...@@ -251,7 +252,8 @@ export default { ...@@ -251,7 +252,8 @@ export default {
}) })
this.chart.render() this.chart.render()
}, },
lineCustomerChart(id = 'lineCustomerChart') { async lineCustomerChart(id = 'lineCustomerChart') {
await this.dynamicTick() //动态生成各个标度点的间距
this.lineChartCustomer && this.lineChartCustomer.clear() this.lineChartCustomer && this.lineChartCustomer.clear()
this.lineChartCustomer = null this.lineChartCustomer = null
this.lineChartCustomer = new F2.Chart({ this.lineChartCustomer = new F2.Chart({
...@@ -285,7 +287,7 @@ export default { ...@@ -285,7 +287,7 @@ export default {
value: { value: {
type: 'linear', type: 'linear',
nice: true, nice: true,
minTickInterval: 2 tickInterval: this.tickInterval
} }
}) })
this.lineChartCustomer.axis('dayTime', { this.lineChartCustomer.axis('dayTime', {
...@@ -348,6 +350,26 @@ export default { ...@@ -348,6 +350,26 @@ export default {
offsetY: -165 offsetY: -165
}) })
this.lineChartCustomer.render() this.lineChartCustomer.render()
},
dynamicTick() {
let entMicroCountData = [] //新增企微客户数
let newlyCustomerCountData = []
let entMicroCount
let newlyCustomerCount
let tickData = [...this.trendChartList]
tickData.forEach(i => {
entMicroCountData.push(i.entMicroCount)
newlyCustomerCountData.push(i.newlyCustomerCount)
})
entMicroCountData.sort((a, b) => {
return b - a
})
newlyCustomerCountData.sort((a, b) => {
return b - a
})
entMicroCount = entMicroCountData[0]
newlyCustomerCount = newlyCustomerCountData[0]
this.tickInterval = Math.ceil(entMicroCount > newlyCustomerCount ? entMicroCount / 5 : newlyCustomerCount / 5)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!