ecomfe / echarts-liquidfill

Liquid Fill Chart for Apache ECharts
https://ecomfe.github.io/echarts-liquidfill/example/
BSD 3-Clause "New" or "Revised" License
1.47k stars 620 forks source link

水球图数值无法显示小数点 #144

Closed frkijh closed 3 years ago

frkijh commented 3 years ago
我目前使用的是 "echarts-liquidfill": "^3.0.0" "vue": "^2.6.11", "echarts": "^5.2.0", 然后想给水球图中心数值设置个保留两位的百分数,发现数字结尾的小数点被四舍五入了 ```js var option = { series: [ { type: "liquidFill", itemStyle: { opacity: 0.4, shadowBlur: 0, shadowColor: "blue", }, name: liquidTitle ? liquidTitle : "水球图内置文本", // Liquid inner data data: [ { value: percent, itemStyle: { color: "#53d5ff", opacity: 0.6, }, }, ], color: ["#53d5ff"], // liquidChart position center: ["50%", "50%"], outline: { itemStyle: { borderColor: "#86c5ff", borderWidth: 0, }, borderDistance: 0, }, }, ] }; ``` ![image](https://user-images.githubusercontent.com/59047022/132177005-054b5264-24bb-4bf8-9ddb-c90691dbb99a.png)
frkijh commented 3 years ago

解决了,在liquidFill里加入一个label

            label: {
              formatter:function(params){
                console.log('params: ', params.value);
                return params.value*100 +'%'
              },
              // formatter: "34.34%", //水球上显示文字,可以设置任意文字
              show: true,
            },