actLineChat.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div style="width: 95%; height: 100%; margin: 0 auto">
  3. <div class="actLineChatBox">
  4. <div>活跃度:</div>
  5. <div ref="chart" style="width: 410px; height: 300px"></div>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: "LineChart",
  12. mounted() {
  13. this.renderChart();
  14. },
  15. methods: {
  16. renderChart() {
  17. const chartDom = this.$refs.chart;
  18. const myChart = this.$echarts.init(chartDom);
  19. const option = {
  20. // title: {
  21. // text: "折线图",
  22. // },
  23. tooltip: {},
  24. xAxis: {
  25. type: "category",
  26. data: [
  27. "1月",
  28. "2月",
  29. "3月",
  30. "4月",
  31. "5月",
  32. "6月",
  33. "7月",
  34. "8月",
  35. "9月",
  36. "10月",
  37. "11月",
  38. "12月",
  39. ],
  40. axisLabel: {
  41. interval: 0, //全部显示x轴
  42. },
  43. },
  44. yAxis: {
  45. type: "value",
  46. },
  47. series: [
  48. {
  49. data: [100, 148, 230, 100, 140, 150, 210, 210, 210, 200, 150, 170],
  50. type: "line",
  51. },
  52. {
  53. data: [150, 100, 200, 140, 100, 110, 170, 140, 120, 150, 150, 210],
  54. type: "line",
  55. },
  56. ],
  57. };
  58. myChart.setOption(option);
  59. },
  60. },
  61. };
  62. </script>
  63. <style scoped>
  64. .actLineChatBox {
  65. display: flex;
  66. flex-direction: column;
  67. align-items: flex-start;
  68. flex-wrap: nowrap;
  69. width: 410px;
  70. border: 1px solid #e6e6e6;
  71. box-shadow: 0px 0px 5px 0px #e6e6e6;
  72. border-radius: 10px;
  73. padding: 15px 10px;
  74. margin-top: 20px;
  75. }
  76. .actLineChatBox > div:first-child {
  77. color: #3050c2;
  78. font-size: 18px;
  79. font-weight: bold;
  80. }
  81. </style>