码迷,mamicode.com
首页 > 其他好文 > 详细

Echarts 的Formatter的回调函数

时间:2018-06-28 14:05:10      阅读:1567      评论:0      收藏:0      [点我收藏+]

标签:函数   har   too   func   type   cti   callback   ott   val   

 1 option = {
 2   tooltip: {
 3     trigger: ‘axis‘,
 4     formatter: function (params,ticket,callback) {
 5       let res = params[0].name;
 6       for (let i = 0, l = params.length; i < l; i++) {
 7         res += ‘<br/>‘ + params[i].marker + params[i].seriesName + ‘ : ‘ + params[i].value + ‘KB/s‘;
 8       }
 9       return res
10     },
11     axisPointer: {
12       type: ‘shadow‘
13     }
14   },
15   legend: {
16     itemGap: 15,
17     top: 20,
18     data: [‘流出‘, ‘流入‘]
19   },
20   color: [‘#5170ac‘, ‘#77acff‘],
21   grid: {
22     left: ‘3%‘,
23     right: ‘4%‘,
24     bottom: ‘0%‘,
25     containLabel: true
26   },
27   xAxis: {
28     type: ‘value‘,
29     position: ‘top‘,
30     show : false,
31   },
32   yAxis: {
33     triggerEvent: true,
34     type: ‘category‘,
35     inverse:true,
36     axisLabel: {
37       formatter: function (value) {
38         let res = value;
39         if (res.length > 5) {
40           res = res.substring(0, 4) + "..";
41         }
42         return res;
43       }
44     },
45     data: []
46   },
47 };
48 option = {
49   tooltip: {
50     trigger: ‘axis‘,
51     formatter: function (params,ticket,callback) {
52       let res = params[0].name;
53       for (let i = 0, l = params.length; i < l; i++) {
54         res += ‘<br/>‘ + params[i].marker + params[i].seriesName + ‘ : ‘ + params[i].value + ‘KB/s‘;
55       }
56       return res
57     },
58     axisPointer: {
59       type: ‘shadow‘
60     }
61   },
62   legend: {
63     itemGap: 15,
64     top: 20,
65     data: [‘流出‘, ‘流入‘]
66   },
67   color: [‘#5170ac‘, ‘#77acff‘],
68   grid: {
69     left: ‘3%‘,
70     right: ‘4%‘,
71     bottom: ‘0%‘,
72     containLabel: true
73   },
74   xAxis: {
75     type: ‘value‘,
76     position: ‘top‘,
77     show : false,
78   },
79   yAxis: {
80     triggerEvent: true,
81     type: ‘category‘,
82     inverse:true,
83     axisLabel: {
84       formatter: function (value) {
85         let res = value;
86         if (res.length > 5) {
87           res = res.substring(0, 4) + "..";
88         }
89         return res;
90       }
91     },
92     data: []
93   },
94 };

 

Echarts 的Formatter的回调函数

标签:函数   har   too   func   type   cti   callback   ott   val   

原文地址:https://www.cnblogs.com/mxyr/p/9237959.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!