1. <div class="content_lisechart">
    2. <div id="myChart" :style="{width: '100%', height: '100%'}"></div>
    3. <div class="content_lisechartpos">
    4. <div class="content_lisechartpos_lis">
    5. <span>90</span>
    6. <span></span>
    7. </div>
    8. <div class="content_lisechartpos_lis2">
    9. <p>超越 <span>58%</span>的用户</p>
    10. <p>谨慎型</p>
    11. </div>
    12. </div
    13. </div>
    1. .content_lisechartpos {
    2. width: 190px;
    3. height: 190px;
    4. border-radius: 50%;
    5. position: absolute;
    6. top: 0;
    7. right: 0;
    8. left: 0;
    9. bottom: 0;
    10. margin: auto;
    11. // background: rgba(0,0,0,0.5);
    12. .content_lisechartpos_lis {
    13. padding-top: 10px;
    14. box-sizing: border-box;
    15. text-align: center;
    16. // border-bottom: 1px solid #CCCCCC;;
    17. position: relative;
    18. span:nth-child(1) {
    19. font-size: 68px;
    20. font-family: Barlow-SemiBold;
    21. line-height: 82px;
    22. color: #424854;
    23. opacity: 1;
    24. }
    25. span:nth-child(2) {
    26. font-size: 25px;
    27. font-family: FZLTHJW--GB1-0;
    28. line-height: 30px;
    29. color: #424854;
    30. opacity: 1;
    31. }
    32. }
    33. .content_lisechartpos_lis:after {
    34. content: " ";
    35. width: 90%;
    36. height: 1px;
    37. background: #CCCCCC;
    38. position: absolute;
    39. bottom: 0;
    40. left: 0;
    41. right: 0;
    42. margin: auto;
    43. }
    44. }
    1. //rem 图表搭配
    2. remToPx(rem) {
    3. const fontSize = document.documentElement.style.fontSize;
    4. return Math.floor(rem * fontSize.replace('px', ''));
    5. },
    6. // 案例图表
    7. drawLine() {
    8. var that = this;
    9. var getvalue = [88];
    10. let myChart = that.$echarts.init(document.getElementById('myChart'))
    11. myChart.setOption({
    12. title: {
    13. // text: getvalue + '分',
    14. // textStyle: {
    15. // color: '#28BCFE',
    16. // fontSize: this.remToPx(.5),
    17. // },
    18. // subtext: '综合得分',
    19. // subtextStyle: {
    20. // color: '#666666',
    21. // fontSize:this.remToPx(.5),
    22. // },
    23. // itemGap:this.remToPx(.1),
    24. // left: 'center',
    25. // top: '43%',
    26. },
    27. tooltip: {
    28. formatter: function(params) {
    29. return '<span style="color: #fff;">综合得分:' + getvalue + '分</span>';
    30. },
    31. },
    32. angleAxis: {
    33. max: 100,
    34. clockwise: true, // 逆时针
    35. // 隐藏刻度线
    36. show: false,
    37. startAngle: 200, //起始角度
    38. },
    39. radiusAxis: {
    40. type: 'category',
    41. show: true,
    42. axisLabel: {
    43. show: false,
    44. },
    45. axisLine: {
    46. show: false,
    47. },
    48. axisTick: {
    49. show: false,
    50. },
    51. },
    52. polar: {
    53. center: ['50%', '50%'], //设置圆居中
    54. radius: '150%', //图形大小
    55. },
    56. series: [{
    57. type: 'bar',
    58. data: getvalue,
    59. showBackground: true,
    60. backgroundStyle: {
    61. color: '#BDEBFF',
    62. },
    63. itemStyle: {
    64. normal: {
    65. // 设置阴影
    66. shadowBlur: that.remToPx(.3),
    67. shadowColor: '#34BCFF',
    68. shadowOffsetX: that.remToPx(-0.1),
    69. shadowOffsetY: that.remToPx(0.1)
    70. }
    71. },
    72. coordinateSystem: 'polar',
    73. roundCap: true,
    74. barWidth: that.remToPx(.2),
    75. itemStyle: {
    76. normal: {
    77. opacity: 1,
    78. color: new that.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    79. offset: 0,
    80. color: '#25BFFF',
    81. },
    82. {
    83. offset: 1,
    84. color: '#5284DE',
    85. },
    86. ]),
    87. shadowBlur: that.remToPx(.1),
    88. shadowColor: '#2A95F9',
    89. },
    90. },
    91. }, ],
    92. })
    93. },
    94. //vue 可直接引入 this.getDefaultSelected(myChart)
    95. //原生https://www.makeapie.com/editor.html?c=xaoiOl5b5m 案例已写好
    96. getDefaultSelected(myChart) {
    97. let index = 0;
    98. myChart.dispatchAction({
    99. type: 'highlight',
    100. seriesIndex: 0,
    101. dataIndex: 0,
    102. });
    103. myChart.on('mouseover', (e) => {
    104. if (e.dataIndex !== index) {
    105. myChart.dispatchAction({
    106. type: 'downplay',
    107. seriesIndex: 0,
    108. dataIndex: index,
    109. });
    110. }
    111. });
    112. myChart.on('mouseout', (e) => {
    113. index = e.dataIndex;
    114. myChart.dispatchAction({
    115. type: 'highlight',
    116. seriesIndex: 0,
    117. dataIndex: e.dataIndex,
    118. });
    119. });
    120. },

    项目已经公用希望帮的到你
    饼图: https://www.makeapie.com/editor.html?c=xaoiOl5b5m
    效果图:
    image.png
    圆 : https://www.makeapie.com/editor.html?c=xk9Rxce3F6&v=2
    效果图:
    image.png