|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-10-26 13:37:46
|
|
|
- * @LastEditTime: 2021-12-02 17:41:53
|
|
|
+ * @LastEditTime: 2021-12-08 14:18:58
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: 销售分析图
|
|
|
* @FilePath: \hyyfScreen\src\views\Production\board\ChartSales.vue
|
|
@@ -49,6 +49,9 @@ export default {
|
|
|
trigger: "axis",
|
|
|
formatter: (params) => {
|
|
|
var res = "<div>" + params[0].name + "</div>"; // 字符串形式的html标签会被echarts转换渲染成数据,这个res主要是画的tooltip里的上部分的标题部分
|
|
|
+ const index = this.data.moneyList.findIndex(
|
|
|
+ (item) => item === params[0].value
|
|
|
+ );
|
|
|
for (var i = 0; i < params.length; i++) {
|
|
|
//因为是个数组,所以要遍历拿到里面的数据,并加入到tooltip的数据内容部分里面去
|
|
|
res +=
|
|
@@ -56,11 +59,11 @@ export default {
|
|
|
<span style="display:inline-block;margin-right:5px;border-radius:5px;width:10px;height:10px;background-color:${[
|
|
|
params[i].color, // 默认是小圆点,我们将其修改成有圆角的正方形,这里用的是模板字符串。并拿到对应颜色、名字、数据
|
|
|
]};"></span>
|
|
|
- ${moneyListTooltip[i]}元
|
|
|
+ ${moneyListTooltip[index]}元
|
|
|
</div>` +
|
|
|
`<div><span style="display:inline-block;margin-right:5px;border-radius:5px;width:10px;height:10px;background-color:${[
|
|
|
params[i].color,
|
|
|
- ]};"></span>${quantityList[i]}头</div>`;
|
|
|
+ ]};"></span>${quantityList[index]}头</div>`;
|
|
|
}
|
|
|
return res;
|
|
|
},
|