js代码
var yangshi1 = function(data){
require.config({
paths: {
echarts: '/laoa/sysFiles/js/echarts-2.2.4/doc/example/www/js'
}
});
require(
[
'echarts',
'echarts/chart/line',
'echarts/chart/pie',
'echarts/chart/bar'
],
function (ec) {
debugger;
var myChart = ec.init(document.getElementById("s4"));
option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: ['入库数量', '出库数量', '剩余总库存']
},
toolbox: {
show: true,
feature: {
magicType: {show: true, type: ['line', 'bar']}
}
},
calculable: true,
xAxis: [
{
type: 'category',
data: data.clm
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '入库数量',
type: 'bar',
data: data.rk
},
{
name: '出库数量',
type: 'bar',
data: data.ck
},
{
name: '剩余总库存',
type: 'bar',
data: data.kc
}
]
};
myChart.setOption(option);
}
);
}
页面代码
<div id = 's4' style="height:370px;width:100%">
最后效果
end