HighCharts HelloWorld

1:下载HighCharts  地址:http://www.hcharts.cn/index.php


2:解压Highcharts-4.0.3文件夹


3:在js目录下找到highcharts.js  和 js\modules下找到exporting.js  另外下载jquery.js 把这三个js文件引入到项目中


4:jsp测试页面:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/highcharts.js"></script>
	<script type="text/javascript" src="js/exporting.js"></script>
	
  </head>
  
  <body>
  <script type="text/javascript">
	$(function() {
		$('#container').highcharts({ //图表展示容器,与div的id保持一致
			chart : {
				type : 'line',	 //指定图表的类型,默认是折线图(line)
				shadow:true,	 //外框阴影
				inverted: false	 //反向旋转展示
			},
			title : {
				text : '我是图表标题' //指定图表标题
			},
			subtitle: {
                text: '副标题',
                x: -20
            },
			xAxis : {
				categories : [ '语文', '数学', '英语' ] //指定x轴分组
			},
			yAxis : {
				title : {
					text : '分数' //指定y轴的标题
				}
			},
			tooltip: {
				shared: true,        //显示所有数据列的值
                valueSuffix: '分',	 //数值后缀
                crosshairs: true	 //瞄准线
            },
			credits :{ 
				enabled:false  //去掉右下角版权信息 默认显示
			},
			exporting: { 
				enabled:true   //右上角的打印及其导出按钮:默认显示 需要导入exporting.js
			},
			legend: {
		        enabled: true    //图例
		    },
		    plotOptions: {
		        columnrange: {
		        	dataLabels: {
		        		enabled: true,
		        		formatter: function () {
		        			return this.y + '°C';
		        		}
		        	}
		        }
	   		},
			series : [ //指定数据列
			{ 
				name : '张明明', //数据列名
				data : [ 98, 85, 65 ] //数据
			}, 
			{
				name : '李华',
				data : [ 72, 99, 93 ]
			}, 
			{
				name : '胡国',
				data : [ 35, 24, 100 ]
			} 
			]
		});
	});
</script>
    <div id="container" style="width: 100%; height: 400px;"></div>  
  </body>
</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值