echarts条形图
时间: 2023-08-22 19:10:31 浏览: 113
echarts多维条形图 柱状图作图
要生成一个echarts条形图,你可以使用以下代码作为参考:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>条形图</title>
<!-- 引入 echarts.js -->
<script src="../js/echarts.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: 'ECharts入门示例',
},
tooltip: {},
legend: {
data: \['销量'\]
},
xAxis: {
data: \["麦当劳", "肯德基", "星巴克", "华莱士"\]
},
yAxis: {},
series: \[{
name: '销量',
type: 'bar',
data: \[5, 20, 36, 10\]
}\]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
</body>
</html>
```
以上代码会生成一个默认的条形图,其中x轴表示不同的商家,y轴表示销量。你可以根据需要修改x轴的数据和y轴的数据来适应你的需求。
#### 引用[.reference_title]
- *1* [ECharts——条形图](https://blog.csdn.net/qq_41422448/article/details/103932319)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [【大数据可视化系列一】echarts自动轮播镂空条形图](https://blog.csdn.net/weixin_53741561/article/details/126854452)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [echarts条形图](https://blog.csdn.net/qq_49732089/article/details/123356974)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文