rise.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import * as echarts from '../../ec-canvas/echarts';
  2. var app = getApp()
  3. function initChart(canvas, width, height, dpr) {
  4. const chart = echarts.init(canvas, null, {
  5. width: width,
  6. height: height,
  7. devicePixelRatio: dpr // new
  8. });
  9. canvas.setChart(chart);
  10. var option = {
  11. title: {
  12. text: '测试下面legend的红色区域不应被裁剪',
  13. left: 'center'
  14. },
  15. color: ["#37A2DA", "#67E0E3", "#9FE6B8"],
  16. legend: {
  17. data: ['A', 'B', 'C'],
  18. top: 50,
  19. left: 'center',
  20. backgroundColor: 'red',
  21. z: 100
  22. },
  23. grid: {
  24. containLabel: true
  25. },
  26. tooltip: {
  27. show: true,
  28. trigger: 'axis'
  29. },
  30. xAxis: {
  31. type: 'category',
  32. boundaryGap: false,
  33. data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  34. // show: false
  35. },
  36. yAxis: {
  37. x: 'center',
  38. type: 'value',
  39. splitLine: {
  40. lineStyle: {
  41. type: 'dashed'
  42. }
  43. }
  44. // show: false
  45. },
  46. series: [{
  47. name: 'A',
  48. type: 'line',
  49. smooth: true,
  50. data: [18, 36, 65, 30, 78, 40, 33]
  51. }, {
  52. name: 'B',
  53. type: 'line',
  54. smooth: true,
  55. data: [12, 50, 51, 35, 70, 30, 20]
  56. }, {
  57. name: 'C',
  58. type: 'line',
  59. smooth: true,
  60. data: [10, 30, 31, 50, 40, 20, 10]
  61. }]
  62. };
  63. chart.setOption(option);
  64. return chart;
  65. }
  66. Page({
  67. data: {
  68. // 页面配置
  69. winWidth: 0,
  70. winHeight: 0,
  71. // tab切换
  72. currentTab: 0,
  73. array:[
  74. {
  75. title:'AppL',
  76. subtitle:"APPL INC",
  77. Increase:"1.22",
  78. digital:"33"
  79. }
  80. ],
  81. ec: {
  82. onInit: initChart
  83. }
  84. },
  85. onLoad: function() {
  86. var that = this;
  87. // 获取系统信息
  88. wx.getSystemInfo({
  89. success: function(res) {
  90. that.setData({
  91. winWidth: res.windowWidth,
  92. winHeight: res.windowHeight
  93. });
  94. }
  95. });
  96. },
  97. // 滑动切换tab
  98. bindChange: function(e) {
  99. var that = this;
  100. that.setData({
  101. currentTab: e.detail.current
  102. });
  103. },
  104. // 点击tab切换
  105. swichNav: function(e) {
  106. var that = this;
  107. if (this.data.currentTab === e.target.dataset.current) {
  108. return false;
  109. } else {
  110. that.setData({
  111. currentTab: e.target.dataset.current
  112. })
  113. }
  114. }
  115. })