echarts 고주파 국방

2760 단어
$.getScript(ROOT_PATH + 'vendors/simplex.js').done(function () {


var noise = new SimplexNoise(Math.random);
function generateData(theta, min, max) {
    var data = [];
    for (var i = 0; i < 30; i++) {
        for (var j = 0; j < 30; j++) {
            let a = Math.ceil(Math.random() * 5)
            let b = Math.ceil(Math.random() * 5)
            data.push([i, j, (a + b) / 2]);
        }
    }
    return data;
}

function addGenerateData(theta, min, max, data) {
    let data_ = data.filter((item) => {
        return item[0] != 0;
    })
    
    let data2_ = data_.map(item => {
        return [item[0] - 1, item[1], item[2]] 
    })
    
    for (var i = 0; i < 30; i++) {
        let b = Math.ceil(Math.random() * 5)
        let a = 1
        data2_.push([29, i, (a + b) / 2]);
    }
    return data2_;
}

var valMin = Infinity;
var valMax = -Infinity;

let data = generateData(2, -5, 5);

myChart.setOption(option = {
    visualMap: {
        show: false,
        min: 2,
        max: 6,
        inRange: {
            color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
        }
    },
    xAxis3D: {
        type: 'value'
    },
    yAxis3D: {
        type: 'value'
    },
    zAxis3D: {
        type: 'value',
        max: 10,
        min: 0
    },
    grid3D: {
        axisLine: {
            lineStyle: { color: '#fff' }
        },
        axisPointer: {
            lineStyle: { color: '#fff' }
        },
        viewControl: {
            // autoRotate: true
        },
        light: {
            main: {
                shadow: true,
                quality: 'ultra',
                intensity: 1.5
            }
        }
    },
    series: [{
        type: 'bar3D',
        data: data,
        shading: 'lambert',
        label: {
            formatter: function (param) {
                return param.value[2].toFixed(1);
            }
        }
    }]
});

var data_ = addGenerateData(2, -5, 5, data);

setInterval(function() {
    var data_ = addGenerateData(2, -5, 5, data);
    data = data_;
    myChart.setOption({
        series: [{
            type: 'bar3D',
            data: data_,
            shading: 'lambert',
            label: {
                formatter: function (param) {
                    return param.value[2].toFixed(1);
                }
            }
        }]
    }, false, true)
}, 200)

});



이 예제에서 수정된 주소:https://www.echartsjs.com/examples/zh/editor.html?c=bar3d-simplex-noise&gl=1&theme=dark

좋은 웹페이지 즐겨찾기