画布总内存超过最大限制(224mb)

时间:2018-10-12 11:40:52

标签: javascript ios cordova canvas memory

我正在使用这种帆布压力计来可视化传感器的温度和rpm。 https://canvas-gauges.com/

当画布规格达到224mb时,规格消失了,应用程序稍后停止工作。

是否可以扩展内存或清除现金?会伤心地后退一步,以progressbars因为仪表寻找真的专业...

错误的控制台日志

此错误首先在线性测量仪中发生,然后在径向测量仪中发生。 我尝试每隔5.值.clear()但似乎不再是一个函数...

我正在使用Cordova框架在iPhone最新版本(12.0)上运行测试。 预先非常感谢。

代码示例: 首先,传感器通过BLE为我提供值。我订阅了为我提供十六进制转换为base64数据的特性。我需要拆分数组并更改字节序。之后,我将数据传递给正确的函数,例如绘制温度表的地方:

        var hex = base64toHEX(result.value);
        console.log("calc in Hex: "+hex);

        function split(hex){
            var commaSeperated = "";
            for(var i=0; i<=hex.length; i++){

                commaSeperated += hex.charAt(i);

                if(i==13 || i==17 || i==25 || i==27 || i==29){
                    commaSeperated += ",";
                }
            }
            return commaSeperated.split(',');
        }
        var nutzwerte = [];
        nutzwerte = split(hex);


        //COnvert Temp value in dezimal and pass to gauge_funktion
        var temp = parseInt(nutzwerte[3],16);
        new_temp_gauge(temp, Temp_max_global, G_temp_yellow,G_temp_red);
        switch_icon_temp(temp, Temp_max_global, G_temp_yellow,G_temp_red);
        document.getElementById("temp_aktuell").textContent = temp+"°C";
        console.log("Temperatur: "+temp+"°C");

此功能绘制温度表:

function new_temp_gauge(val, max_val, limit_yellow, limit_red){

  var gauge_Temp = new LinearGauge({
    renderTo: document.getElementById('myCanvas'),
    width: 150,
    height: 370,
    borderRadius: 20,
    borders: 0,
    barStrokeWidth: 20,
    minorTicks: 10,
    majorTicks: [0,10,20,30,40,50,60,70,80,90,100],
    highlights: [
        {
          "from": limit_yellow,
            "to": limit_red,
            "color": "rgba(255, 255, 0, .75)"
        },
        {
            "from": limit_red,
            "to": 100,
            "color": "rgba(200, 50, 50, .75)"
        }
    ],

    units: "°C",
    colorValueBoxShadow: false
  }).draw();

  gauge_Temp.update({ animation:false,value: val  });
  document.getElementById("crit_Temp").textContent =max_val+"°C";
}

抱歉,德语...“ nutzwerte”只是我使用的数据的名称。

0 个答案:

没有答案