左下角词云为3D动态旋转词云

其他模块皆直接对接口即可

附带下载地址:仿联想大数据监控评测平台-Webpack文档类资源-CSDN下载

即下即用

  init() {
      const tags = document.querySelectorAll(".tag");
      const wrap = document.querySelector(".tag-wrap");

      let len = tags.length;
      let valueList = Array.from(new Set(this.data.map(i => i.value)));
      let min = Math.min(...valueList);
      CX = wrap.offsetWidth / 2;
      CY = wrap.offsetHeight / 2;

      tags.forEach((i, index) => {
        let fontScale = this.data[index].value / min * 16;
        i.style.fontSize = fontScale > 30 ? '30px' : fontScale + 'px';
        i.style.color = colors[parseInt(Math.random() * 10)];

        let k = -1 + (2 * (index + 1) - 1) / len;
        let a = Math.acos(k);
        let b = a * Math.sqrt(len * Math.PI);
        let x = RADIUS * 1.15 * Math.sin(a) * Math.cos(b);
        let y = RADIUS * Math.sin(a) * Math.sin(b);
        let z = RADIUS * Math.cos(a);
        let tag = new Tag(i, x, y, z);
        this.tagList.push(tag);
      });
    },
    rotateX() {
      let angleX = Math.PI / 500;
      let cos = Math.cos(angleX);
      let sin = Math.sin(angleX);
      this.tagList.forEach(i => {
        let y1 = i.y * cos - i.z * sin;
        let z1 = i.z * cos + i.y * sin;
        i.y = y1;
        i.z = z1;
      });
    },
    rotateY() {
      let angleY = Math.PI / 500;
      let cos = Math.cos(angleY);
      let sin = Math.sin(angleY);
      this.tagList.forEach(i => {
        let x1 = i.x * cos - i.z * sin;
        let z1 = i.z * cos + i.x * sin;
        i.x = x1;
        i.z = z1;
      });
    },

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐