Html+Css JavaEE highChart使用指南:

对图表的一些设置


1. 图表的x轴 与 y轴互换,

图表反转 : 图表反转指的是将图表的 x轴和 y轴进行对调操作,对应的只需要设置 chart.inverted = true 即可。

示例:

<html>
<head>
   <script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
   <script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
   <script>
	$(function(){
		$('#container').highcharts({
			chart: {
				type: 'column',
				inverted: true
			},
			title: {
				text: 'Demo version 1.01'
			},
			yAxis: {
				/*categories: [1,2,3,4,5,6,7,8,,9,10],*/
				title: {
					text: 'go Ahead'
				}
			},
			xAxis: {
				categories: ['football', 'basketball', 'kkball']
			},
			series: [{
	            name: 'Jane',
	            data: [1, 0, 4]
	        }, {
	            name: 'John',
	            data: [5, 7, 3]
	        }]
		});
	})
   </script>
</head>
	
<body>
   <div id="container" style="min-width:800px;height:400px;"></div>
</body>
</html>

  


2.

6、数据标签(dataLables)

数据标签指的是在数据点上显示一些数据信息标签,对应的 API 为http://www.hcharts.cn/api/index.php#series.data.dataLabels

plotOptions: {
    line: {
        dataLabels: {
            enabled: true
        }
    }
} 

数据标签默认显示当前数据点的点值,可以通过 formatter 函数或 format 来对其格式化。

plotOptions: {
    line: {
        dataLabels: {
            enabled: true,
            formatter: function() {
                return this.x + "	" + this.y;
            },
            // format: "{x} 	 {y}"
        }
    }
} 

在线试一试

7、线条样式(Dash Style)

dashStyle 可以指定线条的样式

series: [{
    data: [1, 3, 2, 4, 5, 4, 6, 2, 3, 5, 6],
    dashStyle: 'longdash'
}] 

在线试一试




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值