bloodpressLine.vue 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="chartwarp">
  3. <qiun-title-bar title="基本曲线图(自定义图表类型)" />
  4. <view class="charts-box">
  5. <!-- 这里的type="demotype"演示了自定义图表类型的demo,您可以根据需求自己定义一种额外的图表类型 -->
  6. <qiun-data-charts
  7. type="line"
  8. :opts="opts"
  9. :chartData="chartData"
  10. />
  11. <!-- 如果不定义"demotype"这个图表类型,可以通过传递opts来覆盖line下的默认配置,如下 -->
  12. <!-- <qiun-data-charts type="line" :opts="{extra:{line:{type:'curve'}}}" :chartData="chartsData.Line2"/> -->
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. //下面是演示数据,您的项目不需要引用,数据需要您从服务器自行获取
  18. import demodata from '@/mockdata/demodata.json';
  19. import mapdata from '@/mockdata/mapdata.json';
  20. export default {
  21. props: {
  22. record: Array
  23. },
  24. data() {
  25. return {
  26. chartData:{},
  27. chartsDataLine2: {},
  28. searchVal: '',
  29. tableData: [],
  30. // 每页数据量
  31. pageSize: 10,
  32. // 当前页
  33. pageCurrent: 1,
  34. // 数据总量
  35. total: 0,
  36. loading: false,
  37. opts: {
  38. color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
  39. padding: [15,10,0,15],
  40. enableScroll: false,
  41. legend: {},
  42. xAxis: {
  43. disableGrid: true
  44. },
  45. yAxis: {
  46. disabled:false,
  47. gridType: "dash",
  48. dashLength: 10,
  49. gridColor:'#ff0000',
  50. data:[{
  51. min:0,
  52. max:200,
  53. }]
  54. },
  55. extra: {
  56. line: {
  57. type: "curve",
  58. width: 2,
  59. activeType: "hollow"
  60. }
  61. }
  62. }
  63. }
  64. },
  65. onReady() {
  66. //模拟从服务器获取数据
  67. this.getServerData()
  68. console.log('bbbb',this.record)
  69. },
  70. methods: {
  71. getServerData() {
  72. var x_xAis = []
  73. var diastolic_before=[]
  74. var systolic_before = []
  75. var diastolic_after = []
  76. var systolic_after = []
  77. for(let i=0;i<this.record.length;i++){
  78. x_xAis.push(this.record[i].assessment_date)
  79. diastolic_before.push(this.record[i].diastolic_blood_pressure_before)
  80. systolic_before.push(this.record[i].systolic_blood_pressure_before)
  81. diastolic_after.push(this.record[i].diastolic_blood_pressure_after)
  82. systolic_after.push(this.record[i].systolic_blood_pressure_after)
  83. }
  84. console.log('vvvvv',x_xAis);
  85. setTimeout (()=>{
  86. let res = {
  87. categories: x_xAis,
  88. series: [
  89. {
  90. name: "透前收缩压",
  91. // lineType: "dash",
  92. data:diastolic_before,
  93. },
  94. {
  95. name: "透前舒张压",
  96. data: systolic_before,
  97. },
  98. {
  99. name: "透后收缩压",
  100. data: diastolic_after
  101. },
  102. {
  103. name: "透后舒张压",
  104. data: systolic_after
  105. }
  106. ]
  107. };
  108. this.chartData = JSON.parse(JSON.stringify(res));
  109. }, 1500);
  110. }
  111. }
  112. }
  113. </script>
  114. <style>
  115. page {
  116. height: 100%;
  117. background-color: #f3f3f9;
  118. }
  119. .chartwarp {
  120. margin-top: 30rpx;
  121. }
  122. .uni-group {
  123. display: flex;
  124. align-items: center;
  125. }
  126. .content {
  127. display: flex;
  128. flex-direction: column;
  129. flex: 1;
  130. }
  131. .charts-box {
  132. width: 100%;
  133. height: 300px;
  134. }
  135. </style>