麦粉社区
>
帖子详情

修改仪表盘柱图样式

电子表格 发表于 2021-9-22 15:05
发表于 2021-9-22 15:05:20
我在网上弄了一个进度条的样式,代码如下,但是现在的数据都是写死的,如果想要跟随着自助结果集的数据变动的话,那两个数据的地方要用什么代替呢?代替的地方已经标红.
option = {
            backgroundColor:"#fff",
            grid: {
                top: '15%',
                left: '4%',
                right: '25%',
                bottom: '13%'
            },
            tooltip: {
                show: false
            },
            xAxis: {
                type: 'value',
                min: 0,
                max:1,
                axisLine: {
                    show: false,
                    lineStyle: {
                        color: '#ffffff',
                        width: 1
                    },
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: 'rgba(49,135,243,0.3)'
                    }
                },
                axisLabel: {
                    show: false,
                },
                axisTick: {
                    show: false,
                }
            },
            yAxis: {
                //show: false,
                type: 'category',
                inverse:true,
                splitLine: {
                    show: false,
                },
                axisLine: {
                    show: false
                },
                axisLabel: {
                    show: true,
                    interval: 0,
                    margin: 0,
                    align: 'left',
                    padding: [-50, 0, 0, 0],
                    textStyle: {
                        color: '#ffffff',
                        fontSize: 16
                    }
                },
                axisTick: {
                    show: false
                },
                data : []
            },
            series: [{
                //真实数值条形图
                name: "真实值",
                type: 'bar', //pictorialBar
                barWidth: 20,
                itemStyle: {
                    normal: {
                        borderWidth: 0,
                        color: 'rgb(46,130,242)'
                    },
                    barBorderRadius: 10
                },
                label: {
                    show: false,
                },
                data : [0.9265],
                z: 0
            }, {
                //辅助方格图形
                name: "辅助值",
                type: 'pictorialBar',
                barWidth: 20,
                symbol: 'rect',
                symbolRepeat: 'true',
                symbolMargin: 10,
                symbolSize: ['20%', '100%'],
                symbolOffset: ['120%', '0%'],
                // symbolRepeat: true,
                itemStyle: {
                    normal: {
                        color: '#fff'
                    },
                    barBorderRadius: 10
                 },
                label: {
                    normal: {
                        color: '#000',
                        show: true,
                        position: ['100%', '10%'],
                        fontSize: 16,
                        formatter: function(params) {
                            //console.info(params);
                            return ' ' + ([0.9265][params.dataIndex]*100).toFixed(2) + '%';//这里的0.9265是从结果集中取出后代替
                        }
                    }
                },
                data : [1],
                z: 1
            },{
                //辅助背景图形
                name: "背景条",
                type: 'bar', //pictorialBar
                barWidth: 20,
                barGap : '-100%',
                itemStyle: {
                    normal: {
                        borderWidth: 0,
                        color: 'rgb(91,168,248)',
                        opacity:0.2
                    },
                    barBorderRadius: 10
                },
                data : [1],
                z: 0
            },]
        };

发表于 2021-9-22 16:23:46
网上的代码不一定能在smartbi实现的,截图说明一下你想要实现的效果呗,在看一下这个扩展属性要怎么写
回复

使用道具 举报

发表于 2021-9-22 16:30:23
就像这样的图,其实我已经把样式都能在smartbi里面实现了,就是那个数据是固定好了的
回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

2回帖数 0关注人数 1693浏览人数
最后回复于:2021-9-22 16:30
快速回复 返回顶部 返回列表