1.引用highcharts的js
<script src="~/Content/JS/highcharts.js"></script>
- 創(chuàng)建放置圖表的區(qū)域
<div id="container1" style="width: 100%;"></div>
- 柱狀圖使用總結(jié)
$('#container1').highcharts({
chart: {
type: 'column'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
title: "姓名",
categories: [
'張三', '李四', '王五'
],
crosshair: true,
labels: {
rotation: -15, //逆時(shí)針旋轉(zhuǎn)45°揖庄,標(biāo)簽名稱太長获搏。
//align: 'right' //設(shè)置右對(duì)齊
//step: parseInt(data.length / 5),
//staggerLines: 1
formatter: function () {
return this.value;
}
}
},
yAxis: {
min: 0,
title: {
text: '分?jǐn)?shù)統(tǒng)計(jì)'
}
},
credits: {
enabled: false
},
tooltip: {
// head + 每個(gè) point + footer 拼接成完整的 table
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y} 次</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
borderWidth: 0
},
series: {
animation: false
}
},
colors: [
"#f45b5b",
"#2b908f"
],
series: [{
name: '語文分?jǐn)?shù)',
data: [90, 98,100]
}, {
name: '數(shù)學(xué)分?jǐn)?shù)',
data: [88, 92, 96]
}]
});