easyui-panel Demo

11 篇文章 0 订阅
//easyui-panel描绘统计图
//查询数据库 获取 统计图 所需的数据信息
    function postdata(){
        $.ajax({
            url:‘’,
            type:'',
            data: $('#frmAdd').serialize(),
            success:
            function(msg){
                var childArr=eval('(' + msg + ')'); 
                var pie = childArr['pie'];
                var zhu = childArr['zhu'];
                showpie(pie);//饼状图
                showzhu(zhu);//柱状图
            }
        });
        postquerytable();
    }
    function showpie(pie){
        chart_pie = new Highcharts.Chart({
             plotOptions: {
              series: {
               cursor: 'pointer',
               events: {
                click: function(e) {
                 // alert($('.highcharts-tooltip').find('text').find('tspan').first().html());
                }
               }
              }
             },
            chart: {
                renderTo: 'container_pie'  //渲染容器
            },
            title: {
                text: 'xxx占比图'
            },
            credits: {
                enabled: false //去掉右下角的版权链接
                // text: 'baidu.com',//更改右下角的链接
                // href: 'http://www.baidu.com'
            }, 
            exporting: {  
                enabled:false  //右上角的 打印与 下载按钮
            },  
            // xAxis: {
            //  categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
            // },
            tooltip: {
                formatter: function() {
                    var s;
                    if (this.point.name) { // the pie chart
                        s = ''+
                            this.point.name +': '+ this.y +' %';
                    } else {
                        s = ''+
                            this.x  +': '+ this.y;
                    }
                    return s;
                }
            },
            legend: {
                symbolRadius: 4,
                backgroundColor: '#FFFFFF',
                borderColor: '#CCC',
                borderWidth: 1,
                shadow: false
            },
            // labels: {
            //  items: [{
            //      html: 'Total fruit consumption',
            //      style: {
            //          left: '40px',
            //          top: '8px',
            //          color: 'black'              
            //      }
            //  }]
            // },
            series: [{
                type: 'pie',
                name: 'Total consumption',
                data: [{
                    name: '',
                    y: pie['login'],
                    color: '#4572A7' // Jane's color
                }, {
                    name: '',
                    y: pie['unlogin'],
                    color: '#AA4643' // John's color
                }],
                // center: [280,140],
                // size: 240,
                showInLegend: true
            }]
        });
    }
    function showzhu(zhu){
        //柱状图
        chart_zhu = new Highcharts.Chart({
                chart: {
                    renderTo: 'container_zhu',
                    defaultSeriesType: 'column'
                },
                title: {
                    text: 'xx情况统计'
                },
                credits: {
                    enabled: false //去掉右下角的版权链接
                    // text: 'baidu.com',//更改右下角的链接
                    // href: 'http://www.baidu.com'
                }, 
                exporting: {  
                    enabled:false  //右上角的 打印与 下载按钮
                },  
                xAxis: {
                    categories: ['','', '', '', '']
                },
                yAxis: {
                    min: 0,
                    title: {
                        text: ''
                    }
                },
                legend: {

                    symbolRadius: 4,
                    backgroundColor: '#FFFFFF',
                    borderColor: '#CCC',
                    borderWidth: 1,
                    shadow: false
                },
                tooltip: {
                    formatter: function() {
                        return ''+
                             this.series.name +': '+ this.y 
                             // 'Total: '+ this.point.stackTotal;
                    }
                },
                plotOptions: {
                    column: {
                        stacking: 'normal',

                    }
                },
                    series: [{
                    name: '',
                    data: [zhu['nums'], 0, 0, 0, 0],
                    visible:true
                },{
                    name: '',
                    data: [0,zhu['loginNum'], 0, 0, 0],
                    visible:true
                }, {
                    name: '',
                    data: [0,0, zhu['avgNum'], 0, 0],
                    visible:true
                }, {
                    name: '',
                    data: [0,0, 0, zhu['maxNum'], 0],
                    visible:true
                }, {
                    name: '',
                    data: [0,0, 0, 0, zhu['minNum']],
                    visible:true
                }]
            });
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值