charts.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="charts-v">
  3. <view class="qiun-title-bar u-flex" :style="{'justify-content':config.option.chartTitle.titleLeft}"
  4. v-if="config.option.chartTitle.titleText || config.option.chartTitle.titleSubtext">
  5. <view class="u-flex-col titleBox" :style="{'background-color':config.option.chartTitle.titleBgColor}">
  6. <view class="tit"
  7. :style="{'margin-bottom':config.option.chartTitle.titleSubtext?'8rpx':0,'font-size':config.option.chartTitle.titleTextStyleFontSize,'font-weight':config.option.chartTitle.titleTextStyleFontWeight,'color':config.option.chartTitle.titleTextStyleColor}">
  8. {{config.option.chartTitle.titleText}}
  9. </view>
  10. <view class="tit2"
  11. :style="{'font-size':config.option.chartTitle.titleSubtextStyleFontSize,'font-weight':config.option.chartTitle.titleSubtextStyleFontWeight,'color':config.option.chartTitle.titleSubtextStyleColor}">
  12. {{config.option.chartTitle.titleSubtext}}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="regionStep" v-if="regionStep.length >1">
  17. <text v-for="(item,index) in regionStep" @click="regionStepClick(item,index)" :key="index"
  18. :style="{'font-size':config.option.drillDownFontSize*2+'rpx','color':config.option.drillDownColor,'font-weight':config.option.drillDownFontWeight?700:400}">
  19. {{item.name}}
  20. <u-icon name="arrow-right" v-if="index!=regionStep.length-1" class="icon"></u-icon>
  21. </text>
  22. </view>
  23. <view class="charts-box">
  24. <qiun-data-charts v-if="config.option.chartData.series.length" :type="config.option.chartData.type"
  25. :chartData="config.option.chartData" :ontouch="true" :opts="config.option.chartData.opts"
  26. @complete="complete" @getIndex="getIndex" :style="{'background-color':config.option.bgColor}"
  27. :connectNulls="true" />
  28. <view class="" v-if="config.jnpfKey==='mapChart' && config.option.chartData.series.length>0 && loading"
  29. :key="key">
  30. <block v-for="(item, index) in config.option.markPoints" :key="index">
  31. <view :class="config.option.styleType == 2?'points-box2':'points-box'"
  32. :style="{top:(item.y - 5 ) + 'px',left:(item.x - 5) +'px'}"></view>
  33. </block>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. props: {
  41. loading: {
  42. type: Boolean,
  43. default: false
  44. },
  45. config: {
  46. type: Object,
  47. default: () => {}
  48. },
  49. markPoints: {
  50. type: Array,
  51. default: () => []
  52. },
  53. regionStep: {
  54. type: Array,
  55. default: () => []
  56. }
  57. },
  58. data() {
  59. return {
  60. key: +new Date()
  61. }
  62. },
  63. methods: {
  64. complete(e) {
  65. this.$emit('complete', e)
  66. },
  67. getIndex(e) {
  68. return this.$emit('getIndex', e)
  69. },
  70. regionStepClick(item, index) {
  71. if (index < this.regionStep.length - 1) return this.$emit('regionStepClick', item, index)
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .charts-v {
  78. background-color: #fff;
  79. box-sizing: border-box;
  80. position: relative;
  81. }
  82. .qiun-title-bar {
  83. width: 100%;
  84. z-index: 9;
  85. text-align: center;
  86. position: absolute;
  87. top: 40rpx;
  88. margin: 20rpx 0;
  89. .titleBox {
  90. .tit {
  91. // margin-bottom: 10rpx;
  92. }
  93. }
  94. }
  95. .regionStep {
  96. max-width: 100%;
  97. max-height: 100%;
  98. margin-bottom: 60rpx;
  99. position: absolute;
  100. top: 0rpx;
  101. z-index: 9999;
  102. .icon {
  103. margin: 0 8rpx;
  104. }
  105. }
  106. .charts-box {
  107. width: 100%;
  108. height: 660rpx;
  109. // margin: 0px auto 20rpx;
  110. position: relative;
  111. .charts-legend {
  112. position: absolute;
  113. bottom: 0px;
  114. left: 20rpx;
  115. font-size: 20rpx;
  116. .legend-item {
  117. display: inline-block;
  118. width: 30rpx;
  119. height: 20rpx;
  120. margin-right: 10rpx;
  121. background-color: #0D9FD8;
  122. }
  123. }
  124. .points-box {
  125. position: absolute;
  126. width: 20rpx;
  127. height: 20rpx;
  128. border-radius: 50%;
  129. background-color: #0D9FD8;
  130. animation: warn 1.5s ease-out 0s infinite;
  131. }
  132. .points-box2 {
  133. position: absolute;
  134. box-shadow: 0 0 24rpx 28rpx rgba(13, 159, 261, 0.3);
  135. }
  136. }
  137. @keyframes warn {
  138. 0% {
  139. transform: scale(0.5);
  140. opacity: 1;
  141. }
  142. 30% {
  143. opacity: 1;
  144. }
  145. 100% {
  146. transform: scale(1.4);
  147. opacity: 0.3;
  148. }
  149. }
  150. </style>