HighCharts初体验

  HighCharts是最近几年比较流行的前端图表控件,是纯粹的javascript图标库,能很方便快捷的在web网站或web应用中添加交互性的图表,Highcharts目前支持直线图、曲线图、面积图、柱状图、饼图、散点图等多达18种不同类型的图表,可以满足你对Web图表的任何需求。由于其功能强大、简单易用、开源免费等优点,Highcharts在国内外越来越受欢迎。

  下面是我做得一个小的Demo:

  

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="vendor/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="vendor/highcharts.js"></script>
</head>
<body>
<div id="container" style="min- 800px;height: 400px"></div>
<script>
(function($){
$('#container').highcharts({ //图表展示的容器
chart:{
type:'column' //图表的类型,默认是lines折线图
},
title:{
text:'上半年各部门各月销售额' //标题
},
xAxis:{
categories:['一月','二月','三月','四月','五月','六月']//指定X的分组
},
yAxis:{
title:{
text:'销售额' //指定Y轴的标题
}
},
series:[{ //指定数据咧
name:'市场部', //数据列名
data:[7,1,5,3,4,5] //数据
},{
name:'研发部',
data:[1,1,5,2,4,5]
}]
});
})(jQuery);
</script>

</body>
</html>

原文地址:https://www.cnblogs.com/phoneball/p/4271307.html