statistics_A.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. var app = getApp()
  2. var that;
  3. Page({
  4. data: {
  5. date: app.globalData.month,
  6. },
  7. onLoad() {
  8. that = this;
  9. app.globalData.showToast('success', '你好啊')
  10. },
  11. onInitChart(F2, config) {
  12. console.log(config);
  13. const chart = new F2.Chart(config);
  14. const data = [{
  15. date: '1月',
  16. value: 116
  17. }, {
  18. date: '2月',
  19. value: 129
  20. }, {
  21. date: '3月',
  22. value: 135
  23. }, {
  24. date: '4月',
  25. value: 86
  26. }, {
  27. date: '5月',
  28. value: 73
  29. }, {
  30. date: '6月',
  31. value: 85
  32. }];
  33. chart.source(data, {
  34. date: {
  35. range: [ 0, 1 ]
  36. }
  37. });
  38. chart.line().position('date*value');
  39. chart.point().position('date*value').style({
  40. stroke: '#fff',
  41. lineWidth: 1
  42. });
  43. chart.render();
  44. // 注意:需要把chart return 出来
  45. return chart;
  46. },
  47. //时间选择
  48. openDate() {
  49. dd.datePicker({
  50. format: 'yyyy-MM',
  51. currentDate: that.data.date,
  52. success: (res) => {
  53. that.setData({
  54. date: res.date
  55. })
  56. },
  57. });
  58. }
  59. });