text: import muBan from './myCanvas';
  export default (myCanvas, height, weight) => {
    var color = '#FF0000';
    var color_ = "#000000";
    var font = '12px Arial';
    var font2 = '30px Microsoft YaHei';
    var a = [
      '0',
      '2',
      '4',
      '6',
      '8',
      '10',
      '12',
      '14',
      '16',
      '18',
      '20',
      '22',
      '24',
      '26',
      '28',
      '30',
      '32',
      '34',
      '36月',
    ];
    var l = [
      '',
      '105',
      '100',
      '95',
      '90',
      '85',
      '80',
      '75',
      '70',
      '65',
      '60',
      '55',
      '50',
      '45',
      '4',
      '2',
    ];
    var r = [
      '',
      '105',
      '100',
      '95',
      '90',
      '85',
      '20',
      '18',
      '16',
      '14',
      '12',
      '10',
      '8',
      '6',
      '4',
      '2',
    ];
    var t = '身高(cm)';
    var b = '体重(kg)';
    var title = '中国0~3岁女童身高、体重百分位曲线图';
    var arr_h_3 = [
      [0, 46.6],
      [2, 53.4],
      [4, 59.1],
      [6, 62.5],
      [9, 66.4],
      [12, 70],
      [15, 73.2],
      [18, 76],
      [21, 78.5],
      [24, 80.9],
      [30, 85.2],
      [36, 88.6],
    ];
    var arr_h_10 = [
      [0, 47.5],
      [2, 54.7],
      [4, 60.3],
      [6, 63.9],
      [9, 67.8],
      [12, 71.6],
      [15, 74.9],
      [18, 77.7],
      [21, 80.4],
      [24, 82.9],
      [30, 87.4],
      [36, 90.8],
    ];
    var arr_h_25 = [
      [0, 48.6],
      [2, 56],
      [4, 61.7],
      [6, 65.2],
      [9, 69.3],
      [12, 73.2],
      [15, 76.6],
      [18, 79.5],
      [21, 82.3],
      [24, 84.9],
      [30, 89.6],
      [36, 93.1],
    ];
    var arr_h_50 = [
      [0, 49.7],
      [2, 57.4],
      [4, 63.1],
      [6, 66.8],
      [9, 71],
      [12, 75],
      [15, 78.5],
      [18, 81.5],
      [21, 84.4],
      [24, 87.2],
      [30, 92.1],
      [36, 95.6],
    ];
    var arr_h_75 = [
      [0, 50.9],
      [2, 58.9],
      [4, 64.6],
      [6, 68.4],
      [9, 72.8],
      [12, 76.8],
      [15, 80.4],
      [18, 83.6],
      [21, 86.6],
      [24, 89.5],
      [30, 94.6],
      [36, 98.2],
    ];
    var arr_h_90 = [
      [0, 51.9],
      [2, 60.2],
      [4, 66],
      [6, 69.8],
      [9, 74.3],
      [12, 78.5],
      [15, 82.2],
      [18, 85.5],
      [21, 88.6],
      [24, 91.7],
      [30, 97],
      [36, 100.5],
    ];
    var arr_h_97 = [
      [0, 53],
      [2, 61.6],
      [4, 67.4],
      [6, 71.2],
      [9, 75.9],
      [12, 80.2],
      [15, 84],
      [18, 87.4],
      [21, 90.7],
      [24, 93.9],
      [30, 99.3],
      [36, 102.9],
    ];
  
    var arr_w_3 = [
      [0, 2.57],
      [2, 4.21],
      [4, 5.55],
      [6, 6.34],
      [9, 7.11],
      [12, 7.7],
      [15, 8.22],
      [18, 8.73],
      [21, 9.26],
      [24, 9.76],
      [30, 10.65],
      [36, 11.5],
    ];
    var arr_w_10 = [
      [0, 2.76],
      [2, 4.5],
      [4, 5.93],
      [6, 6.76],
      [9, 7.58],
      [12, 8.2],
      [15, 8.75],
      [18, 9.29],
      [21, 9.86],
      [24, 10.39],
      [30, 11.35],
      [36, 12.27],
    ];
    var arr_w_25 = [
      [0, 2.96],
      [2, 4.82],
      [4, 6.34],
      [6, 7.21],
      [9, 8.08],
      [12, 8.74],
      [15, 9.13],
      [18, 9.91],
      [21, 10.51],
      [24, 11.08],
      [30, 12.12],
      [36, 13.11],
    ];
    var arr_w_50 = [
      [0, 3.21],
      [2, 5.21],
      [4, 6.83],
      [6, 7.77],
      [9, 8.69],
      [12, 9.4],
      [15, 10.02],
      [18, 10.65],
      [21, 11.3],
      [24, 11.92],
      [30, 13.05],
      [36, 14.13],
    ];
    var arr_w_75 = [
      [0, 3.49],
      [2, 5.64],
      [4, 7.37],
      [6, 8.37],
      [9, 9.36],
      [12, 10.12],
      [15, 10.79],
      [18, 11.46],
      [21, 12.17],
      [24, 12.84],
      [30, 14.07],
      [36, 15.25],
    ];
    var arr_w_90 = [
      [0, 3.75],
      [2, 6.06],
      [4, 7.9],
      [6, 8.96],
      [9, 10.01],
      [12, 10.82],
      [15, 11.53],
      [18, 12.25],
      [21, 13.01],
      [24, 13.74],
      [30, 15.08],
      [36, 16.36],
    ];
    var arr_w_97 = [
      [0, 4.04],
      [2, 6.51],
      [4, 8.47],
      [6, 9.59],
      [9, 10.71],
      [12, 11.57],
      [15, 12.33],
      [18, 13.11],
      [21, 13.93],
      [24, 14.71],
      [30, 16.16],
      [36, 17.55],
    ];
  
    var m = new muBan(35, 60, 100, 100);
    var c = document.getElementById(myCanvas);
    var ctx = c.getContext('2d');
  
    m.box(ctx, color, 0.75, 0.2, 19, 38, 17, 170); //画格子
    m.txt(ctx, color, font, a, a, l, r, t, b, 19, 17); //写字
    m.title(ctx, color, font2, title, 19);
  
    //身高
    m.line(ctx, 36, color, 2, arr_h_3, 13, 45, 5, 2, false, false, '3');
    m.line(ctx, 36, color, 0.5, arr_h_10, 13, 45, 5, 2, false, false, '10');
    m.line(ctx, 36, color, 0.5, arr_h_25, 13, 45, 5, 2, false, false, '25');
    m.line(ctx, 36, color, 2, arr_h_50, 13, 45, 5, 2, false, false, '50');
    m.line(ctx, 36, color, 0.5, arr_h_75, 13, 45, 5, 2, false, false, '75');
    m.line(ctx, 36, color, 0.5, arr_h_90, 13, 45, 5, 2, false, false, '90');
    m.line(ctx, 36, color, 2, arr_h_97, 13, 45, 5, 2, false, false, '97');
  
    //体重
    m.line(ctx, 36, color, 2, arr_w_3, 15, 2, 2, 2, false, false, '3');
    m.line(ctx, 36, color, 0.5, arr_w_10, 15, 2, 2, 2, false, false, '10');
    m.line(ctx, 36, color, 0.5, arr_w_25, 15, 2, 2, 2, false, false, '25');
    m.line(ctx, 36, color, 2, arr_w_50, 15, 2, 2, 2, false, false, '50');
    m.line(ctx, 36, color, 0.5, arr_w_75, 15, 2, 2, 2, false, false, '75');
    m.line(ctx, 36, color, 0.5, arr_w_90, 15, 2, 2, 2, false, false, '90');
    m.line(ctx, 36, color, 2, arr_w_97, 15, 2, 2, 2, false, false, '97');
  
    height && m.line(ctx, 36, color_, 2, height, 13, 45, 5, 2, true, false, null); //身高
    weight && m.line(ctx, 36, color_, 2, weight, 15, 2, 2, 2, true, false, null); //体重
  
  
    //左上角实时显示数值
    c.addEventListener("mousemove", function(e) {
      var cRect = c.getBoundingClientRect();
      var canvasX = Math.round(e.clientX - cRect.left);
      var canvasY = Math.round(e.clientY - cRect.top);
      //      ctx.clearRect(0, 0, c.width, c.height);
      ctx.clearRect(0, 0, 300, 25); //清空制定区域
      var Xx = "--";
      if (canvasX > 100 && canvasX <= 100 + (35 * 18)) {
        Xx = (canvasX - 100) * 2 / 35;
      }
      var Yy = "--";
      var Yy2 = "--";
      if (canvasY > 100 && canvasY <= 100 + (60 * 16)) {
        Yy = 110 - (canvasY - 100) * 5 / 60;
        Yy2 = 32 - (canvasY - 100) * 2 / 60;
      }
  
      var age = typeof Xx === 'number' ? Xx.toFixed(1) : Xx;
      var height = typeof Yy === 'number' ? Yy.toFixed(1) : Yy;
      var weight = typeof Yy2 === 'number' ? Yy2.toFixed(1) : Yy2;
      ctx.fillText("年龄:" + age + "个月，身高:" + height + "cm，体重:" + weight + "kg", 10, 20);
    });
  
  
  
  
  };
  