You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

排查ECharts折线图动画脚本数据替换时的Uncaught Error原因

ECharts自定义数据更新报错求助

替换自定义数据nu_data更新ECharts后,出现无法解读的模糊Uncaught Error,无法定位调试。报错信息如下:

echarts.min.js:45 Uncaught Error
    at vo (echarts.min.js:45:7325)
    at Object.prepareGetValue (echarts.min.js:45:901430)
    at echarts.min.js:45:900501
    at gG (echarts.min.js:45:900842)
    at echarts.min.js:45:900983
    at Array.map (<anonymous>)
    at z (echarts.min.js:35:5289)
    at yG (echarts.min.js:45:900959)
    at gG (echarts.min.js:45:900327)
    at new t (echarts.min.js:45:901100)

新旧数据结构相似,但新数据是3项数组,原数据为4项。以下是负责读取和过滤数据的代码,针对nu_data的修改可能是问题根源:

const countries = [
    'Fourth',
    'Third',
    'Second',
    'Top'
];
const datasetWithFilters = [];
const seriesList = [];
echarts.util.each(countries, function (country) {
    var datasetId = 'dataset_' + country;
    datasetWithFilters.push({
        id: datasetId,
        fromDatasetId: 'dataset_raw',
        transform: {
            type: 'filter',
            config: {
                and: [
                    { dimension: 'Year', gte: 1950 },
                    { dimension: 'Quartile', '=': country }
                ]
            }
        }
    });
    seriesList.push({
        type: 'line',
        datasetId: datasetId,
        showSymbol: false,
        name: country,
        endLabel: {
            show: true,
            formatter: function (params) {
                return params.value[1] + ': ' + params.value[0];
            }
        },
        labelLayout: {
            moveOverlap: 'shiftY'
        },
        emphasis: {
            focus: 'series'
        },
        encode: {
            x: 'Year',
            y: 'Income',
            label: ['Quartile', 'Income'],
            itemName: 'Year',
            tooltip: ['Income']
        }
    });
});

已尝试的操作:

  • 将原数据变量替换为nu_data
  • 更新countries数组匹配新数据的分类项
  • 将代码中涉及Country的字段替换为Quartile

期望实现数据正常渲染动画,或获得明确的错误提示以定位问题,寻求解决指导。

内容的提问来源于stack exchange,提问作者datavizard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 03:23:15