Bootstrap

数据可视化——实验3 空间数据数据可视化代码

绘制螺旋线

<!DOCTYPE html>
<html>
  <head>
    <meta charset = "utf-8">
    <title>实验3——螺旋线</title>
    <script src = "echarts.js"></script>
    <!--导入ECharts-gl包-->
    <script src="https://cdn.jsdelivr.net/npm/echarts-gl/dist/echarts-gl.min.js"></script>
  </head>
  <div id = "main" style = "width:900px;height:600px;"></div>
  <script type="text/javascript">

    //螺旋线数据准备
    var data = [];
    for (var t = 0; t < 1000; t += 0.1) {
    //螺旋线方程
      let x = (5+5 * Math.cos(  Math.PI/24*t));
      let y = (5+5 * Math.sin(Math.PI/24*t));
      let z = Math.PI/48*t; 
      data.push([x, y, z]);
    }
    
    var myChart = echarts.init(document.getElementById('main'));

    var option = {
   
      title:{
    //标题
        text: "螺旋线",
        left: 'center',
        top: '5%',
        textStyle:{
   
          fontFamily: '宋体',
          fontSize: 40,
          fontWeight: 'bold'
        }
      },
      tooltip: {
   },  //提示框
      backgroundColor: '#fff',  //背景色
      visualMap: {
     //视觉模块
        show: false,  //是否显示手柄
        dimension: 2,
        max:50,
        inRange: {
   
          color: [
            '#313695',
            '#4575b4',
            
;