inductanceChart.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div
  3. id="main"
  4. class="inductanceBox"
  5. />
  6. </template>
  7. <script setup>
  8. import { onMounted } from 'vue'
  9. import * as echarts from 'echarts'
  10. onMounted(() => {
  11. const chartDom = document.getElementById('main')
  12. const myChart = echarts.init(chartDom)
  13. const option = {
  14. xAxis: {
  15. type: 'time', // 使用时间类型的x轴
  16. boundaryGap: false,
  17. axisLine: {
  18. show: true,
  19. lineStyle: {
  20. color: '#ffffff',
  21. width: 1,
  22. type: 'solid'
  23. }
  24. }
  25. },
  26. yAxis: {
  27. axisLine: {
  28. show: true,
  29. lineStyle: {
  30. color: '#ffffff',
  31. width: 1,
  32. type: 'solid'
  33. }
  34. },
  35. splitLine: {
  36. lineStyle: {
  37. color: ['#ffffff']
  38. }
  39. }
  40. },
  41. series: [
  42. {
  43. data: [820, 932, 901, 934, 1290, 1330, 1320],
  44. type: 'line',
  45. areaStyle: {}
  46. }
  47. ]
  48. }
  49. option && myChart.setOption(option)
  50. })
  51. </script>
  52. <style scoped lang="scss">
  53. .inductanceBox{
  54. width: 400px;
  55. height: 250px;
  56. position: absolute;
  57. top: 0;
  58. }
  59. </style>