Referring to the example chart on https://echarts.apache.org/examples/en/editor.html?c=map-usa (see also screenshot),how can I display the numbers in the slider on the right with a decimal seperator (like in the map for e.g. Texas)?
0
votes
1 Answers
0
votes
I found it out. My solution:
replace visualMap:{}with this code-snippet:
visualMap: {
left: 'right',
min: 500000,
max: 38000000,
inRange: {
color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
},
text:['High','Low'], // 文本,默认为数值文本
calculable: true,
formatter: function (value) {
value = Math.round(value);
let _count=value+"";
let _st=""
_count.split("").reverse().forEach((a,b)=>{
_st+=a;
b%3===2&&b!=_count.length-1?_st+=",":null;
})
_st=_st.split("").reverse().join("");
return _st;
}
},
gives you this solution