zhengxuhua il y a 5 ans
Parent
commit
feb66fa39d
5 fichiers modifiés avec 80 ajouts et 74 suppressions
  1. 8 3
      ec-canvas/ec-canvas.js
  2. 46 53
      pages/rise/rise.js
  3. 17 15
      pages/rise/rise.wxml
  4. 4 3
      pages/rise/rise.wxss
  5. 5 0
      project.config.json

+ 8 - 3
ec-canvas/ec-canvas.js

@@ -42,7 +42,10 @@ Component({
     forceUseOldCanvas: {
       type: Boolean,
       value: false
-    }
+    },
+    tuData:{
+      type: Object
+    },
   },
 
   data: {
@@ -121,11 +124,13 @@ Component({
       query.select('.ec-canvas').boundingClientRect(res => {
         if (typeof callback === 'function') {
           this.chart = callback(canvas, res.width, res.height, canvasDpr);
+        
         }
         else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
-          this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
+          this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr,this.data.tuData);
         }
         else {
+      
           this.triggerEvent('init', {
             canvas: canvas,
             width: res.width,
@@ -160,7 +165,7 @@ Component({
           if (typeof callback === 'function') {
             this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
           } else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
-            this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
+            this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr,this.data.tuData)
           } else {
             this.triggerEvent('init', {
               canvas: canvas,

+ 46 - 53
pages/rise/rise.js

@@ -1,64 +1,40 @@
 import * as echarts from '../../ec-canvas/echarts';
+
 var app = getApp()
-function initChart(canvas, width, height, dpr) {
+function initChart(canvas, width, height, dpr, data) {
   const chart = echarts.init(canvas, null, {
     width: width,
     height: height,
     devicePixelRatio: dpr // new
   });
   canvas.setChart(chart);
-
+  console.log(dpr)
+  console.log(data)
   var option = {
-    title: {
-      text: '测试下面legend的红色区域不应被裁剪',
-      left: 'center'
-    },
-    color: ["#37A2DA", "#67E0E3", "#9FE6B8"],
-    legend: {
-      data: ['A', 'B', 'C'],
-      top: 50,
-      left: 'center',
-      backgroundColor: 'red',
-      z: 100
-    },
-    grid: {
-      containLabel: true
-    },
-    tooltip: {
-      show: true,
-      trigger: 'axis'
-    },
-    xAxis: {
-      type: 'category',
-      boundaryGap: false,
-      data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
-      // show: false
-    },
-    yAxis: {
-      x: 'center',
-      type: 'value',
-      splitLine: {
-        lineStyle: {
-          type: 'dashed'
-        }
-      }
-      // show: false
-    },
+    xAxis : {
+          type : 'category',
+          splitNumber: 2,
+          scale: true,
+          show:false,
+          splitLine:{
+      show:false
+        }
+      },
+  yAxis : {
+          type : 'value',
+          splitNumber: 2,
+          scale: true,
+          show:false,
+          splitLine:{
+      show:false
+       }
+      },
+    
     series: [{
-      name: 'A',
-      type: 'line',
-      smooth: true,
-      data: [18, 36, 65, 30, 78, 40, 33]
-    }, {
-      name: 'B',
       type: 'line',
       smooth: true,
-      data: [12, 50, 51, 35, 70, 30, 20]
-    }, {
-      name: 'C',
-      type: 'line',
-      smooth: true,
-      data: [10, 30, 31, 50, 40, 20, 10]
+      data:data,
+      areaStyle: {},
     }]
   };
 
@@ -74,23 +50,40 @@ Page({
     winHeight: 0,
     // tab切换 
     currentTab: 0,
+    ec: {
+      onInit: initChart
+    },
     array:[
       {
         title:'AppL',
         subtitle:"APPL INC",
         Increase:"1.22",
-        digital:"33"
+        digital:"33",
+        data:[52,56,355,444]
+      },
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,444]
+      },
+      {
+        title:'AppL',
+        subtitle:"APPL INC",
+        Increase:"1.22",
+        digital:"33",
+        data:[52,56,355,44554]
       }
     ],
-    ec: {
-      onInit: initChart
-    }
+
   },
   onLoad: function() {
     var that = this;
     // 获取系统信息 
     wx.getSystemInfo({
       success: function(res) {
+        
         that.setData({
           winWidth: res.windowWidth,
           winHeight: res.windowHeight

+ 17 - 15
pages/rise/rise.wxml

@@ -3,26 +3,28 @@
   <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">上周预测数据</view>
 </view>
 
-<swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height:{{winHeight - 31}}px" bindchange="bindChange">
+<swiper current="{{currentTab}}" class="swiper-box" duration="300"  style="height:{{winHeight - 48}}px" bindchange="bindChange">
   <swiper-item>
-    <view wx:for="{{array}}" class="swiper-box-view">
-      <view>
-       <view>{{item.title}}</view>
-       <view>{{item.subtitle}}</view>
-      </view>
-      <view>
-       <view>{{item.title}}</view>
-       <view>{{item.subtitle}}</view>
-      </view>
-      <view>
-       <view>{{item.digital}}</view>
-      <button class="mini-btn" type="primary" size="mini">+{{item.Increase}}</button>
+    <scroll-view scroll-y style="height: 100%;">
+      <view wx:for="{{array}}"class="swiper-box-view">
+        <view>
+          <view>{{item.title}}</view>
+          <view>{{item.subtitle}}</view>
+        </view>
+        <view style='width:100%;height:200rpx'>
+
+          <ec-canvas id="mychart-dom-line" canvas-id="mychart-line" tuData="{{ item.data }}" ec="{{ ec }}"></ec-canvas>
+        </view>
+        <view>
+          <view>{{item.digital}}</view>
+          <button class="mini-btn" type="primary" size="mini">+{{item.Increase}}</button>
+        </view>
       </view>
-    </view>
+    </scroll-view>
   </swiper-item>
   <swiper-item>
     <view class="container">
-      <ec-canvas id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ec }}"></ec-canvas>
+      
     </view>
   </swiper-item>
 

+ 4 - 3
pages/rise/rise.wxss

@@ -29,17 +29,18 @@ page {
 
 .swiper-box .swiper-box-view {
  display: flex;
+ overflow:scroll;
  justify-content: space-between;
- border-bottom: 1px slategray solid;
+ border-bottom: 1rpx slategray solid;
 }
 ec-canvas {
   width: 100%;
   height: 100%;
   }
 
-.container {
+  .swiper-box .swiper-box-view .container {
   position: absolute;
-  top: 200rpx;
+  top: 0;
   bottom: 0;
   left: 0;
   right: 0;

+ 5 - 0
project.config.json

@@ -6,22 +6,27 @@
 	"setting": {
 		"urlCheck": true,
 		"es6": true,
+		"enhance": false,
 		"postcss": true,
 		"preloadBackgroundData": false,
 		"minified": true,
 		"newFeature": true,
 		"coverView": true,
+		"nodeModules": false,
 		"autoAudits": false,
 		"showShadowRootInWxmlPanel": true,
 		"scopeDataCheck": false,
+		"uglifyFileName": false,
 		"checkInvalidKey": true,
 		"checkSiteMap": true,
 		"uploadWithSourceMap": true,
+		"compileHotReLoad": false,
 		"babelSetting": {
 			"ignore": [],
 			"disablePlugins": [],
 			"outputPath": ""
 		},
+		"useIsolateContext": true,
 		"useCompilerModule": true,
 		"userConfirmedUseCompilerModuleSwitch": false
 	},