hcharts实现堆叠柱形图

摘要:
˂!
<!DOCTYPE >
<html>
    <head>
        <meta charset="utf-8"><link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="https://img.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
        <script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
        <script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
        <script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
    </head>
    <body>
        <div   style="800px;height:400px"></div>
        <script>
$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: '堆叠柱形图'
        },
        xAxis: {
            categories: ['三年级一班', '三年级二班', '三年三班', '三年级四班', '三年级五班']
        },
        yAxis: {
            min: 0,
            title: {
                text: ''
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                }
            }
        },
        legend: {
            align: 'right',
            x: -30,
            verticalAlign: 'top',
            y: 25,
            floating: true,
            backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
            borderColor: '#CCC',
            borderWidth: 1,
            shadow: false
        },
        tooltip: {
            formatter: function () {
                return '<b>' + this.x + '</b><br/>' +
                    this.series.name + ': ' + this.y + '<br/>' +
                    '总量: ' + this.point.stackTotal;
            }
        },
        plotOptions: {
            column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        series: [{
            name: '未到',
            data: [1, 1, 2, 1, 2]
        }, {
            name: '迟到',
            data: [2, 2, 3, 2, 1]
        }, {
            name: '已到',
            data: [8, 9, 10, 11, 12]
        }]
    });
});



        </script>

    </body>

</html>

异步加载数据

// 异步加载数据
$("#queryCount").on("click", function() {
    var numb = 0;
    numb = validate(numb);
    if (numb == 1) {
        return;
    }
    $.ajax({
        url : "/bison/signIn/count/countOrgan",
        async : false,
        data : {
            beginDate : $("#beginTime").val(),
            endDate : $("#endTime").val(),
            personSex : $("#personSex").val(),
            organIds : getOrganIds(),
            signSetId : $("#signSet option:selected").val(),
        },
        type : 'POST',
        dataType : 'json',
        success : function(data) {
            // 成功时执行的回调方法
            category_data = data.returnData.response.categor;
            natural_data = data.returnData.response.normalList;
            late_data = data.returnData.response.lateList;
            absent_data = data.returnData.response.absentList;
            fun(category_data, natural_data, late_data, absent_data);
        },
        error : erryFunction
    // 错误时执行方法
    });

    function erryFunction() {
        layer.alert('请联系超管,数据返回失败', {
            icon : 3
        });
    }
    ;
});
​```

免责声明:文章转载自《hcharts实现堆叠柱形图》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇迪杰斯特拉 算法 在游戏中的运用C#获取web.config配置文件内容下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

爬虫和数据

一为什么要做爬虫? 首先请问:都说现在是"大数据时代",那数据从何而来? 企业产生的用户数据:百度指数:http://index.baidu.com/阿里指数:https://alizs.taobao.com/TBI腾讯浏览指数:http://tbi.tencent.com/新浪微博指数:http://data.weibo.com/index 数...

使用vue ui命令创建vue项目步骤

1、前置环境 1、node.js 2、vue-cli 3、webstorm 2、创建步骤 1、在webstorm中打开一个终端,输入 #vue ui 运行结束后,会启动一个web服务用以可视化创建vue项目。 ![](https://img2018.cnblogs.com/blog/1522304/201907/1522304-2019070310170...

Linux 下使用acme.sh生成Let's Encrypt泛域名免费证书

一、需求场景 自从数年前苹果开始强制要求所有IOS所有应用必须全部使用 https,以及google、baidu、bing 这三大搜索引擎开始大规模支持 https,https 已经成为现在保障网站完全的最基础需求,大量的供应商开始出现,并提供证书服务,但是对于一些非盈利性质的网站或博客站长,或公司测试环境也想使用https认证时,并不想在这上面投入太多的...

Ubuntu18.04.2 amd64编译安装libcurl支持https

1.准备工作,安装ssl库: sudo apt-get installopenssl sudo apt-get install libssl-dev 2.下载libcurl源代码: wget https://curl.haxx.se/download/curl-7.65.3.tar.xz 3.解压并进入源代码目录: tar xf curl-7.65.3....

fcitx5 主题设置

目录 前言 参考来源 手动安装 下载主题 设置配色方案 启用主题 使用包管理器安装 注意 请按截图提示安装 前言 在Linux系统下,fcitx5的初始主题太难看了,所以决定改变一下主题,本文相当大程度copy自github 参考来源 https://ywnz.com/linuxmh/8100.html https://wiki.ar...

Android、iOS、和Web如何做灰度发布?

    主要参考了:     https://www.zhihu.com/question/21714205     https://www.zhihu.com/question/28296375  一、概述     所谓的灰度发布,在行业内叫做A/B Test,所以可以搜索一些这方面的关键词     下面是某公司的灰度发布流程,仅供参考。 一)经典...