<div class="ringlike-chart" echarts [options]="options" (chartInit)="onChartInitOne($event)"></div>
 
// 初始化
public onChartInitOne(value: any): void {
    this.qualityControlBar = value;
}
 
// 值更新的时候重新set
this.qualityControlBar.setOption(this.options, true);


public options = {
backgroundColor: '#fff',
title: { // 标题
text: '漏诊改善趋势',
padding: [5, 0, 12, 30],
textStyle: {
color: '#000000',
fontStyle: 'normal',
fontWeight: 500,
fontFamily: 'Source Han Sans CN',
fontSize: 16,
},
},
tooltip: { // 悬浮提示
trigger: 'axis',
formatter: (params: any) => {
return this.tooltipFormatter(params);
},
},
legend: { // 头部说明
icon: 'rect',
itemHeight: 2,
itemWidth: 16,
x: 'left',
y: 'top',
padding: [40, 0, 0, 30],
textStyle: {
fontSize: '12px',
},
data: []
},
grid: { // 图的布局
left: '3%',
right: '4%',
bottom: '10%',
top: '25%',
containLabel: true
},
toolbox: { // 是否显示下载
feature: {
saveAsImage: {
show: false
}
}
},
dataZoom: [{
type: 'slider',
show: true,
xAxisIndex: [0],
left: '9%',
bottom: 0,
start: 10,
end: 90, // 初始化滚动条
height: 14,
}],
xAxis: {
type: 'category',
boundaryGap: false,
data: [
]
},
yAxis: {
type: 'value',
min: 0, // 配置 Y 轴刻度最小值
max: 100, // 配置 Y 轴刻度最大值
splitNumber: 5, // 配置 Y 轴数值间隔
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
},
},
axisLabel: {
formatter: (res) => {
if (res === 0) {
return 0;
}
return res + '%';
},
},
axisLine: { show: false },
axisTick: { show: false }
},
series: [
]
};

// 此处修改悬浮展示内容
  public tooltipFormatter(params: any): string {
    const arr = [];
    if (params instanceof Array) {
      const flag = params.every((item: any) => {
        if (typeof item.data === 'undefined') {
          return item;
        }
      });
      if (flag) {
        return '';
      }
      params.forEach((item: any) => {
        const span = `<span style="width:10px;height:10px;display:inline-block;background:${item.color};margin-right:4px;border-radius:50%;"></span>`;
        const value1 = item.value ? item.value + '%' : '0.00%';
        const div1 = `<div style="text-align:right;margin-left:20px;">${value1}</div>`;
        const div2 = `<div>${span}${item.seriesName}</div>`;
        const div3 = `<div style="line-height:20px;display:flex;justify-content: space-between;min-width:200px;">${div2}${div1}</div>`;
        const tmp: string = `${div3}`;
        arr.push(tmp);
      });
    }
    arr.unshift(`<div>${params[0].axisValueLabel}<div>`);
    return arr.join('\n');
  }
 

最新文章

  1. The Euler function[HDU2824]
  2. Eclipse Android环境搭建
  3. electrica writeup
  4. 【Spring】简单的Spring MVC入门例子
  5. Linux Free命令各数字含义及Buffer和Cache的区别
  6. js 模拟ajax方式提交数据
  7. C和设计原则
  8. 【加密】C#.NET 各种加密解密
  9. ∑–△型模数转换器(ADC)简介
  10. iOS中UITextField 使用全面解析
  11. 最简单的代码,CURL获取页面
  12. 剑指offer面试题14-调整数组顺序使奇数位于偶数前面
  13. SQL 2005/2008 连接SQL 2000报18456错误
  14. C语言之linux内核--BCD码转二进制与二进制转BCD码(笔试经典)
  15. windows8.1全角与半角切换快捷键
  16. 关于WCF服务 http://XXXXXX/XXX/xxx.svc不支持内容类型 application/sop+xml;charset=utf-8 错误解决方法
  17. 定时备份 MySQL 并上传到七牛
  18. Python全栈之路----编程基本情况介绍
  19. APR欺骗
  20. Series转化为DataFrame数据

热门文章

  1. python 定时发送邮件
  2. Hadoop详解(04-1) - 基于hadoop3.1.3配置Windows10本地开发运行环境
  3. 计算1+2!+3!+...+n!的和
  4. NET-Core利用etag进行浏览器缓存
  5. 前端必备基础知识之--------原生JS发送Ajax请求
  6. Java8Stream流
  7. 进阶技术:Linux Arm32是如何调用C Main的
  8. Codeforces Round #849 (Div. 4)
  9. BIO和NIO的基本用法和API讲解
  10. Vue 07 js方法Object.defineProperty