首页 > 解决方案 > 在 plotly 饼图 hoverlabel 中增加填充 - javascript

问题描述

我正在尝试使用以下方法增加饼图的 hoverlabel 属性的填充,但似乎不起作用。有没有人尝试过这个用例或者有没有其他方法可以做到这一点..

 hoverlabel: {
                        bgcolor: 'white',
                        bordercolor: '#e7e7e7',
                        font: {
                            color: 'black',
                        },
                        padding: {
                            t: '20',
                            b: '50',
                            l: '0',
                            r: '0'
                        },
                        borderwidth: 2
}

在此处输入图像描述

标签: javascriptcssplotlyplotly.js

解决方案


您可以使用 CSS 展开图例框,然后移动悬停元素。

.legend .bg {
  rx: 10px;
  transform: scale(1.2, 1.2);
}

.legend .scrollbox {
  transform: translate(10px, 7px);
}

不是一个完美的解决方案,但它有效。


推荐阅读