chart-pit-yx.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!-- **************************************NO.6 矿坑*************************************** -->
  2. <template>
  3. <div class="chart-container">
  4. <div id="pit-yx" style="width: 100%; height:23vh;">
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. import * as echarts from 'echarts';
  10. export default {
  11. name: 'pit',
  12. data() {
  13. return {
  14. count: 0,
  15. title:'',
  16. visible:false,
  17. }
  18. },
  19. mounted() {
  20. // this.myEcharts()
  21. },
  22. methods: {
  23. // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=udduEFcFiEYEEj4Q
  24. myEcharts(data) {
  25. var chartDom = document.getElementById('pit-yx');
  26. var myChart = echarts.init(chartDom);
  27. var color = ['#02CDFF', '#62FBE7', '#7930FF','#ef5f9d','#ecb935'];
  28. var option;
  29. option = {
  30. color:color,
  31. tooltip : {
  32. trigger: 'item',
  33. formatter: "{b}: {c}"
  34. },
  35. toolbox: {
  36. show : true,
  37. },
  38. series : [
  39. {
  40. type:'pie',
  41. roseType: true,
  42. radius : ['50%', '70%'],
  43. label: {
  44. show: true,
  45. formatter: "{b} {c}",
  46. textStyle: {
  47. fontSize: 10 ,
  48. }
  49. },
  50. data:data
  51. }
  52. ]
  53. };
  54. option && myChart.setOption(option);
  55. },
  56. },
  57. }
  58. </script>
  59. <style rel="stylesheet/scss" lang="scss" scoped>
  60. .chart-container {
  61. width: 100%;
  62. height: auto;
  63. position: relative;
  64. padding-bottom: 10px;
  65. display: flex;
  66. }
  67. </style>