Commit d122a3d2 by chenwq

折线图-前5/后5

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