王佳豪
2021-06-25 eb3f8587aa7466fd6d2d3ca712d0f9baf4e27dcb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * 
 */
 $(document).ready(function ()  {
    
    $.ajax({
        url:'user/hightInfo.action',
        type:'post',
        dataType:'json',
        success:function(data){
            getinfo(data.naninfo,data.nvinfo);
        },
        error:function(){
            alert('请求失败!');
        }
    });
});
function getinfo(naninfo,nvinfo){
      $('#container').highcharts({
          chart: {  
                renderTo: 'container',  
                defaultSeriesType: 'areaspline', //图表类型 line, spline, area, areaspline, column, bar, pie , column,scatter  
                inverted: false //左右显示,默认上下正向。假如设置为true,则横纵坐标调换位置  
            },credits:{
                enabled:false // 禁用版权信息
            }
  
          /* chart: {
                type: 'column'
            } */,
            title: {
                text: '2017每月入职人数'
            },
            subtitle: {
                text: '数据来源: 数据库'
            },
            xAxis: {
                categories: [
                    '一月',
                    '二月',
                    '三月',
                    '四月',
                    '五月',
                    '六月',
                    '七月',
                    '八月',
                    '九月',
                    '十月',
                    '十一月',
                    '十二月'
                ],
                crosshair: true
            },
            yAxis: {
                min: 0,
                title: {
                    text: '人数(个)'
                }
            },
            tooltip: {
                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:.1f} 个</b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                name: '男生',
                data: naninfo
            }, {
                name: '女生',
                data: nvinfo
            }]
        });
}