<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="qj1" class="col-sm-6" style="width: 100%;height:400px;"></div>
// 基于准备好的dom,初始化echarts实例
var myChartqj1 = echarts.init(document.getElementById('qj1'));
optionqj1 = {
// title: {
// text: '世界人口总量',
// subtext: '数据来自网络'
// },
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ['2012年']
},
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'value',
boundaryGap: [0, 0.01]
},
yAxis: {
type: 'category',
data: ['CT200h', 'RX450h', 'HS250h', 'LS460', 'IS250', 'IS300h']
},
series: [
{
name: '',
type: 'bar',
itemStyle: {
normal: {
color: function(params) {
console.log("adfadf" + params);
// build a color map as your need.
var colorList = [
'#C1232B', '#B5C334', '#FCCE10', '#E87C25', '#27727B',
'#FE8463', '#9BCA63', '#FAD860', '#F3A43B', '#60C0DD',
'#D7504B', '#C6E579', '#F4E001', '#F0805A', '#26C0C0'
];
return colorList[params.dataIndex]
}
}
},
data: [2320, 2320, 2350, 2850, 3850, 5850]
},
]
};
// 使用刚指定的配置项和数据显示图表。
myChartqj1.setOption(optionqj1);