(function() { function getOption(xAxis, seriesData) { return option = { backgroundColor: '#fff5e9', grid: { x: 30, y: 20, x2: 40, y2: 30 }, xAxis : [ { type : 'category', boundaryGap : false, data : xAxis } ], yAxis : [ { type : 'value' } ], series : [ { type:'line', data: seriesData } ] }; } var chart = echarts.init(document.getElementById('conclusionChart')) var conclusionChart = { init: function(data) { var xAxis = _.pluck(data,'name'); var seriesData = _.pluck(data,'score') chart.setOption(getOption(xAxis, seriesData)); } } window.conclusionChart = conclusionChart; })()