8e877c739fb52ec2e5eeca76d96ece816a27b05a.svn-base 4.8 KB
/**
 * @name angularjsApp.controller:homeCtrl
 */


/**=========================================================
 * Module: flot-chart.js
 * Setup options and data for flot chart directive
 =========================================================*/

App.controller('reportformsCtrl', ['$scope', '$timeout', function($scope, $timeout) {
  'use strict';


}]);

//下属邮件-月统计图
App.directive('hjsTongjiSelf', function (ChartInfo) {
  'use strict';

  return {
    restrict: 'EA',
    replate:true,
    template:"<div id='usertongji' style='width: 100%;'></div>",
    controller:function($scope){
      var postdata={
        condition:1,
        conditionvalue:"",
        loginid:""
      };
      ChartInfo.tongji(postdata).then(function(data){
        var msend=[];
        for(var i=1;i<13; i++){
          msend.push(data.monthsend[i])
        }
        var mclick=[];
        for(var i=1;i<13; i++){
          mclick.push(data.monthclick[i])
        }
        var mreply=[];
        for(var i=1;i<13; i++){
          mreply.push(data.monthreply[i])
        }
        var mun=[];
        for(var i=1;i<13; i++){
          mun.push(data.monthun[i])
        }
        $("#usertongji").highcharts({
          chart: {
            type: 'column'
          },
          title: {
            text: '月统计图'
          },

          xAxis: {
            categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
          },
          yAxis: {
            min: 0,
            title: {
              text: '数量'
            }
          },

          exporting: {
            enabled: false
          },
          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: msend

          }, {
            name: '月点击总量',
            data: mclick

          }, {
            name: '月回复总量',
            data: mreply

          }, {
            name: '月退订总量',
            data: mun

          }]
        });

      })
    }
  }
})
//下属邮件-月走势图
    .directive('hjsZoushiSelf', function (ChartInfo) {
      'use strict';

      return {
        restrict: 'EA',
        replate:true,
        template:"<div id='userzoushi' style='width: 100%;'></div>",
        controller:function($scope){
          var postdata={
            condition:1,
            conditionvalue:"",
            loginid:""
          };
          ChartInfo.tongji(postdata).then(function(data) {
            console.log(data)
            var msend = [];
            for (var i = 1; i < 13; i++) {
              msend.push(data.monthsend[i])
            }
            var mclick = [];
            for (var i = 1; i < 13; i++) {
              mclick.push(data.monthclick[i])
            }
            var mreply = [];
            for (var i = 1; i < 13; i++) {
              mreply.push(data.monthreply[i]);
            }
            var mun = [];
            for (var i = 1; i < 13; i++) {
              mun.push(data.monthun[i]);
            }
            $('#userzoushi').highcharts({
              chart: {
                type: 'line'
              },
              title: {
                text: '月统计走势图'
              },

              xAxis: {
                categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
              },
              yAxis: {
                title: {
                  text: '百分比率(%)'
                }
              },

              exporting: {
                enabled: false
              },
              tooltip: {
                enabled: false,
                formatter: function () {
                  return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y + '°C';
                }
              },
              plotOptions: {
                line: {
                  dataLabels: {
                    enabled: true
                  },
                  enableMouseTracking: false
                }
              },
              series: [{
                name: '退订',
                data: mun
              }, {
                name: '点击',
                data: mclick
              }, {
                name: '回复',
                data: mreply
              }]

            });
          })
        }
      }
    })