chart-pit.vue 1.8 KB

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