# up history linechart x-axis
This commit is contained in:
parent
076c486cf4
commit
ae878dbca2
|
@ -27,6 +27,9 @@ export default {
|
|||
},
|
||||
chartData: {
|
||||
type: Object
|
||||
},
|
||||
xAxis: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -35,6 +38,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.xAxis)
|
||||
this.initChart()
|
||||
if (this.autoResize) {
|
||||
this.__resizeHanlder = debounce(() => {
|
||||
|
@ -75,8 +79,12 @@ export default {
|
|||
setOptions({ totalHistoryData, actualData } = {}) {
|
||||
this.chart.setOption({
|
||||
xAxis: {
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
data: this.xAxis,
|
||||
boundaryGap: false,
|
||||
axisLabel: {
|
||||
interval: 0
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</panel-group>
|
||||
|
||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
||||
<line-chart :chart-data="lineChartData"></line-chart>
|
||||
<line-chart :chart-data="lineChartData" :xAxis="this.lineChartData.xAxis"></line-chart>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
|
@ -74,7 +74,9 @@ import
|
|||
|
||||
const lineChartData = {
|
||||
historyData: {
|
||||
totalHistoryData: []
|
||||
totalHistoryData: [],
|
||||
incrementHistoryData: [],
|
||||
xAxis: []
|
||||
},
|
||||
messages: {
|
||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
||||
|
@ -134,10 +136,13 @@ export default {
|
|||
},
|
||||
handleHistoryLine(historyList) {
|
||||
var totalList = []
|
||||
var dateList = []
|
||||
historyList.forEach((item, index) => {
|
||||
totalList.push(item.total)
|
||||
dateList.push(item.date.substr(5))
|
||||
})
|
||||
this.lineChartData.totalHistoryData = totalList.reverse()
|
||||
this.lineChartData.xAxis = dateList.reverse()
|
||||
// console.log(this.lineChartData.totalHistoryData)
|
||||
}
|
||||
// getLogStatisticHistory() {
|
||||
|
|
Loading…
Reference in New Issue