http://echarts.apache.org/zh/
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>可视化案例01</title> <script src="js/echarts.min.js"></script> <script src="js/jquery.min.js"></script> <style> #box { width: 600px; height: 500px; border: 1px solid cornflowerblue; } </style> </head> <body> <input type="button" value="显示条形图" class="btnShowBar"> <hr> <div id="box"> </div> </body> </html>
查看运行结果
初始化ECharts
参数配置
//1.初始化ECharts var my_box = echarts.init(box); //2.进行参数配置 var option = { //配置标题 title: { text: "19级各班人数条形图", x: "center", y: "top", textAlign: "left", textStyle: { fontFamily: "楷体", fontSize: 35, textStyle: "bold" } }, //图例 legend: { left: "right" }, //x轴数据 yAxis: {}, //y轴数据 xAxis: { data: class_list }, series: [ { name: "总人数", type:"bar", data: number_list, itemStyle:{ normal:{ color:"#aa0000" } }, } ] };
//3.可视化呈现 my_box.setOption(option)
查看效果