在小屏幕上显示未定义的值

时间:2018-10-11 21:18:50

标签: javascript amcharts

在一个小窗口中渲染时,我在Amcharts上得到一些“未定义”的值: enter image description here

但是同一张图,没有重新加载,如果我将它移到更大的屏幕上,我就正确地得到了值:

enter image description here

为什么会这样?

这是我图中的一些代码:

funciones.chart = AmCharts.makeChart("chartdiv", {
    "type": "serial",
    "theme": "light",
    "precision":"3",
    "decimalSeparator": ",",
    "thousandsSeparator": ".",
    "legend": {
        "horizontalGap": 10,
        "maxColumns": 3,
        "position": "top",
        "useGraphSettings": false,
        "markerSize": 10,
        "marginTop": 20,
        "autoMargins":true,
        "forceWidth":true,
        "valueAlign":"right",
        "labelWidth":85,
        "valueWidth":85
    },
    "dataProvider": response,
    "synchronizeGrid":true,
    "valueAxes": [{
        "axisAlpha": 0,
        "position": "left",
        "title": "Activos"
    }],
    "graphs": graphs,
    "chartScrollbar": {},
    "chartCursor": {
        "cursorPosition": "mouse"
    },
    "categoryField": "diahora",
    "chartCursor": {
        "fullWidth": true,
        "cursorAlpha": 0.1,
        "listeners": [{
            "event": "zoomed",
            "method": function(ev) {
                var value = funciones.chart.valueAxes;
                var uno = funciones.chart.dataProvider[value[0].start];
                var dos = funciones.chart.dataProvider[value[0].end];

            }
        }]
    },
    "categoryAxis": {
        "gridPosition": "start",
        "axisColor": "#DADADA",
    },
    "export": {
        "enabled": true,
        "position": "top-right",
        "class": "export-main",
        "menu": [ {
            "title": "Exportar el gráfico a archivo de imagen",
            "label": "Descargar",
            "menu": [ "PNG", "JPG", "PDF" ]
        }]
    }
});

编辑:地狱!数据实际上制作得很糟糕……我不知道为什么,但是在只有一种情况下,JSON的值之间带有空白数组[]

[{"fecha":"2018-09-01","hora":"00:00:00","dia":1,"diahora":"1-00:00:00","cen_name":"AIHUAPI_______013","descripcion":"Rerversa 52ET2","activo_actual":"393.54786432893"},[],{"fecha":"2018-09-01","hora":"00:15:00","dia":1,"diahora":"1-00:15:00","cen_name":"AIHUAPI_______013","descripcion":"Rerversa 52ET2","activo_actual":"405.51075393844"},[], etc...

但是其余的都可以,例如:

[{"fecha":"2018-01-01","hora":"00:00:00","dia":1,"diahora":"1-00:00:00","cen_name":"AIHUAPI_______013","descripcion":"Rerversa 52ET2","activo_actual":"179.64412533621"},{"fecha":"2018-01-01","hora":"00:15:00","dia":1,"diahora":"1-00:15:00","cen_name":"AIHUAPI_______013","descripcion":"Rerversa 52ET2","activo_actual":"169.2686290587"}, etc...

0 个答案:

没有答案