Formatter:function (params){//Data Unit formatting varRelval =params[0].name;//x-axis name for(vari =0, L =params. length; I < L; i++) { if(params[I].value] {Relval+='<br/>'+params[I].seriesname +' : '+ (params[i].value*100+"%"; }} console.log (params) returnRelval; }
This kind of formatter in the data format will appear strange, similar to the problem of 50.000001%
The solution is to cut
For example slice (2,4) Slice the first parameter at the beginning of the cut, the second parameter is cut to the number of a,
Code submission:
Formatterfunction(params) {//Data Unit formatting varRelval = Params[0].name;//x-axis name for(vari = 0, L = params.length; I < L; i++) { if(params[i].value) {Relval+ = ' <br/> ' + params[i].seriesname + ': ' + (String (params[i].value)). Slice (2,4) + "%"; }} console.log (params)returnRelval; }
JS in echarts multiple line chart numbers *100 strange appearing decimal