Commit d94611aa by shaojiawen

update: 图表

parent df78582e
......@@ -12,7 +12,7 @@
<script>
import * as G2 from '@antv/g2';
import filters from '@/filters/index';
// import filters from '@/filters/index';
export default {
components: {},
data() {
......@@ -65,6 +65,9 @@ export default {
nice: true,
min: 0
// type: 'linear'
},
bizDate: {
type: 'cat'
}
});
this.chart.axis('新增人数', {
......@@ -101,34 +104,34 @@ export default {
position: 'top-left',
items: [{ name: '新增人数', value: '新增人数', marker: { symbol: 'line', style: { stroke: '#4B74E8', lineWidth: 12, lineHeight: 8 } } }]
});
if (this.charData.length > 1) {
this.chart
.line()
.position('bizDate*新增人数')
.color('#4B74E8');
// .tooltip('addNum', addNum => {
// return {
// name: '新增人数',
// value: addNum
// };
// });
} else if (this.charData.length == 1) {
let time = new Date(this.charData[0].bizDate).getTime();
let start = { 新增人数: null, bizDate: filters.timeStampToYmd(time - 86400000) };
let end = { 新增人数: null, bizDate: filters.timeStampToYmd(time + 86400000) };
let list = [start, this.charData[0], end];
this.chart.data(list);
this.chart
.point()
.position('bizDate*新增人数')
.color('#4B74E8');
// .tooltip('addNum', addNum => {
// return {
// name: '新增人数',
// value: addNum
// };
// });
}
// if (this.charData.length > 1) {
this.chart
.line()
.position('bizDate*新增人数')
.color('#4B74E8');
// .tooltip('addNum', addNum => {
// return {
// name: '新增人数',
// value: addNum
// };
// });
// } else if (this.charData.length == 1) {
// let time = new Date(this.charData[0].bizDate).getTime();
// let start = { 新增人数: null, bizDate: filters.timeStampToYmd(time - 86400000) };
// let end = { 新增人数: null, bizDate: filters.timeStampToYmd(time + 86400000) };
// let list = [start, this.charData[0], end];
// this.chart.data(list);
// this.chart
// .point()
// .position('bizDate*新增人数')
// .color('#4B74E8');
// // .tooltip('addNum', addNum => {
// // return {
// // name: '新增人数',
// // value: addNum
// // };
// // });
// }
this.chart.removeInteraction('legend-filter'); // 自定义图例,移除默认的分类图例筛选交互
//图表绘制的最后一步,用于将图表渲染至画布
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment