index.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const app = getApp();
  2. import * as echarts from '../../../../ec-canvas/echarts' // 这个是自己实际的目录
  3. Component({
  4. data:{
  5. Ec: { lazyLoad: true, },
  6. },
  7. lifetimes: {
  8. attached: function () {
  9. this.init()
  10. },
  11. moved: function () { },
  12. detached: function () { },
  13. },
  14. methods:{
  15. init(){
  16. var that = this;
  17. that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
  18. const chart = echarts.init(canvas, null, {
  19. width: width,
  20. height: height,
  21. devicePixelRatio: dpr
  22. });
  23. var option = that.getOrderWarnOption();
  24. chart.setOption(option);
  25. return chart;
  26. });
  27. },
  28. getOrderWarnOption(){
  29. var list = [{name:"生化诊断",value:50,},{name:"免疫诊断",value:30,},{name:"分子诊断",value:30,},{name:"血液检测",value:30,}]
  30. var fontSize = 10
  31. var fontColor = "#999999"
  32. return {
  33. color:["#333FFF","#FFAE36"],
  34. title:{
  35. text:"产品分类信息",
  36. show:0,
  37. textStyle:{
  38. color:fontColor,
  39. fontSize:fontSize,
  40. },
  41. left:'center',
  42. top:0,
  43. },
  44. tooltip: {
  45. trigger: 'axis',
  46. axisPointer: {
  47. type: 'cross',
  48. }
  49. },
  50. grid: {
  51. top: '20%',
  52. left: '6%',
  53. right: '4%',
  54. bottom: '3%',
  55. containLabel: true
  56. },
  57. yAxis: {
  58. type: 'value',
  59. axisTick:{show:false,},
  60. axisLabel:{
  61. fontSize:fontSize,
  62. color:fontColor,
  63. },
  64. },
  65. xAxis: {
  66. type: 'category',
  67. axisTick:{show:false,},
  68. axisLabel:{
  69. fontSize:fontSize,
  70. color:fontColor,
  71. },
  72. axisLine:{
  73. lineStyle:{
  74. color:"#cccccc"
  75. }
  76. },
  77. data: list.map(item=>item.name)
  78. },
  79. series:[
  80. {
  81. type: 'line',
  82. data:list
  83. },
  84. ],
  85. }
  86. },
  87. },
  88. })