w-line-charts.vue 2.0 KB

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