homeworkCtrl copy.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. "use strict";
  2. angular.module('app.system')
  3. .controller("homeworkCtrlCopy", function($scope,$rootScope,$filter,$state,$compile,$timeout,$interval,alertService, $http,ptService, APP_CONFIG) {
  4. $("#cfState").html($("" +
  5. "<div class=\"charts-histogram-1\" id=\"cfState\" style=\"height: 100%;width:100%;\" >" +
  6. "</div>"));
  7. //获取number天前的日期
  8. $scope.cfCharts = function () {
  9. //初始化echarts 图表
  10. var option = {
  11. color:["#4a87d2","#e09038","#00bfc0","#f54c4e","#7cdf42"],
  12. tooltip: {
  13. trigger: 'item'
  14. },
  15. legend: {
  16. data: ['出库', '入库','通风','熏蒸','静态储存'],
  17. x:"right",
  18. y:"center",
  19. orient:"vertical"
  20. },
  21. grid: {
  22. // left: '0',
  23. right: '24%',
  24. bottom: '0%',
  25. },
  26. series: [
  27. {
  28. type: 'pie',
  29. radius: ['30%', '55%'],
  30. center: ["42%", "55%"],   
  31. avoidLabelOverlap: false,
  32. label: {
  33. show: false,
  34. position: 'center'
  35. },
  36. emphasis: {
  37. label: {
  38. show: true,
  39. fontSize: '40',
  40. fontWeight: 'bold'
  41. }
  42. },
  43. labelLine: {
  44. show: false
  45. },
  46. data: [
  47. { value: 1048, name: '通风' },
  48. { value: 735, name: '静态储存' },
  49. { value: 580, name: '入库' },
  50. { value: 484, name: '出库' },
  51. { value: 300, name: '熏蒸' }
  52. ]
  53. }
  54. ]
  55. };
  56. // var myChart = echarts.init(document.getElementById('quxt'));
  57. var cfState = echarts.init(document.getElementById('cfState'));
  58. cfState.setOption(option);
  59. // setTimeout(function () {
  60. // window.onresize = function () {
  61. // cfState.resize();
  62. // }
  63. // }, 100)
  64. window.addEventListener("resize",function () {
  65. cfState.resize();
  66. })
  67. // myChart.setOption(option);
  68. },
  69. function (data) {
  70. console.log(data);
  71. }
  72. $scope.cfCharts();
  73. });