1.使用双y轴:
通过yAxisIndex决定使用的是哪一个y轴
2.echarts修改legend样式(提示图标)----(矩形、原型、默认)
legend: {
y: 'bottom',
data: [{ name: '入库', icon: 'rect' },
{ name: '出库', icon: 'rect' },
{ name: '期末库存', }], // 分别修改legend格式
// data: ['入库', '出库', '期末库存'],
}
3. echarts中的事件和行为(项目中使用技术angular6+ts)
// html
<div echarts [options]="options2" (chartClick)="onChartClick($event)" style="width:100%;height:300px;position: relative;top: -45px;"></div>
// ts
// 点击echarts事件
onChartClick = (event) => {
//通过event找到你需要的事件
console.log(event);
if (event.seriesIndex === 2) {
//do something
}
}