echarts双向柱状图html
时间: 2023-11-03 11:57:21 浏览: 103
以下是使用echarts库创建双向柱状图的HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts 双向柱状图示例</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
</head>
<body>
<div id="chart" style="width: 600px;height:400px;"></div>
<script>
new Vue({
el: '#chart',
mounted() {
const chart = echarts.init(document.getElementById('chart'));
const option = {
xAxis: {
type: 'category',
data: ['A', 'B', 'C', 'D', 'E']
},
yAxis: [
{
type: 'value'
},
{
type: 'value'
}
],
series: [
{
name: 'Series 1',
type: 'bar',
yAxisIndex: 0,
data: [10, 20, 30, 40, 50]
},
{
name: 'Series 2',
type: 'bar',
yAxisIndex: 1,
data: [-10, -20, -30, -40, -50]
}
]
};
chart.setOption(option);
}
});
</script>
</body>
</html>
```
阅读全文
相关推荐


















