meetingPersonCharts.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div class="myChart" ref="myChart" :style="{height: height+'px'}"></div>
  3. </template>
  4. <script>
  5. export default {
  6. data() {
  7. return {
  8. }
  9. },
  10. props: {
  11. height: Number,
  12. queryData: Object
  13. },
  14. mounted() {
  15. this.init()
  16. },
  17. methods: {
  18. init() {
  19. let chart = this.$echarts.init(this.$refs.myChart);
  20. let options = {
  21. color: ['#80B2FF','#FFDF80'],
  22. grid: {
  23. left: '2%', //默认10%
  24. right: '2%', //默认10%
  25. bottom: '0%', //默认60
  26. top: '15%',
  27. containLabel: true
  28. //grid区域是否包含坐标轴的刻度标签
  29. },
  30. xAxis: {
  31. type: 'category',
  32. data: ['2月1日', '2月2日', '2月3日', '2月4日', '2月5日', '2月6日', '2月7日', '2月8日', '2月9日', '2月10日', '2月11日', '2月12日', '2月13日', '2月14日', '2月15日', '2月16日', '2月17日', '2月18日', '2月19日', '2月20日', '2月21日', '2月22日', '2月23日', '2月24日', '2月25日', '2月26日', '2月27日', '2月28日']
  33. },
  34. yAxis: [
  35. {
  36. name: '人数',
  37. type: 'value',
  38. nameTextStyle: {
  39. padding: [0, 0, 0, 0]
  40. },
  41. },
  42. ],
  43. tooltip: {
  44. trigger: 'axis',
  45. axisPointer: {
  46. type: 'shadow'
  47. },
  48. textStyle: {
  49. color: '#fff',
  50. align: 'left',
  51. fontSize: 14
  52. },
  53. axisLine: {//x坐标轴轴线
  54. show: true,
  55. lineStyle: {//x坐标轴轴线样式
  56. color: '#000',//'#ccc' | 'rgb(128, 128, 128)' | 'rgba(128, 128, 128, 0.5)',设置标签颜色
  57. }
  58. },
  59. backgroundColor: 'rgba(0,0,0,0.8)',
  60. },
  61. series: [
  62. {
  63. data: [55, 54, 12, 25, 54, 54, 47, 52, 13, 12, 33, 25, 44, 44, 48, 10, 36, 50, 8, 40, 25, 29, 39, 44, 46, 40, 55, 44],
  64. type: 'bar',
  65. stack: 'A',
  66. backgroundStyle: {
  67. color: 'rgba(180, 180, 180, 0.2)'
  68. }
  69. }
  70. ]
  71. };
  72. chart.setOption(options);
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="less" scoped>
  78. </style>