chart-firecontrol.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!-- **************************************NO.18 消防*************************************** -->
  2. <template>
  3. <div class="chart-container">
  4. <div id="firecontrol" style="width: 100%; height:25vh; ">
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. import * as echarts from 'echarts';
  10. export default {
  11. name: 'firecontrol',
  12. data() {
  13. return {
  14. count: 0
  15. }
  16. },
  17. mounted() {
  18. this.myEcharts1();
  19. },
  20. methods: {
  21. // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=f46x0t0c7883X-D6
  22. myEcharts1() {
  23. var chartDom = document.getElementById('firecontrol');
  24. var myChart = echarts.init(chartDom);
  25. var option;
  26. option = {
  27. tooltip: {
  28. trigger: 'axis',
  29. axisPointer: {
  30. type: 'shadow'
  31. }
  32. },
  33. grid:{
  34. top:'15%',
  35. left:'10%',
  36. right:'10%',
  37. buttom:'15%',
  38. },
  39. xAxis: {
  40. type: 'category',
  41. axisLine: {
  42. lineStyle: {
  43. color: 'rgba(255,255,255,0.12)',
  44. },
  45. },
  46. axisLabel: {
  47. margin: 10,
  48. color: '#e2e9ff',
  49. textStyle: {
  50. fontSize: 10
  51. },
  52. },
  53. axisTick:{
  54. show:false,
  55. },
  56. data: ['双辽市', '梨树县', '伊通县', '铁东区', '铁西区']
  57. },
  58. yAxis: {
  59. nameTextStyle:{
  60. color:'#fff',
  61. },
  62. type: 'value',
  63. axisLine: {
  64. show:false,
  65. lineStyle: {
  66. color: 'rgba(255,255,255,0.12)'
  67. },
  68. },
  69. axisLabel: {
  70. show:false,
  71. formatter: '{value}',
  72. color: '#e2e9ff',
  73. },
  74. splitLine: {
  75. lineStyle: {
  76. color: 'rgba(255,255,255,0.12)'
  77. }
  78. },
  79. axisTick:{
  80. show:true,
  81. lineStyle:{
  82. color:'#fff',
  83. },
  84. },
  85. },
  86. series: [{
  87. itemStyle:{
  88. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  89. offset: 0,
  90. color: 'rgba(0,244,255,1)'
  91. }, {
  92. offset: 1,
  93. color: 'rgba(0,77,167,1)'
  94. }], false),
  95. barBorderRadius: 10,
  96. opacity:0.8
  97. },
  98. barWidth:10,
  99. label:{
  100. show:true,
  101. position:['0','-20'],
  102. color:'#fff',
  103. },
  104. data: [120, 200, 150, 80, 70],
  105. type: 'bar',
  106. }]
  107. };
  108. option && myChart.setOption(option);
  109. },
  110. },
  111. }
  112. </script>
  113. <style rel="stylesheet/scss" lang="scss" scoped>
  114. .chart-container {
  115. width: 100%;
  116. height: auto;
  117. position: relative;
  118. padding-bottom: 10px;
  119. display: flex;
  120. flex-direction: column;
  121. }
  122. </style>