Echarts自定义数据视图样式

toolbox: {
            show: true,
            feature: {
                mark: {show: true},
                dataView: {show: true, readOnly: false,
                    optionToContent: function (opt) {
                        var  axisData = opt.xAxis[0].data; //坐标数据
                        var series = opt.series; //折线图数据
                        var tdHeads = '时间'; //表头
                        var tdBodys = ''; //数据
                        series.forEach(function (item) {
                            //组装表头
                            tdHeads += ''+item.name+'';
                        });
                        var table = ''+tdHeads+' ';
                        for (var i = 0, l = axisData.length; i < l; i++) {
                            for (var j = 0; j < series.length; j++) {
                                //组装表数据
                                tdBodys += '';
                            }
                            table += ''+tdBodys+'';
                            tdBodys = '';
                        }
                        table += '
'+series[j].data[i]+'
'+axisData[i]+'
'; return table; } }, magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']}, restore: {show: true}, saveAsImage: {show: true} } },

Echarts自定义数据视图样式_第1张图片

你可能感兴趣的:(Echarts自定义数据视图样式)