Three.html 5.8 KB
<!DOCTYPE html>
<html style="height: 100%;width: 100%;">

<head>
    <script src="ue.js"></script>
    <meta charset="utf-8">
</head>

<body style="height: 100%;width: 100%; margin: 0;font-size:1rem;line-height:150%;overflow-y: hidden;overflow-x:hidden;">
    <div id="container" style="height: 100%;width: 100%;"></div>
    <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="echarts.min.js"></script>
    <script type="text/javascript" src="ajax.js"></script>
    <script type="text/javascript">


        var dom = document.getElementById("container");
        var myChart = echarts.init(dom);
        var app = {};
        var option;

        function eacharsassignment(s) {
            console.log(s);



            var name = s.name;
            var dataX = s.dataX;
            var dataY1 = s.dataY1;
            var dataY2 = s.dataY2;
            var dataY3 = s.dataY3;
            var dataY4 = s.dataY4;

            option = {
                tooltip: {
                    trigger: "axis",
                    axisPointer: {
                        // 坐标轴指示器,坐标轴触发有效
                        type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
                    },
                },
                legend: {
                    left: 'left',
                    icon: 'bar',
                    itemHeight: 10,
                    itemWidth: 10,
                    textStyle: {
                        color: '#fff'
                    },
                  
                },
                grid: {
                    top: '15%',
                    left: '0%',
                    right: '0%',
                    bottom: '0%',
                    containLabel: true,
                },
                xAxis: [
                    {
                        type: 'category',
                        data:dataX,
                        axisPointer: {
                            type: 'shadow'
                        },
                        axisLabel: {
                            color: '#fff'
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        axisLabel: {
                            formatter: '{value}',
                            color: '#fff'
                        }
                    },


                ],
                series: [
                    {
                        name: name[3],
                        type: 'bar',
                        stack: 'BB',
                        barWidth: '15%',
                        itemStyle: {
                            normal: {
                                
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: '#226FDF'
                                }, {
                                    offset: 1,
                                    color: '#226FDF'
                                }]),

                            }
                        },

                        data: dataY1
                    },
                    {
                        name: name[2],
                        type: 'bar',
                        stack: 'BB',

                        barWidth: '15%',
                        itemStyle: {
                            normal: {
                               
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: '#52B5D4'

                                }, {
                                    offset: 1,
                                    color: '#52B5D4'
                                }]),

                            }
                        },
                        data: dataY2
                    },
                    {
                        name: name[1],
                        type: 'bar',
                        stack: 'BB',
                        barWidth: '15%',
                        itemStyle: {
                            normal: {
                                
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: '#F29D0C'
                                }, {
                                    offset: 1,
                                    color: '#F29D0C'
                                }]),

                            }
                        },

                        data: dataY3
                    },
                    {
                        name: name[0],
                        type: 'bar',
                        stack: 'BB',

                        barWidth: '15%',
                        itemStyle: {
                            normal: {
                                barBorderRadius: [10, 10, 0, 0],
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: '#C23531'

                                }, {
                                    offset: 1,
                                    color: '#C23531'
                                }]),

                            }
                        },
                        data: dataY4
                    },


                ]
            };
            
            if (option && typeof option === 'object') {

            }
            myChart.setOption(option);
        };




        ue.interface.setEchatsValue = function (s) {
            eacharsassignment(s);
            console.log(s);
        }
    </script>
</body>

</html>