box1.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*大屏*/
  2. var dom = document.getElementById("box1");
  3. var myChart = echarts.init(dom);
  4. var app = {};
  5. option = null;
  6. var labelRight = {
  7. normal: {
  8. position: 'right'
  9. }
  10. };
  11. option = {
  12. tooltip : {
  13. trigger: 'axis',
  14. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  15. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  16. }
  17. },
  18. grid: {
  19. left:10,
  20. top: 20,
  21. bottom: 30
  22. },
  23. xAxis: {
  24. type : 'value',
  25. position: 'top',
  26. splitLine: {lineStyle:{type:'dashed'}},
  27. },
  28. textStyle:{//图例文字的样式
  29. color:'#fff',
  30. fontSize:12
  31. },
  32. yAxis: {
  33. type : 'category',
  34. axisLine: {show: false},
  35. axisLabel: {show: false},
  36. axisTick: {show: false},
  37. splitLine: {show: false},
  38. data : ['ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two', 'one']
  39. },
  40. series : [
  41. {
  42. name:'生活费',
  43. type:'bar',
  44. stack: '总量',
  45. label: {
  46. normal: {
  47. show: true,
  48. formatter: '{b}'
  49. }
  50. },
  51. data:[
  52. {value: -0.07, label: labelRight},
  53. {value: -0.09, label: labelRight},
  54. 0.2, 0.44,
  55. {value: -0.23, label: labelRight},
  56. 0.08,
  57. {value: -0.17, label: labelRight},
  58. 0.47,
  59. {value: -0.36, label: labelRight},
  60. 0.18
  61. ]
  62. }
  63. ]
  64. };
  65. ;
  66. if (option && typeof option === "object") {
  67. myChart.setOption(option, true);
  68. }