chart-pit.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!-- **************************************NO.6 矿坑*************************************** -->
  2. <template>
  3. <div class="chart-container">
  4. <div id="pit" 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. }
  16. },
  17. mounted() {
  18. this.myEcharts()
  19. },
  20. methods: {
  21. // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=udduEFcFiEYEEj4Q
  22. myEcharts() {
  23. var chartDom = document.getElementById('pit');
  24. var myChart = echarts.init(chartDom);
  25. var color = ['#02CDFF', '#62FBE7', '#7930FF','#ef5f9d','#ecb935'];
  26. var option;
  27. option = {
  28. color:color,
  29. tooltip : {
  30. trigger: 'item',
  31. formatter: "{b}: {c}"
  32. },
  33. toolbox: {
  34. show : true,
  35. },
  36. series : [
  37. {
  38. name:'业务警种',
  39. type:'pie',
  40. roseType: true,
  41. radius : ['50%', '70%'],
  42. label: {
  43. show: true,
  44. formatter: "{b} {c}",
  45. textStyle: {
  46. fontSize: 10 ,
  47. }
  48. },
  49. data:[
  50. {value:20, name:'双辽市'},
  51. {value:25, name:'梨树县'},
  52. {value:30, name:'伊通县'},
  53. {value:35, name:'铁东区'},
  54. {value:35, name:'铁西区'}
  55. ]
  56. }
  57. ]
  58. };
  59. option && myChart.setOption(option);
  60. },
  61. },
  62. }
  63. </script>
  64. <style rel="stylesheet/scss" lang="scss" scoped>
  65. .chart-container {
  66. width: 100%;
  67. height: auto;
  68. position: relative;
  69. padding-bottom: 10px;
  70. display: flex;
  71. }
  72. </style>