|  | @@ -0,0 +1,306 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +    <div id="discounted_columnar_echart" ref="discounted_columnar_echart"></div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +export default {
 | 
	
		
			
				|  |  | +    components: {},
 | 
	
		
			
				|  |  | +    data() {
 | 
	
		
			
				|  |  | +        return {};
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //监听属性 类似于data概念
 | 
	
		
			
				|  |  | +    computed: {},
 | 
	
		
			
				|  |  | +    //监控data中的数据变化
 | 
	
		
			
				|  |  | +    watch: {},
 | 
	
		
			
				|  |  | +    //方法集合
 | 
	
		
			
				|  |  | +    methods: {
 | 
	
		
			
				|  |  | +        init_bjxm_echart() {
 | 
	
		
			
				|  |  | +            var myChart = echarts.init(this.$refs.discounted_columnar_echart);
 | 
	
		
			
				|  |  | +            // 柱状图的宽度,y是x的一半
 | 
	
		
			
				|  |  | +            const offsetX = 10
 | 
	
		
			
				|  |  | +            const offsetY = 5
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            // 绘制左侧面
 | 
	
		
			
				|  |  | +            const CubeLeft = echarts.graphic.extendShape({
 | 
	
		
			
				|  |  | +                shape: {
 | 
	
		
			
				|  |  | +                    x: 0,
 | 
	
		
			
				|  |  | +                    y: 0
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                buildPath: function (ctx, shape) {
 | 
	
		
			
				|  |  | +                    const xAxisPoint = shape.xAxisPoint
 | 
	
		
			
				|  |  | +                    const c0 = [shape.x, shape.y]
 | 
	
		
			
				|  |  | +                    const c1 = [shape.x - offsetX, shape.y - offsetY]
 | 
	
		
			
				|  |  | +                    const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY]
 | 
	
		
			
				|  |  | +                    const c3 = [xAxisPoint[0], xAxisPoint[1]]
 | 
	
		
			
				|  |  | +                    ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath()
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +            // 绘制右侧面
 | 
	
		
			
				|  |  | +            const CubeRight = echarts.graphic.extendShape({
 | 
	
		
			
				|  |  | +                shape: {
 | 
	
		
			
				|  |  | +                    x: 0,
 | 
	
		
			
				|  |  | +                    y: 0
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                buildPath: function (ctx, shape) {
 | 
	
		
			
				|  |  | +                    const xAxisPoint = shape.xAxisPoint
 | 
	
		
			
				|  |  | +                    const c1 = [shape.x, shape.y]
 | 
	
		
			
				|  |  | +                    const c2 = [xAxisPoint[0], xAxisPoint[1]]
 | 
	
		
			
				|  |  | +                    const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY]
 | 
	
		
			
				|  |  | +                    const c4 = [shape.x + offsetX, shape.y - offsetY]
 | 
	
		
			
				|  |  | +                    ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath()
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +            // 绘制顶面
 | 
	
		
			
				|  |  | +            const CubeTop = echarts.graphic.extendShape({
 | 
	
		
			
				|  |  | +                shape: {
 | 
	
		
			
				|  |  | +                    x: 0,
 | 
	
		
			
				|  |  | +                    y: 0,
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                buildPath: function (ctx, shape) {
 | 
	
		
			
				|  |  | +                    const c1 = [shape.x, shape.y]
 | 
	
		
			
				|  |  | +                    const c2 = [shape.x + offsetX, shape.y - offsetY]
 | 
	
		
			
				|  |  | +                    const c3 = [shape.x, shape.y - offsetX]
 | 
	
		
			
				|  |  | +                    const c4 = [shape.x - offsetX, shape.y - offsetY]
 | 
	
		
			
				|  |  | +                    ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath()
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +            // 注册三个面图形
 | 
	
		
			
				|  |  | +            echarts.graphic.registerShape('CubeLeft', CubeLeft)
 | 
	
		
			
				|  |  | +            echarts.graphic.registerShape('CubeRight', CubeRight)
 | 
	
		
			
				|  |  | +            echarts.graphic.registerShape('CubeTop', CubeTop)
 | 
	
		
			
				|  |  | +            // 数据
 | 
	
		
			
				|  |  | +            const VALUE = [210.9, 260.8, 204.2, 504.9, 740.5]
 | 
	
		
			
				|  |  | +            let option = {
 | 
	
		
			
				|  |  | +                //你的代码
 | 
	
		
			
				|  |  | +                backgroundColor: 'rgba(17, 42, 62, 0)',//"#012366",
 | 
	
		
			
				|  |  | +                tooltip: {
 | 
	
		
			
				|  |  | +                    show:false,
 | 
	
		
			
				|  |  | +                    trigger: 'axis',
 | 
	
		
			
				|  |  | +                    axisPointer: {
 | 
	
		
			
				|  |  | +                        type: 'shadow'
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    formatter: function (params) {
 | 
	
		
			
				|  |  | +                        const item = params[1]
 | 
	
		
			
				|  |  | +                        return item.name + "\n" + item.value;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                grid: {
 | 
	
		
			
				|  |  | +                    left: 0,
 | 
	
		
			
				|  |  | +                    right: 0,
 | 
	
		
			
				|  |  | +                    bottom: 20,
 | 
	
		
			
				|  |  | +                    top: 30,
 | 
	
		
			
				|  |  | +                    containLabel: true
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                xAxis: {
 | 
	
		
			
				|  |  | +                    type: 'category',
 | 
	
		
			
				|  |  | +                    data: ['崖州区', '天崖区', '吉阳区', '海棠区', '育才区'],
 | 
	
		
			
				|  |  | +                    axisLine: {
 | 
	
		
			
				|  |  | +                        lineStyle: {
 | 
	
		
			
				|  |  | +                            color: '#BCD3E5'
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    // offset: 25,
 | 
	
		
			
				|  |  | +                    axisTick: {
 | 
	
		
			
				|  |  | +                        show: false,
 | 
	
		
			
				|  |  | +                        length: 9,
 | 
	
		
			
				|  |  | +                        alignWithLabel: true,
 | 
	
		
			
				|  |  | +                        lineStyle: {
 | 
	
		
			
				|  |  | +                            color: '#BCD3E5'
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    axisLabel: {
 | 
	
		
			
				|  |  | +                        show: true,
 | 
	
		
			
				|  |  | +                        fontSize: 12,
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                yAxis: [
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        min: 0,
 | 
	
		
			
				|  |  | +                        max: 1200,
 | 
	
		
			
				|  |  | +                        interval: 200,
 | 
	
		
			
				|  |  | +                        type: 'value',
 | 
	
		
			
				|  |  | +                        name: '临时用地(公顷)',
 | 
	
		
			
				|  |  | +                        axisLine: {
 | 
	
		
			
				|  |  | +                            show: false,
 | 
	
		
			
				|  |  | +                            lineStyle: {
 | 
	
		
			
				|  |  | +                                color: '#BCD3E5'
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        splitLine: {
 | 
	
		
			
				|  |  | +                            show: false,
 | 
	
		
			
				|  |  | +                            lineStyle: {
 | 
	
		
			
				|  |  | +                                type: "dashed",
 | 
	
		
			
				|  |  | +                                color: "rgba(255,255,255,0.1)"
 | 
	
		
			
				|  |  | +                            },
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        axisTick: {
 | 
	
		
			
				|  |  | +                            show: false
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        axisLabel: {
 | 
	
		
			
				|  |  | +                            show: true,
 | 
	
		
			
				|  |  | +                            fontSize: 12,
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        boundaryGap: ['20%', '20%']
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        min: 0,
 | 
	
		
			
				|  |  | +                        max: 1200,
 | 
	
		
			
				|  |  | +                        interval: 200,
 | 
	
		
			
				|  |  | +                        name: '项目数(个)',
 | 
	
		
			
				|  |  | +                        type: 'value',
 | 
	
		
			
				|  |  | +                        axisLine: {
 | 
	
		
			
				|  |  | +                            show: false,
 | 
	
		
			
				|  |  | +                            lineStyle: {
 | 
	
		
			
				|  |  | +                                color: '#BCD3E5'
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        splitLine: {
 | 
	
		
			
				|  |  | +                            show: true,
 | 
	
		
			
				|  |  | +                            lineStyle: {
 | 
	
		
			
				|  |  | +                                type: "dashed",
 | 
	
		
			
				|  |  | +                                color: "rgba(255,255,255,0.1)"
 | 
	
		
			
				|  |  | +                            },
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        axisTick: {
 | 
	
		
			
				|  |  | +                            show: false
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        axisLabel: {
 | 
	
		
			
				|  |  | +                            show: true,
 | 
	
		
			
				|  |  | +                            fontSize: 12,
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        boundaryGap: ['20%', '20%']
 | 
	
		
			
				|  |  | +                    },],
 | 
	
		
			
				|  |  | +                series: [
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        type: 'custom',
 | 
	
		
			
				|  |  | +                        renderItem: (params, api) => {
 | 
	
		
			
				|  |  | +                            const location = api.coord([api.value(0), api.value(1)])
 | 
	
		
			
				|  |  | +                            var color = api.value(1) > 10000 ? 'red' : new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
 | 
	
		
			
				|  |  | +                                offset: 0,
 | 
	
		
			
				|  |  | +                                color: 'rgba(33,101,140,0.5)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                            },
 | 
	
		
			
				|  |  | +                            {
 | 
	
		
			
				|  |  | +                                offset: 0.8,
 | 
	
		
			
				|  |  | +                                color: 'rgba(33,101,140,0.5)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            ])
 | 
	
		
			
				|  |  | +                            return {
 | 
	
		
			
				|  |  | +                                type: 'group',
 | 
	
		
			
				|  |  | +                                children: [
 | 
	
		
			
				|  |  | +                                    {
 | 
	
		
			
				|  |  | +                                        type: 'CubeLeft',
 | 
	
		
			
				|  |  | +                                        shape: {
 | 
	
		
			
				|  |  | +                                            api,
 | 
	
		
			
				|  |  | +                                            xValue: api.value(0),
 | 
	
		
			
				|  |  | +                                            yValue: api.value(1),
 | 
	
		
			
				|  |  | +                                            x: location[0],
 | 
	
		
			
				|  |  | +                                            y: location[1],
 | 
	
		
			
				|  |  | +                                            xAxisPoint: api.coord([api.value(0), 0])
 | 
	
		
			
				|  |  | +                                        },
 | 
	
		
			
				|  |  | +                                        style: {
 | 
	
		
			
				|  |  | +                                            fill: color = api.value(1) > 10000 ? 'red' : new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
 | 
	
		
			
				|  |  | +                                                offset: 0,
 | 
	
		
			
				|  |  | +                                                color: 'rgba(34, 129, 209, 0.8)'
 | 
	
		
			
				|  |  | +                                            },
 | 
	
		
			
				|  |  | +                                            {
 | 
	
		
			
				|  |  | +                                                offset: 0.8,
 | 
	
		
			
				|  |  | +                                                color: 'rgba(34, 129, 209, 0.8)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                            }
 | 
	
		
			
				|  |  | +                                            ])
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                    },
 | 
	
		
			
				|  |  | +                                    {
 | 
	
		
			
				|  |  | +                                        type: 'CubeRight',
 | 
	
		
			
				|  |  | +                                        shape: {
 | 
	
		
			
				|  |  | +                                            api,
 | 
	
		
			
				|  |  | +                                            xValue: api.value(0),
 | 
	
		
			
				|  |  | +                                            yValue: api.value(1),
 | 
	
		
			
				|  |  | +                                            x: location[0],
 | 
	
		
			
				|  |  | +                                            y: location[1],
 | 
	
		
			
				|  |  | +                                            xAxisPoint: api.coord([api.value(0), 0])
 | 
	
		
			
				|  |  | +                                        },
 | 
	
		
			
				|  |  | +                                        style: {
 | 
	
		
			
				|  |  | +                                            fill: color = api.value(1) > 10000 ? 'red' : new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
 | 
	
		
			
				|  |  | +                                                offset: 0,
 | 
	
		
			
				|  |  | +                                                color: 'rgba(97, 173, 237, 0.8)'
 | 
	
		
			
				|  |  | +                                            },
 | 
	
		
			
				|  |  | +                                            {
 | 
	
		
			
				|  |  | +                                                offset: 0.8,
 | 
	
		
			
				|  |  | +                                                color: 'rgba(97, 173, 237, 0.8)'
 | 
	
		
			
				|  |  | +                                            }
 | 
	
		
			
				|  |  | +                                            ])
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                    }, {
 | 
	
		
			
				|  |  | +                                        type: 'CubeTop',
 | 
	
		
			
				|  |  | +                                        shape: {
 | 
	
		
			
				|  |  | +                                            api,
 | 
	
		
			
				|  |  | +                                            xValue: api.value(0),
 | 
	
		
			
				|  |  | +                                            yValue: api.value(1),
 | 
	
		
			
				|  |  | +                                            x: location[0],
 | 
	
		
			
				|  |  | +                                            y: location[1],
 | 
	
		
			
				|  |  | +                                            xAxisPoint: api.coord([api.value(0), 0])
 | 
	
		
			
				|  |  | +                                        },
 | 
	
		
			
				|  |  | +                                        style: {
 | 
	
		
			
				|  |  | +                                            fill: color = api.value(1) > 10000 ? 'red' : new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
 | 
	
		
			
				|  |  | +                                                offset: 0,
 | 
	
		
			
				|  |  | +                                                color: 'rgba(60, 167, 255, 1)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                            },
 | 
	
		
			
				|  |  | +                                            {
 | 
	
		
			
				|  |  | +                                                offset: 1,
 | 
	
		
			
				|  |  | +                                                color: 'rgba(135, 200, 255, 1)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                            }
 | 
	
		
			
				|  |  | +                                            ])
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                    }]
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        data: VALUE
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        type: 'line',
 | 
	
		
			
				|  |  | +                        smooth: true,
 | 
	
		
			
				|  |  | +                        itemStyle: {
 | 
	
		
			
				|  |  | +                            normal: {
 | 
	
		
			
				|  |  | +                                color: '#FFCC64'  // 折线的颜色
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                        data: VALUE,
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                ]
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            myChart.setOption(option);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    beforeCreate() { }, //生命周期 - 创建之前
 | 
	
		
			
				|  |  | +    created() { }, //生命周期 - 创建完成(可以访问当前this实例)
 | 
	
		
			
				|  |  | +    beforeMount() { }, //生命周期 - 挂载之前
 | 
	
		
			
				|  |  | +    mounted() {
 | 
	
		
			
				|  |  | +        this.init_bjxm_echart();
 | 
	
		
			
				|  |  | +    }, //生命周期 - 挂在完成
 | 
	
		
			
				|  |  | +    beforeUpdate() { }, //生命周期 - 更新之前
 | 
	
		
			
				|  |  | +    updated() { }, //生命周期 - 更新之后
 | 
	
		
			
				|  |  | +    beforeDestroy() { }, //生命周期 - 销毁之前
 | 
	
		
			
				|  |  | +    destroy() { },//生命周期 - 销毁完成
 | 
	
		
			
				|  |  | +    activated() { }, //若组件实例是 <KeepAlive> 缓存树的一部分,当组件被插入到 DOM 中时调用。
 | 
	
		
			
				|  |  | +    deactivated() { } //若组件实例是 <KeepAlive> 缓存树的一部分,当组件从 DOM 中被移除时调用。
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +<style  scoped>
 | 
	
		
			
				|  |  | +#discounted_columnar_echart {
 | 
	
		
			
				|  |  | +    position: relative;
 | 
	
		
			
				|  |  | +    top: 1rem;
 | 
	
		
			
				|  |  | +    width: 23.5rem;
 | 
	
		
			
				|  |  | +    height: 11rem;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 |