w-line-charts.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <!-- 气象历史数据 折线统计图 -->
  3. <view >
  4. <ui-charts ref="wLineCharts" type="line" :ontouch="true" :opts="opts" :chartData="chartData">
  5. </ui-charts>
  6. </view>
  7. </template>
  8. <script>
  9. /**
  10. * 气象历史数据 折线统计图
  11. * @example <w-line-charts :chartData="chartData"></w-line-charts>
  12. * @description 统计图官方说明文档 https://www.ucharts.cn
  13. */
  14. export default {
  15. name: 'w-line-charts',
  16. data() {
  17. return {
  18. loading: true,
  19. opts: {
  20. loadingType: 0,
  21. color: ["#317afd"],
  22. padding: [10, 10, 0, 15],
  23. enableScroll: true,
  24. legend: {
  25. position: 'top',
  26. float: 'left'
  27. },
  28. dataLabel: false,
  29. // dataPointShape: false,
  30. dataPointShapeType: 'hollow',
  31. xAxis: {
  32. disableGrid: true,
  33. fontColor: '#999',
  34. fontSize: 10,
  35. axisLineColor: '#F4F7F9',
  36. scrollShow: true,
  37. itemCount: 5
  38. },
  39. yAxis: {
  40. gridColor: '#F4F7F9',
  41. gridType: "solid",
  42. dashLength: 2,
  43. data: [{
  44. axisLineColor: '#F4F7F9',
  45. fontColor: '#999',
  46. fontSize: 10,
  47. }]
  48. },
  49. extra: {
  50. line: {
  51. type: "curve",
  52. width: 3
  53. },
  54. tooltip: {
  55. showArrow: true,
  56. gridType: 'dash',
  57. labelBgColor: '#66ccff',
  58. gridColor: '#317afd'
  59. },
  60. markLine: {
  61. type: 'dash',
  62. dashLength: 5,
  63. data: [{
  64. lineColor: '#1A6EFE'
  65. }]
  66. }
  67. }
  68. },
  69. }
  70. },
  71. props: {
  72. chartData: {
  73. type: [Array, Object],
  74. default () {
  75. return []
  76. }
  77. },
  78. width: {
  79. type: [Number],
  80. default: 0
  81. },
  82. height: {
  83. type: [Number],
  84. default: 0
  85. },
  86. },
  87. watch: {
  88. chartData: {
  89. deep: true, // 深度监听
  90. handler(val) {}
  91. }
  92. },
  93. async mounted() {
  94. if (!this.width) {
  95. return;
  96. }
  97. // console.log(11);
  98. // await null;
  99. // this.$refs['wLineCharts'].cWidth = this.width;
  100. // this.$refs['wLineCharts'].cHeight = this.height;
  101. },
  102. methods: {}
  103. };
  104. </script>
  105. <style lang="scss">
  106. </style>