Commit d122a3d2 by chenwq

折线图-前5/后5

1 parent beb57e01
......@@ -133,18 +133,18 @@ export default {
})
// 移除图表
this[this.domId].on('globalout', () => {
this.chartAction()
})
// this[this.domId].on('globalout', () => {
// this.chartAction()
// })
},
chartAction(type) {
this[this.domId].dispatchAction({
type: type || 'showTip',
seriesIndex: +this.moveAttr.seriesIndex,
dataIndex: +this.moveAttr.dataIndex
})
},
// chartAction(type) {
// this[this.domId].dispatchAction({
// type: type || 'showTip',
// seriesIndex: +this.moveAttr.seriesIndex,
// dataIndex: +this.moveAttr.dataIndex
// })
// },
getRankList(idx, attrName = 'topList') {
this.dataList[idx][attrName].length ? this.$set(this, 'rankList', this.dataList[idx][attrName]) : this.resetRankList()
......@@ -163,7 +163,7 @@ export default {
this[this.domId].setOption(this.lineOptions)
// 默认展示tooltip
this.chartAction()
// this.chartAction()
this.getRankList(0)
},
......
......@@ -10,7 +10,6 @@ function getLineOptions(obj) {
color: '#FFFFFF',
fontSize: '8px'
},
extraCssText: 'width: 100px;',
formatter: tooltipFormatter || ''
},
grid: {
......@@ -34,7 +33,8 @@ function getLineOptions(obj) {
lineStyle: {
color: '#606266'
}
}
},
splitNumber: 4
},
series: [
{
......
......@@ -84,13 +84,13 @@ export default {
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
value: topTempList[item] ? this.numAddSymbol(topTempList[item]) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
value: lastTempList[item] ? this.numAddSymbol(lastTempList[item]) : '- -'
})
})
this.dataList.push({
......
......@@ -86,13 +86,13 @@ export default {
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
value: topTempList[item] ? this.numAddSymbol(topTempList[item]) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
value: lastTempList[item] ? this.numAddSymbol(lastTempList[item]) : '- -'
})
})
this.dataList.push({
......
......@@ -101,13 +101,13 @@ export default {
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].num?this.numAddSymbol(topTempList[item].num):'- -'
value: topTempList[item].num ? this.numAddSymbol(topTempList[item].num) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item].num)
value: lastTempList[item].num ? this.numAddSymbol(lastTempList[item].num) : '- -'
})
})
this.dataList.push({
......
......@@ -15,7 +15,7 @@
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="keepChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType" :tooltipFormatterObj="tooltipFormatterObj"></LineChart>
<LineChart v-else ref="lineChartRef" domId="keepChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType"></LineChart>
</div>
</div>
</template>
......@@ -101,13 +101,13 @@ export default {
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
value: topTempList[item] ? this.numAddSymbol(topTempList[item]) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
value: lastTempList[item] ? this.numAddSymbol(lastTempList[item]) : '- -'
})
})
this.dataList.push({
......
......@@ -37,23 +37,24 @@ export default {
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: [],
tooltipFormatterObj:[
{
label: '流失率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
tooltipFormatterObj:
[
{
label: '流失率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
},
mounted() { },
......@@ -101,13 +102,13 @@ export default {
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
value: topTempList[item] ? this.numAddSymbol(topTempList[item]) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
value: lastTempList[item] ? this.numAddSymbol(lastTempList[item]) : '- -'
})
})
this.dataList.push({
......
......@@ -84,13 +84,13 @@ export default {
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item].num)
value: topTempList[item].num ? this.numAddSymbol(topTempList[item].num) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item].num)
value: lastTempList[item].num ? this.numAddSymbol(lastTempList[item].num) : '- -'
})
})
this.dataList.push({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!