散点图的常见的效果

气泡图效果

  • 散点的大小不同 symbolSize
  • 散点的颜色不同 itemStyle.color

涟漪动画效果

  • type: effectScatter
  • showEffectOn: 'emphasis' // 鼠标移入时产生涟漪动画

散点图特点

  • 散点图可以帮助我们推断出不同维度数据之间的相关性
  • 散点图也经常用在地图的标注上

代码实例

 //3. 将type的值设置为scatter, x轴和y轴的type都是value
      var data = [
        { gender: "female", height: 161.2, weight: 51.6 },
        { gender: "female", height: 167.5, weight: 59 },
        { gender: "female", height: 159.5, weight: 49.2 },
        { gender: "female", height: 157, weight: 63 },
        { gender: "female", height: 155.8, weight: 53.6 },
        { gender: "female", height: 170, weight: 59 },
        { gender: "female", height: 159.1, weight: 47.6 },
        { gender: "female", height: 166, weight: 69.8 },
        { gender: "female", height: 176.2, weight: 66.8 },
        { gender: "female", height: 160.2, weight: 75.2 },
        { gender: "female", height: 172.5, weight: 55.2 },
        { gender: "female", height: 170.9, weight: 54.2 },
        { gender: "female", height: 172.9, weight: 62.5 },
        { gender: "female", height: 153.4, weight: 42 },
        { gender: "female", height: 160, weight: 50 },
        { gender: "female", height: 147.2, weight: 49.8 },
        { gender: "female", height: 168.2, weight: 49.2 },
        { gender: "female", height: 175, weight: 73.2 },
        { gender: "female", height: 157, weight: 47.8 },
        { gender: "female", height: 167.6, weight: 68.8 },
        { gender: "female", height: 159.5, weight: 50.6 },
        { gender: "female", height: 175, weight: 82.5 },
        { gender: "female", height: 166.8, weight: 57.2 },
        { gender: "female", height: 176.5, weight: 87.8 },
        { gender: "female", height: 170.2, weight: 72.8 },
        { gender: "female", height: 174, weight: 54.5 },
        { gender: "female", height: 173, weight: 59.8 },
        { gender: "female", height: 179.9, weight: 67.3 },
        { gender: "female", height: 170.5, weight: 67.8 },
        { gender: "female", height: 160, weight: 47 },
        { gender: "female", height: 154.4, weight: 46.2 },
        { gender: "female", height: 162, weight: 55 },
        { gender: "female", height: 176.5, weight: 83 },
        { gender: "female", height: 160, weight: 54.4 },
        { gender: "female", height: 152, weight: 45.8 },
        { gender: "female", height: 162.1, weight: 53.6 },
        { gender: "female", height: 170, weight: 73.2 },
        { gender: "female", height: 160.2, weight: 52.1 },
        { gender: "female", height: 161.3, weight: 67.9 },
        { gender: "female", height: 166.4, weight: 56.6 },
        { gender: "female", height: 168.9, weight: 62.3 },
        { gender: "female", height: 163.8, weight: 58.5 },
        { gender: "female", height: 167.6, weight: 54.5 },
        { gender: "female", height: 160, weight: 50.2 },
        { gender: "female", height: 161.3, weight: 60.3 },
        { gender: "female", height: 167.6, weight: 58.3 },
        { gender: "female", height: 165.1, weight: 56.2 },
        { gender: "female", height: 160, weight: 50.2 },
        { gender: "female", height: 170, weight: 72.9 },
        { gender: "female", height: 157.5, weight: 59.8 },
        { gender: "female", height: 167.6, weight: 61 },
        { gender: "female", height: 160.7, weight: 69.1 },
        { gender: "female", height: 163.2, weight: 55.9 },
        { gender: "female", height: 152.4, weight: 46.5 },
        { gender: "female", height: 157.5, weight: 54.3 },
        { gender: "female", height: 168.3, weight: 54.8 },
        { gender: "female", height: 180.3, weight: 60.7 },
        { gender: "female", height: 165.5, weight: 60 },
        { gender: "female", height: 165, weight: 62 },
        { gender: "female", height: 164.5, weight: 60.3 },
        { gender: "female", height: 156, weight: 52.7 },
        { gender: "female", height: 160, weight: 74.3 },
        { gender: "female", height: 163, weight: 62 },
        { gender: "female", height: 165.7, weight: 73.1 },
        { gender: "female", height: 161, weight: 80 },
        { gender: "female", height: 162, weight: 54.7 },
        { gender: "female", height: 166, weight: 53.2 },
        { gender: "female", height: 174, weight: 75.7 },
        { gender: "female", height: 172.7, weight: 61.1 },
        { gender: "female", height: 167.6, weight: 55.7 },
        { gender: "female", height: 151.1, weight: 48.7 },
        { gender: "female", height: 164.5, weight: 52.3 },
        { gender: "female", height: 163.5, weight: 50 },
        { gender: "female", height: 152, weight: 59.3 },
        { gender: "female", height: 169, weight: 62.5 },
        { gender: "female", height: 164, weight: 55.7 },
        { gender: "female", height: 161.2, weight: 54.8 },
        { gender: "female", height: 155, weight: 45.9 },
        { gender: "female", height: 170, weight: 70.6 },
        { gender: "female", height: 176.2, weight: 67.2 },
        { gender: "female", height: 170, weight: 69.4 },
        { gender: "female", height: 162.5, weight: 58.2 },
        { gender: "female", height: 170.3, weight: 64.8 },
        { gender: "female", height: 164.1, weight: 71.6 },
        { gender: "female", height: 169.5, weight: 52.8 },
        { gender: "female", height: 163.2, weight: 59.8 },
        { gender: "female", height: 154.5, weight: 49 },
        { gender: "female", height: 159.8, weight: 50 },
        { gender: "female", height: 173.2, weight: 69.2 },
        { gender: "female", height: 170, weight: 55.9 },
        { gender: "female", height: 161.4, weight: 63.4 },
        { gender: "female", height: 169, weight: 58.2 },
        { gender: "female", height: 166.2, weight: 58.6 },
        { gender: "female", height: 159.4, weight: 45.7 },
        { gender: "female", height: 162.5, weight: 52.2 },
        { gender: "female", height: 159, weight: 48.6 },
        { gender: "female", height: 162.8, weight: 57.8 },
        { gender: "female", height: 159, weight: 55.6 },
        { gender: "female", height: 179.8, weight: 66.8 },
        { gender: "female", height: 162.9, weight: 59.4 },
        { gender: "female", height: 161, weight: 53.6 },
        { gender: "female", height: 151.1, weight: 73.2 },
        { gender: "female", height: 168.2, weight: 53.4 },
        { gender: "female", height: 168.9, weight: 69 },
        { gender: "female", height: 173.2, weight: 58.4 },
        { gender: "female", height: 171.8, weight: 56.2 },
        { gender: "female", height: 178, weight: 70.6 },
        { gender: "female", height: 164.3, weight: 59.8 },
        { gender: "female", height: 163, weight: 72 },
        { gender: "female", height: 168.5, weight: 65.2 },
        { gender: "female", height: 166.8, weight: 56.6 },
        { gender: "female", height: 172.7, weight: 105.2 },
        { gender: "female", height: 163.5, weight: 51.8 },
        { gender: "female", height: 169.4, weight: 63.4 },
        { gender: "female", height: 167.8, weight: 59 },
        { gender: "female", height: 159.5, weight: 47.6 },
        { gender: "female", height: 167.6, weight: 63 },
        { gender: "female", height: 161.2, weight: 55.2 },
        { gender: "female", height: 160, weight: 45 },
        { gender: "female", height: 163.2, weight: 54 },
        { gender: "female", height: 162.2, weight: 50.2 },
        { gender: "female", height: 161.3, weight: 60.2 },
        { gender: "female", height: 149.5, weight: 44.8 },
        { gender: "female", height: 157.5, weight: 58.8 },
        { gender: "female", height: 163.2, weight: 56.4 },
        { gender: "female", height: 172.7, weight: 62 },
        { gender: "female", height: 155, weight: 49.2 },
        { gender: "female", height: 156.5, weight: 67.2 },
        { gender: "female", height: 164, weight: 53.8 },
        { gender: "female", height: 160.9, weight: 54.4 },
        { gender: "female", height: 162.8, weight: 58 },
        { gender: "female", height: 167, weight: 59.8 },
        { gender: "female", height: 160, weight: 54.8 },
        { gender: "female", height: 160, weight: 43.2 },
        { gender: "female", height: 168.9, weight: 60.5 },
        { gender: "female", height: 158.2, weight: 46.4 },
        { gender: "female", height: 156, weight: 64.4 },
        { gender: "female", height: 160, weight: 48.8 },
        { gender: "female", height: 167.1, weight: 62.2 },
        { gender: "female", height: 158, weight: 55.5 },
        { gender: "female", height: 167.6, weight: 57.8 },
        { gender: "female", height: 156, weight: 54.6 },
        { gender: "female", height: 162.1, weight: 59.2 },
        { gender: "female", height: 173.4, weight: 52.7 },
        { gender: "female", height: 159.8, weight: 53.2 },
        { gender: "female", height: 170.5, weight: 64.5 },
        { gender: "female", height: 159.2, weight: 51.8 },
        { gender: "female", height: 157.5, weight: 56 },
        { gender: "female", height: 161.3, weight: 63.6 },
        { gender: "female", height: 162.6, weight: 63.2 },
        { gender: "female", height: 160, weight: 59.5 },
        { gender: "female", height: 168.9, weight: 56.8 },
        { gender: "female", height: 165.1, weight: 64.1 },
        { gender: "female", height: 162.6, weight: 50 },
        { gender: "female", height: 165.1, weight: 72.3 },
        { gender: "female", height: 166.4, weight: 55 },
        { gender: "female", height: 160, weight: 55.9 },
        { gender: "female", height: 152.4, weight: 60.4 },
        { gender: "female", height: 170.2, weight: 69.1 },
        { gender: "female", height: 162.6, weight: 84.5 },
        { gender: "female", height: 170.2, weight: 55.9 },
        { gender: "female", height: 158.8, weight: 55.5 },
        { gender: "female", height: 172.7, weight: 69.5 },
        { gender: "female", height: 167.6, weight: 76.4 },
        { gender: "female", height: 162.6, weight: 61.4 },
        { gender: "female", height: 167.6, weight: 65.9 },
        { gender: "female", height: 156.2, weight: 58.6 },
        { gender: "female", height: 175.2, weight: 66.8 },
        { gender: "female", height: 172.1, weight: 56.6 },
        { gender: "female", height: 162.6, weight: 58.6 },
        { gender: "female", height: 160, weight: 55.9 },
        { gender: "female", height: 165.1, weight: 59.1 },
        { gender: "female", height: 182.9, weight: 81.8 },
        { gender: "female", height: 166.4, weight: 70.7 },
        { gender: "female", height: 165.1, weight: 56.8 },
        { gender: "female", height: 177.8, weight: 60 },
        { gender: "female", height: 165.1, weight: 58.2 },
        { gender: "female", height: 175.3, weight: 72.7 },
        { gender: "female", height: 154.9, weight: 54.1 },
        { gender: "female", height: 158.8, weight: 49.1 },
        { gender: "female", height: 172.7, weight: 75.9 },
        { gender: "female", height: 168.9, weight: 55 },
        { gender: "female", height: 161.3, weight: 57.3 },
        { gender: "female", height: 167.6, weight: 55 },
        { gender: "female", height: 165.1, weight: 65.5 },
        { gender: "female", height: 175.3, weight: 65.5 },
        { gender: "female", height: 157.5, weight: 48.6 },
        { gender: "female", height: 163.8, weight: 58.6 },
        { gender: "female", height: 167.6, weight: 63.6 },
        { gender: "female", height: 165.1, weight: 55.2 },
        { gender: "female", height: 165.1, weight: 62.7 },
        { gender: "female", height: 168.9, weight: 56.6 },
        { gender: "female", height: 162.6, weight: 53.9 },
        { gender: "female", height: 164.5, weight: 63.2 },
        { gender: "female", height: 176.5, weight: 73.6 },
        { gender: "female", height: 168.9, weight: 62 },
        { gender: "female", height: 175.3, weight: 63.6 },
        { gender: "female", height: 159.4, weight: 53.2 },
        { gender: "female", height: 160, weight: 53.4 },
        { gender: "female", height: 170.2, weight: 55 },
        { gender: "female", height: 162.6, weight: 70.5 },
        { gender: "female", height: 167.6, weight: 54.5 },
        { gender: "female", height: 162.6, weight: 54.5 },
        { gender: "female", height: 160.7, weight: 55.9 },
        { gender: "female", height: 160, weight: 59 },
        { gender: "female", height: 157.5, weight: 63.6 },
        { gender: "female", height: 162.6, weight: 54.5 },
        { gender: "female", height: 152.4, weight: 47.3 },
        { gender: "female", height: 170.2, weight: 67.7 },
        { gender: "female", height: 165.1, weight: 80.9 },
        { gender: "female", height: 172.7, weight: 70.5 },
        { gender: "female", height: 165.1, weight: 60.9 },
        { gender: "female", height: 170.2, weight: 63.6 },
        { gender: "female", height: 170.2, weight: 54.5 },
        { gender: "female", height: 170.2, weight: 59.1 },
        { gender: "female", height: 161.3, weight: 70.5 },
        { gender: "female", height: 167.6, weight: 52.7 },
        { gender: "female", height: 167.6, weight: 62.7 },
        { gender: "female", height: 165.1, weight: 86.3 },
        { gender: "female", height: 162.6, weight: 66.4 },
        { gender: "female", height: 152.4, weight: 67.3 },
        { gender: "female", height: 168.9, weight: 63 },
        { gender: "female", height: 170.2, weight: 73.6 },
        { gender: "female", height: 175.2, weight: 62.3 },
        { gender: "female", height: 175.2, weight: 57.7 },
        { gender: "female", height: 160, weight: 55.4 },
        { gender: "female", height: 165.1, weight: 104.1 },
        { gender: "female", height: 174, weight: 55.5 },
        { gender: "female", height: 170.2, weight: 77.3 },
        { gender: "female", height: 160, weight: 80.5 },
        { gender: "female", height: 167.6, weight: 64.5 },
        { gender: "female", height: 167.6, weight: 72.3 },
        { gender: "female", height: 167.6, weight: 61.4 },
        { gender: "female", height: 154.9, weight: 58.2 },
        { gender: "female", height: 162.6, weight: 81.8 },
        { gender: "female", height: 175.3, weight: 63.6 },
        { gender: "female", height: 171.4, weight: 53.4 },
        { gender: "female", height: 157.5, weight: 54.5 },
        { gender: "female", height: 165.1, weight: 53.6 },
        { gender: "female", height: 160, weight: 60 },
        { gender: "female", height: 174, weight: 73.6 },
        { gender: "female", height: 162.6, weight: 61.4 },
        { gender: "female", height: 174, weight: 55.5 },
        { gender: "female", height: 162.6, weight: 63.6 },
        { gender: "female", height: 161.3, weight: 60.9 },
        { gender: "female", height: 156.2, weight: 60 },
        { gender: "female", height: 149.9, weight: 46.8 },
        { gender: "female", height: 169.5, weight: 57.3 },
        { gender: "female", height: 160, weight: 64.1 },
        { gender: "female", height: 175.3, weight: 63.6 },
        { gender: "female", height: 169.5, weight: 67.3 },
        { gender: "female", height: 160, weight: 75.5 },
        { gender: "female", height: 172.7, weight: 68.2 },
        { gender: "female", height: 162.6, weight: 61.4 },
        { gender: "female", height: 157.5, weight: 76.8 },
        { gender: "female", height: 176.5, weight: 71.8 },
        { gender: "female", height: 164.4, weight: 55.5 },
        { gender: "female", height: 160.7, weight: 48.6 },
        { gender: "female", height: 174, weight: 66.4 },
        { gender: "female", height: 163.8, weight: 67.3 },
        { gender: "male", height: 174, weight: 65.6 },
        { gender: "male", height: 175.3, weight: 71.8 },
        { gender: "male", height: 193.5, weight: 80.7 },
        { gender: "male", height: 186.5, weight: 72.6 },
        { gender: "male", height: 187.2, weight: 78.8 },
        { gender: "male", height: 181.5, weight: 74.8 },
        { gender: "male", height: 184, weight: 86.4 },
        { gender: "male", height: 184.5, weight: 78.4 },
        { gender: "male", height: 175, weight: 62 },
        { gender: "male", height: 184, weight: 81.6 },
        { gender: "male", height: 180, weight: 76.6 },
        { gender: "male", height: 177.8, weight: 83.6 },
        { gender: "male", height: 192, weight: 90 },
        { gender: "male", height: 176, weight: 74.6 },
        { gender: "male", height: 174, weight: 71 },
        { gender: "male", height: 184, weight: 79.6 },
        { gender: "male", height: 192.7, weight: 93.8 },
        { gender: "male", height: 171.5, weight: 70 },
        { gender: "male", height: 173, weight: 72.4 },
        { gender: "male", height: 176, weight: 85.9 },
        { gender: "male", height: 176, weight: 78.8 },
        { gender: "male", height: 180.5, weight: 77.8 },
        { gender: "male", height: 172.7, weight: 66.2 },
        { gender: "male", height: 176, weight: 86.4 },
        { gender: "male", height: 173.5, weight: 81.8 },
        { gender: "male", height: 178, weight: 89.6 },
        { gender: "male", height: 180.3, weight: 82.8 },
        { gender: "male", height: 180.3, weight: 76.4 },
        { gender: "male", height: 164.5, weight: 63.2 },
        { gender: "male", height: 173, weight: 60.9 },
        { gender: "male", height: 183.5, weight: 74.8 },
        { gender: "male", height: 175.5, weight: 70 },
        { gender: "male", height: 188, weight: 72.4 },
        { gender: "male", height: 189.2, weight: 84.1 },
        { gender: "male", height: 172.8, weight: 69.1 },
        { gender: "male", height: 170, weight: 59.5 },
        { gender: "male", height: 182, weight: 67.2 },
        { gender: "male", height: 170, weight: 61.3 },
        { gender: "male", height: 177.8, weight: 68.6 },
        { gender: "male", height: 184.2, weight: 80.1 },
        { gender: "male", height: 186.7, weight: 87.8 },
        { gender: "male", height: 171.4, weight: 84.7 },
        { gender: "male", height: 172.7, weight: 73.4 },
        { gender: "male", height: 175.3, weight: 72.1 },
        { gender: "male", height: 180.3, weight: 82.6 },
        { gender: "male", height: 182.9, weight: 88.7 },
        { gender: "male", height: 188, weight: 84.1 },
        { gender: "male", height: 177.2, weight: 94.1 },
        { gender: "male", height: 172.1, weight: 74.9 },
        { gender: "male", height: 167, weight: 59.1 },
        { gender: "male", height: 169.5, weight: 75.6 },
        { gender: "male", height: 174, weight: 86.2 },
        { gender: "male", height: 172.7, weight: 75.3 },
        { gender: "male", height: 182.2, weight: 87.1 },
        { gender: "male", height: 164.1, weight: 55.2 },
        { gender: "male", height: 163, weight: 57 },
        { gender: "male", height: 171.5, weight: 61.4 },
        { gender: "male", height: 184.2, weight: 76.8 },
        { gender: "male", height: 174, weight: 86.8 },
        { gender: "male", height: 174, weight: 72.2 },
        { gender: "male", height: 177, weight: 71.6 },
        { gender: "male", height: 186, weight: 84.8 },
        { gender: "male", height: 167, weight: 68.2 },
        { gender: "male", height: 171.8, weight: 66.1 },
        { gender: "male", height: 182, weight: 72 },
        { gender: "male", height: 167, weight: 64.6 },
        { gender: "male", height: 177.8, weight: 74.8 },
        { gender: "male", height: 164.5, weight: 70 },
        { gender: "male", height: 192, weight: 101.6 },
        { gender: "male", height: 175.5, weight: 63.2 },
        { gender: "male", height: 171.2, weight: 79.1 },
        { gender: "male", height: 181.6, weight: 78.9 },
        { gender: "male", height: 167.4, weight: 67.7 },
        { gender: "male", height: 181.1, weight: 66 },
        { gender: "male", height: 177, weight: 68.2 },
        { gender: "male", height: 174.5, weight: 63.9 },
        { gender: "male", height: 177.5, weight: 72 },
        { gender: "male", height: 170.5, weight: 56.8 },
        { gender: "male", height: 182.4, weight: 74.5 },
        { gender: "male", height: 197.1, weight: 90.9 },
        { gender: "male", height: 180.1, weight: 93 },
        { gender: "male", height: 175.5, weight: 80.9 },
        { gender: "male", height: 180.6, weight: 72.7 },
        { gender: "male", height: 184.4, weight: 68 },
        { gender: "male", height: 175.5, weight: 70.9 },
        { gender: "male", height: 180.6, weight: 72.5 },
        { gender: "male", height: 177, weight: 72.5 },
        { gender: "male", height: 177.1, weight: 83.4 },
        { gender: "male", height: 181.6, weight: 75.5 },
        { gender: "male", height: 176.5, weight: 73 },
        { gender: "male", height: 175, weight: 70.2 },
        { gender: "male", height: 174, weight: 73.4 },
        { gender: "male", height: 165.1, weight: 70.5 },
        { gender: "male", height: 177, weight: 68.9 },
        { gender: "male", height: 192, weight: 102.3 },
        { gender: "male", height: 176.5, weight: 68.4 },
        { gender: "male", height: 169.4, weight: 65.9 },
        { gender: "male", height: 182.1, weight: 75.7 },
        { gender: "male", height: 179.8, weight: 84.5 },
        { gender: "male", height: 175.3, weight: 87.7 },
        { gender: "male", height: 184.9, weight: 86.4 },
        { gender: "male", height: 177.3, weight: 73.2 },
        { gender: "male", height: 167.4, weight: 53.9 },
        { gender: "male", height: 178.1, weight: 72 },
        { gender: "male", height: 168.9, weight: 55.5 },
        { gender: "male", height: 157.2, weight: 58.4 },
        { gender: "male", height: 180.3, weight: 83.2 },
        { gender: "male", height: 170.2, weight: 72.7 },
        { gender: "male", height: 177.8, weight: 64.1 },
        { gender: "male", height: 172.7, weight: 72.3 },
        { gender: "male", height: 165.1, weight: 65 },
        { gender: "male", height: 186.7, weight: 86.4 },
        { gender: "male", height: 165.1, weight: 65 },
        { gender: "male", height: 174, weight: 88.6 },
        { gender: "male", height: 175.3, weight: 84.1 },
        { gender: "male", height: 185.4, weight: 66.8 },
        { gender: "male", height: 177.8, weight: 75.5 },
        { gender: "male", height: 180.3, weight: 93.2 },
        { gender: "male", height: 180.3, weight: 82.7 },
        { gender: "male", height: 177.8, weight: 58 },
        { gender: "male", height: 177.8, weight: 79.5 },
        { gender: "male", height: 177.8, weight: 78.6 },
        { gender: "male", height: 177.8, weight: 71.8 },
        { gender: "male", height: 177.8, weight: 116.4 },
        { gender: "male", height: 163.8, weight: 72.2 },
        { gender: "male", height: 188, weight: 83.6 },
        { gender: "male", height: 198.1, weight: 85.5 },
        { gender: "male", height: 175.3, weight: 90.9 },
        { gender: "male", height: 166.4, weight: 85.9 },
        { gender: "male", height: 190.5, weight: 89.1 },
        { gender: "male", height: 166.4, weight: 75 },
        { gender: "male", height: 177.8, weight: 77.7 },
        { gender: "male", height: 179.7, weight: 86.4 },
        { gender: "male", height: 172.7, weight: 90.9 },
        { gender: "male", height: 190.5, weight: 73.6 },
        { gender: "male", height: 185.4, weight: 76.4 },
        { gender: "male", height: 168.9, weight: 69.1 },
        { gender: "male", height: 167.6, weight: 84.5 },
        { gender: "male", height: 175.3, weight: 64.5 },
        { gender: "male", height: 170.2, weight: 69.1 },
        { gender: "male", height: 190.5, weight: 108.6 },
        { gender: "male", height: 177.8, weight: 86.4 },
        { gender: "male", height: 190.5, weight: 80.9 },
        { gender: "male", height: 177.8, weight: 87.7 },
        { gender: "male", height: 184.2, weight: 94.5 },
        { gender: "male", height: 176.5, weight: 80.2 },
        { gender: "male", height: 177.8, weight: 72 },
        { gender: "male", height: 180.3, weight: 71.4 },
        { gender: "male", height: 171.4, weight: 72.7 },
        { gender: "male", height: 172.7, weight: 84.1 },
        { gender: "male", height: 172.7, weight: 76.8 },
        { gender: "male", height: 177.8, weight: 63.6 },
        { gender: "male", height: 177.8, weight: 80.9 },
        { gender: "male", height: 182.9, weight: 80.9 },
        { gender: "male", height: 170.2, weight: 85.5 },
        { gender: "male", height: 167.6, weight: 68.6 },
        { gender: "male", height: 175.3, weight: 67.7 },
        { gender: "male", height: 165.1, weight: 66.4 },
        { gender: "male", height: 185.4, weight: 102.3 },
        { gender: "male", height: 181.6, weight: 70.5 },
        { gender: "male", height: 172.7, weight: 95.9 },
        { gender: "male", height: 190.5, weight: 84.1 },
        { gender: "male", height: 179.1, weight: 87.3 },
        { gender: "male", height: 175.3, weight: 71.8 },
        { gender: "male", height: 170.2, weight: 65.9 },
        { gender: "male", height: 193, weight: 95.9 },
        { gender: "male", height: 171.4, weight: 91.4 },
        { gender: "male", height: 177.8, weight: 81.8 },
        { gender: "male", height: 177.8, weight: 96.8 },
        { gender: "male", height: 167.6, weight: 69.1 },
        { gender: "male", height: 167.6, weight: 82.7 },
        { gender: "male", height: 180.3, weight: 75.5 },
        { gender: "male", height: 182.9, weight: 79.5 },
        { gender: "male", height: 176.5, weight: 73.6 },
        { gender: "male", height: 186.7, weight: 91.8 },
        { gender: "male", height: 188, weight: 84.1 },
        { gender: "male", height: 188, weight: 85.9 },
        { gender: "male", height: 177.8, weight: 81.8 },
        { gender: "male", height: 174, weight: 82.5 },
        { gender: "male", height: 177.8, weight: 80.5 },
        { gender: "male", height: 171.4, weight: 70 },
        { gender: "male", height: 185.4, weight: 81.8 },
        { gender: "male", height: 185.4, weight: 84.1 },
        { gender: "male", height: 188, weight: 90.5 },
        { gender: "male", height: 188, weight: 91.4 },
        { gender: "male", height: 182.9, weight: 89.1 },
        { gender: "male", height: 176.5, weight: 85 },
        { gender: "male", height: 175.3, weight: 69.1 },
        { gender: "male", height: 175.3, weight: 73.6 },
        { gender: "male", height: 188, weight: 80.5 },
        { gender: "male", height: 188, weight: 82.7 },
        { gender: "male", height: 175.3, weight: 86.4 },
        { gender: "male", height: 170.5, weight: 67.7 },
        { gender: "male", height: 179.1, weight: 92.7 },
        { gender: "male", height: 177.8, weight: 93.6 },
        { gender: "male", height: 175.3, weight: 70.9 },
        { gender: "male", height: 182.9, weight: 75 },
        { gender: "male", height: 170.8, weight: 93.2 },
        { gender: "male", height: 188, weight: 93.2 },
        { gender: "male", height: 180.3, weight: 77.7 },
        { gender: "male", height: 177.8, weight: 61.4 },
        { gender: "male", height: 185.4, weight: 94.1 },
        { gender: "male", height: 168.9, weight: 75 },
        { gender: "male", height: 185.4, weight: 83.6 },
        { gender: "male", height: 180.3, weight: 85.5 },
        { gender: "male", height: 174, weight: 73.9 },
        { gender: "male", height: 167.6, weight: 66.8 },
        { gender: "male", height: 182.9, weight: 87.3 },
        { gender: "male", height: 160, weight: 72.3 },
        { gender: "male", height: 180.3, weight: 88.6 },
        { gender: "male", height: 167.6, weight: 75.5 },
        { gender: "male", height: 186.7, weight: 101.4 },
        { gender: "male", height: 175.3, weight: 91.1 },
        { gender: "male", height: 175.3, weight: 67.3 },
        { gender: "male", height: 175.9, weight: 77.7 },
        { gender: "male", height: 175.3, weight: 81.8 },
        { gender: "male", height: 179.1, weight: 75.5 },
        { gender: "male", height: 181.6, weight: 84.5 },
        { gender: "male", height: 177.8, weight: 76.6 },
        { gender: "male", height: 182.9, weight: 85 },
        { gender: "male", height: 177.8, weight: 102.5 },
        { gender: "male", height: 184.2, weight: 77.3 },
        { gender: "male", height: 179.1, weight: 71.8 },
        { gender: "male", height: 176.5, weight: 87.9 },
        { gender: "male", height: 188, weight: 94.3 },
        { gender: "male", height: 174, weight: 70.9 },
        { gender: "male", height: 167.6, weight: 64.5 },
        { gender: "male", height: 170.2, weight: 77.3 },
        { gender: "male", height: 167.6, weight: 72.3 },
        { gender: "male", height: 188, weight: 87.3 },
        { gender: "male", height: 174, weight: 80 },
        { gender: "male", height: 176.5, weight: 82.3 },
        { gender: "male", height: 180.3, weight: 73.6 },
        { gender: "male", height: 167.6, weight: 74.1 },
        { gender: "male", height: 188, weight: 85.9 },
        { gender: "male", height: 180.3, weight: 73.2 },
        { gender: "male", height: 167.6, weight: 76.3 },
        { gender: "male", height: 183, weight: 65.9 },
        { gender: "male", height: 183, weight: 90.9 },
        { gender: "male", height: 179.1, weight: 89.1 },
        { gender: "male", height: 170.2, weight: 62.3 },
        { gender: "male", height: 177.8, weight: 82.7 },
        { gender: "male", height: 179.1, weight: 79.1 },
        { gender: "male", height: 190.5, weight: 98.2 },
        { gender: "male", height: 177.8, weight: 84.1 },
        { gender: "male", height: 180.3, weight: 83.2 },
        { gender: "male", height: 180.3, weight: 83.2 }
      ];
      var axisData = [];
      for (var i = 0; i < data.length; i++) {
        var height = data[i].height;
        var weight = data[i].weight;
        var newArr = [height, weight];
        axisData.push(newArr);
      }
      console.log(axisData);
      var myCharts = echarts.init(document.querySelector("div"));
      var option = {
        xAxis: {
          type: "value",
          scale: true
        },
        yAxis: {
          type: "value",
          scale: true
        },
        series: [
          {
            // type: "scatter",
            type: "effectScatter",
            showEffectOn: 'emphasis', // render emphasis
            rippleEffect: {
              scale: 5
            },
            data: axisData,
            // symbolSize: 30
            symbolSize: function(arg) {
              var height = arg[0] / 100;
              var weight = arg[1];
              // bmi = 体重(kg) / (身高m*升高) 大于28, 就代表肥胖
              var bmi = weight / (height * height);
              if (bmi > 28) {
                return 20;
              } else {
                return 5;
              }
            },
            itemStyle: {
              color: function(arg) {
                var height = arg.data[0] / 100;
                var weight = arg.data[1];
                // bmi = 体重(kg) / (身高m*升高) 大于28, 就代表肥胖
                var bmi = weight / (height * height);
                if (bmi > 28) {
                  return 'red';
                } else {
                  return 'green';
                }
              }
            }
          }
        ]
      };
      myCharts.setOption(option);
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,752评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,100评论 3 387
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 159,244评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,099评论 1 286
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,210评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,307评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,346评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,133评论 0 269
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,546评论 1 306
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,849评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,019评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,702评论 4 337
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,331评论 3 319
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,030评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,260评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,871评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,898评论 2 351

推荐阅读更多精彩内容