標籤:
一、labels屬性說明
Labels屬性允許在HighCharts圖表的任意位置添加任意的html代碼。可以實現許多自訂內容。
二、labels屬性詳解
| 參數 |
子參數 |
說明 |
預設值 |
| items |
—- |
一個html標籤 |
—- |
| —- |
html |
html代碼 |
“” |
| —- |
style |
標籤位置(只能是位置,其他css不行) |
style: {
left: ’100px’,
top: ’100px’
} |
| style |
—- |
標籤的顏色(這裡的style和items中的style不同) |
style: {
color: ‘#3E576F’
} |
三、執行個體說明
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: ‘container‘, type: ‘areaspline‘, }, credits : { enabled:false//不顯示highCharts著作權資訊 }, labels:{ items:[{ //標籤代碼(html代碼) html:‘<p style="font-size:20">Copyright © 2012-2013 </p><a href="http://www.52wulian.org" style="font-size:20;text-decoration: underline;">我愛物聯網</a>‘, style:{ //設定標籤位置 left:‘100px‘, top:‘50px‘, } }], style:{ //設定標籤顏色 color:‘rgb(0,0,255)‘ } }, xAxis: { categories: [‘2011-11‘,‘2011-12‘,‘2012-01‘,‘2012-02‘,‘2012-03‘] }, series: [{ name: ‘series1‘, data: [2,4,5,9,2] },{ name:‘series2‘, data:[3,5,7,2,1] }] }); }); }); </script> </head> <body> <script src="js/highcharts.js"></script> <script src="js/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body></html>四、效果
五、線上示範示範地址:http://www.52wulian.org/test/HighCharts/highcharts_2_6_labels.html六、資源下載本例源檔案:http://pan.baidu.com/share/link?shareid=248660&uk=3087605183
【HighCharts系列教程】八、Html標籤屬性——Labels