我正在将Vue与Britecharts一起使用,并且创建了水平条形图,然后将头像图像添加到名称标签右侧的Yas上。我进行了一些研究,发现D3 How to place image next to horizontal line text和this确实完成了我想实现的目标,但在D3中。
我想知道如何在Britecharts中做同样的事情。下面是我的示例代码。
Codepen: https://codepen.io/cooltaiwanesesam/pen/RwPYpbz
createHorizontalBarChart() {
let barChart = new britecharts.bar(),
margin = {left: 120, right: 20, top: 20, bottom: 30},
barContainer = d3.select('.js-horizontal-bar-chart-container'),
containerWidth = barContainer.node() ? barContainer.node().getBoundingClientRect().width : false;
barChart
.isHorizontal(true)
.margin(margin)
.width(containerWidth)
.colorSchema(britecharts.colors.colorSchemas.britecharts)
.valueLabel('percentage')
.height(300);
barContainer.datum(this.data.reverse()).call(barChart);
}
问题已解决。共享代码以帮助有需要的人。