- ios系统 微信小程序使用echarts绘制折线图,y轴数据超过100就会卡死,为什么?
小程序通过硬件传输过来的蓝牙数据,绘制实时动态折线图,类似于心律监护仪波形图,当数据达到100多就会卡死,安卓就不会
08-29 - ios系统中,接受蓝牙数据绘制折线图会卡死,安卓就不会?
const startNotice = (notify, serviceId) => { uni.notifyBLECharacteristicValueChange({ characteristicId: notify, deviceId: props.id, serviceId: serviceId, state: true, success(res) { console.log('返回', res); // 监听低功耗蓝牙设备的特征值变化 uni.onBLECharacteristicValueChange(result => { if (result.value) { console.log('返回数据', result.value) let view = new Uint16Array(result.value) if (result.value.byteLength == 200) { for (let i = 0; i <view.length; i++) { state.alllistTwoYuan.push(view[i]) state.id = state.id + 1 state.xdataList.push(state.id) state.alllist.push(view[i]) } console.log('返回数据', state.alllistTwoYuan) if (state.alllistTwoYuan.length == 2000) { state.alllistTwoYuan.splice(0, 100) state.xdataList.splice(0, 100) } // chart.value.init(echarts, chart => { state.option.series[0].data = state.alllistTwoYuan chart.value.setOption(state.option) // }); emit('goData', { voltage: state.alllist, alllistTwoYuan: state.alllistTwoYuan, time: state.xdataList.length - 1, }) } } }) } }); }; 以上代码就是通过蓝牙传输过来的数据进行绘制实时折线图,
08-27