chart-firecontrolTwo.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!-- **************************************NO.18 消防*************************************** -->
  2. <template>
  3. <div class="chart-container">
  4. <div id="firecontrolTwo" style="width: 100%; height:25vh; ">
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. import * as echarts from 'echarts';
  10. export default {
  11. name: 'firecontrolTwo',
  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=f46x0t0c7883X-D6
  22. myEcharts(xData,seriesData) {
  23. var chartDom = document.getElementById('firecontrolTwo');
  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. interval: 0,
  50. rotate: 20,
  51. textStyle: {
  52. fontSize: 10
  53. },
  54. },
  55. axisTick:{
  56. show:false,
  57. },
  58. data: xData
  59. },
  60. yAxis: {
  61. nameTextStyle:{
  62. color:'#fff',
  63. },
  64. type: 'value',
  65. axisLine: {
  66. show:false,
  67. lineStyle: {
  68. color: 'rgba(255,255,255,0.12)'
  69. },
  70. },
  71. axisLabel: {
  72. show:false,
  73. formatter: '{value}',
  74. color: '#e2e9ff',
  75. },
  76. splitLine: {
  77. lineStyle: {
  78. color: 'rgba(255,255,255,0.12)'
  79. }
  80. },
  81. axisTick:{
  82. show:true,
  83. lineStyle:{
  84. color:'#fff',
  85. },
  86. },
  87. },
  88. series: [{
  89. itemStyle:{
  90. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  91. offset: 0,
  92. color: 'rgba(0,244,255,1)'
  93. }, {
  94. offset: 1,
  95. color: 'rgba(0,77,167,1)'
  96. }], false),
  97. barBorderRadius: 10,
  98. opacity:0.8
  99. },
  100. barWidth:10,
  101. label:{
  102. formatter: "{c}",
  103. show:true,
  104. position:['0','-20'],
  105. color:'#fff',
  106. },
  107. data: seriesData,
  108. type: 'bar',
  109. }]
  110. };
  111. option && myChart.setOption(option);
  112. },
  113. },
  114. }
  115. </script>
  116. <style rel="stylesheet/scss" lang="scss" scoped>
  117. .chart-container {
  118. width: 100%;
  119. height: auto;
  120. position: relative;
  121. padding-bottom: 10px;
  122. display: flex;
  123. flex-direction: column;
  124. }
  125. </style>